<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 20, 2015 at 10:04 PM, Jordan Hargrave <span dir="ltr"><<a href="mailto:jharg93@gmail.com" target="_blank">jharg93@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On Tue, Oct 20, 2015 at 3:02 PM, Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>> wrote:<br>
> 20.10.2015 17:30, Jordan Hargrave пишет:<br>
><br>
>> On Tue, Oct 20, 2015 at 1:15 AM, Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> On Tue, Oct 20, 2015 at 7:46 AM, Jordan Hargrave <<a href="mailto:jharg93@gmail.com">jharg93@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> On Mon, Mar 2, 2015 at 1:17 PM, Tom Gundersen <<a href="mailto:teg@jklm.no">teg@jklm.no</a>> wrote:<br>
>>>>><br>
>>>>> Hi Jordan,<br>
>>>>><br>
>>>>> On Mon, Mar 2, 2015 at 4:45 PM, Jordan Hargrave <<a href="mailto:jharg93@gmail.com">jharg93@gmail.com</a>><br>
>>>>> wrote:<br>
>>>>>><br>
>>>>>> There are currently two competing naming mechanisms for network cards,<br>
>>>>>> biosdevname and systemd. Systemd currently has some limitations on<br>
>>>>>> naming<br>
>>>>>> cards that use network partitioning or support SR-IOV.<br>
>>>>><br>
>>>>><br>
>>>>> Could you point to an example so we can fix it? I thought all bug<br>
>>>>> reports had been handled, but maybe I lost track of something.<br>
>>>>><br>
>>>><br>
>>>> I have a quad-port NIC:<br>
>>>> 0000:40:00.0 = PCIE bridge (SMBIOS Slot 2)<br>
>>>> 0000:41:00.0 = Ethernet Device (port1)<br>
>>>> 0000:41:00.1 = Ethernet Device (port2)<br>
>>>> 0000:42:00.0 = Ethernet Device (port3)<br>
>>>> 0000:42:00.1 = Ethernet Device (port4)<br>
>>>><br>
>>>> biosdevname would name these p2p1, p2p2, p2p3, p2p4 respectively.<br>
>>>><br>
>>><br>
>>> How does it determine that 41 and 42 are the same device? I.e. how<br>
>>> does it differ from real bridge with two independent two-port cards<br>
>>> behind? Could you explain what information it is using? Is it exported<br>
>>> in sysfs?<br>
>>><br>
>>> ...<br>
>><br>
>><br>
>> It knows they are on the same slot as the parent device has SMBIOS<br>
>> Slot#2 (Type 9). So all child devices of a physical slot are on the<br>
>> same card. I'm currently using a patch to systemd that reads SMBIOS<br>
>> type 9. There isn't a kernel sysfs variable that displays this.<br>
>><br>
><br>
> This gives us slot ID, but how do we know which of function 0 on this slot<br>
> ID is port 0 and which is port 2? There is nothing in SMBIOS description of<br>
> Type 9 that answers it.<br><br></div></div></blockquote></div></div><div class="gmail_extra">Looking for a resolution for this.. adding port numbers to systemd enumeration of devices in PCI slots.<br><br><font size="2"><span style="font-size:10pt">Systemd still doesn't have the
concept of a 'Port' number, so multi-port NICs get named with
enp<BUS>s<DEV>f<FUNC> instead of
ens<SLOT>p<PORT>.<br>
<br>
There needs to be a way to generate systemd names that have the following variables for add-in cards:<br>
Slot Number<br>
Port Number<br>
Instance Number (for SR-IOV or Network Partitioned devices)<br>
<br>
It is possible to calculate the port number without any knowledge of
sibling devices. Requires knowledge of device PCI ID, parent tree and
'dev_port' attribute (for mellanox cards). Then the devices could be named ensSLOTpPORT<br><br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">Network cards I've noticed have the following PCI bus topology:<br><br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">dual port cards:<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">bus:00.0 = port 1<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">bus:00.1 = port 2<br><br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">quad port cards have two different layouts: top level bus (upstream port) with two downstream ports, or all devices as multifunction<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt"><br>Broadcom cards seem to follow this style<br>bus:00.0 = port 1<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">bus:00.1 = port 2<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">bus:00.2 = port 3<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">bus:00.3 = port 4<br><br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">Intel cards seem to follow this style<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">bus:00.0 = upstream port. sbus is secondary bus<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">sbus:xx.y = bridge 1<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">sbus:xx.z = bridge 2<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">sbus+1:00.0 = port 1<br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">
sbus+1:00.1 = port 2<br>sbus+2:00.0 = port 3<br>sbus+2:00.1 = port 4<br><br></span></font></div><div class="gmail_extra"><font size="2"><span style="font-size:10pt">Walking up the /sys/bus/pci/devices heirarchy from the network 'device' link until the 'acpi_index' field is found/ Then read sysfs 'label' field. On Dell systems this is the form "SLOT x" so the slot ID can be determined.<br></span></font><br><br></div></div>