Bug 1328133 - biosdevname duplicate onboard devices
Summary: biosdevname duplicate onboard devices
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: biosdevname
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Michal Sekletar
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks: 1298243 1420851
TreeView+ depends on / blocked
 
Reported: 2016-04-18 14:31 UTC by Milos Vyletel
Modified: 2020-01-17 15:43 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-31 14:34:29 UTC
Target Upstream Version:


Attachments (Terms of Use)
dmidecode (36.42 KB, text/plain)
2016-08-11 14:44 UTC, Milos Vyletel
no flags Details

Description Milos Vyletel 2016-04-18 14:31:03 UTC
Description of problem:
biosdevname reports duplicate onboard decices

Handle 0x0073, DMI type 41, 11 bytes
Onboard Device
        Reference Designation:  i350#1
        Type: Ethernet
        Status: Enabled
        Type Instance: 1
        Bus Address: 0000:02:00.0

Handle 0x0074, DMI type 41, 11 bytes
Onboard Device
        Reference Designation:  i350#2
        Type: Ethernet
        Status: Enabled
        Type Instance: 2
        Bus Address: 0000:02:00.1

Handle 0x0075, DMI type 41, 11 bytes
Onboard Device
        Reference Designation:  Mellanox IB
        Type: Other
        Status: Enabled
        Type Instance: 1
        Bus Address: 0000:06:00.0

based on the code this is somewhat expected as the tool looks at type instance
field and assignes name based on that


                                if (dev->port)
                                        portnum = dev->port->port;
                                else if (vf->uses_sysfs & HAS_SYSFS_INDEX)
                                        portnum = vf->sysfs_index;
                                else if (vf->uses_smbios & HAS_SMBIOS_INSTANCE &&              is_pci_smbios_type_ethernet(vf))
                                        portnum = vf->smbios_instance;
                                else if (vf->embedded_index_valid)
                                        portnum = vf->embedded_index;
                                if (portnum != INT_MAX) {
                                        snprintf(location, sizeof(location), "%s%u", prefix,   portnum);
                                        known=1;
                                }

in this case second branch is used as HAS_SYSFS_INDEX flag is set since kernel
sets up /sys/bus/pci/devices/%s/index and populates it with smbios data

so kernel does not assign these numbers but instead read it from
dmi data

static struct device_attribute smbios_attr_instance = {
        .attr = {.name = "index", .mode = 0444},
        .show = smbiosinstance_show,
};

static ssize_t smbiosinstance_show(struct device *dev,
                                   struct device_attribute *attr, char *buf)
{
...
        return find_smbios_instance_string(pdev, buf,
                                           SMBIOS_ATTR_INSTANCE_SHOW);
}

static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
                                          enum smbios_attr_enum attribute)
{
...
        dmi = NULL;
        while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
                                      NULL, dmi)) != NULL) {
                donboard = dmi->device_data;
                if (donboard && donboard->bus == bus &&
                                        donboard->devfn == devfn) {
                        if (buf) {
                                if (attribute == SMBIOS_ATTR_INSTANCE_SHOW)
                                        return scnprintf(buf, PAGE_SIZE,
                                                         "%d\n",
                                                         donboard->instance);
                                else if (attribute == SMBIOS_ATTR_LABEL_SHOW)
                                        return scnprintf(buf, PAGE_SIZE,
                                                         "%s\n",
                                                         dmi->name);
                        }
                        return strlen(dmi->name);

the thing here is that having multiple onboard devices and the type instance
field has to be unique only within the same type

"System Management BIOS (SMBIOS) Reference Specification" spécifie that Device
Type Instance must be unique within a given onboard device type

7.42.2 Onboard Device Types
Table 117 shows what the byte values mean for the Onboard Device Types field.
Table 117 – Onboard Device Types field
Byte Value Meaning
01h Other
02h Unknown
03h Video
04h SCSI Controller
05h Ethernet
06h Token Ring
07h Sound
08h PATA Controller
09h SATA Controller
0Ah SAS Controller

7.42.3 Device Type Instance
Device Type Instance is a unique value (within a given onboard device type) used
to indicate the order
the device is designated by the system. For example, a system with two identical
Ethernet NICs may
designate one NIC (with higher Bus/Device/Function=15/0/0) as the first onboard
NIC (instance 1) and
the other NIC (with lower Bus/Device/Function =3/0/0) as the second onboard NIC
(instance 2). 
"

Version-Release number of selected component (if applicable):
any rhel7 version would do I guess (don't have exact version from customer)

How reproducible:
always 

Steps to Reproduce:
1. run biosdevname -d

Actual results:
duplicate names ("Duplicate: True" appears)

Expected results:
unique names

Comment 6 Sujith 2016-08-10 07:43:41 UTC
Hi Milos,
Can you share a few logs from this setup?
# biosdevname -d
# lspci -vvvxxxx
# dmidecode

Thanks,
Sujith

Comment 7 Milos Vyletel 2016-08-11 14:44:16 UTC
Created attachment 1190069 [details]
dmidecode

sure. here's dmidecode output (attached) and

[root@oval15 ~]# biosdevname -d
 BIOS device: em1
Kernel name: eno1
 Permanent MAC: 00:25:90:58:B1:28
 Assigned MAC : 00:25:90:58:B1:28
 ifIndex: 2
 Driver: igb
 Driver version: 5.2.15-k
 Firmware version: 1.52.0
 Bus Info: 0000:02:00.0
 PCI name : 0000:02:00.0
 PCI Slot : embedded
 SMBIOS Device Type: Ethernet
 SMBIOS Instance: 1
 SMBIOS Label: i350#1
 sysfs Index: 1
 sysfs Label: i350#1
 Embedded Index: 1

 Duplicate: True
BIOS device: em2
 Kernel name: eno2
 Permanent MAC: 00:25:90:58:B1:29
 Assigned MAC : 00:25:90:58:B1:29
 ifIndex: 3
 Driver: igb
 Driver version: 5.2.15-k
 Firmware version: 1.52.0
 Bus Info: 0000:02:00.1
 PCI name : 0000:02:00.1
 PCI Slot : embedded
 SMBIOS Device Type: Ethernet
 SMBIOS Instance: 2
 SMBIOS Label: i350#2
 sysfs Index: 2
 sysfs Label: i350#2
 Embedded Index: 2

 BIOS device: em1
Kernel name: ib0
 Permanent MAC: A0:00:02:20:FE:80
 Assigned MAC : A0:00:02:20:FE:80
 ifIndex: 4
 Driver: ib_ipoib
 Driver version: 3.1-1.0.3_29 Sep 2015
 Firmware version: 2.33.5000
 Bus Info: 0000:06:00.0
 PCI name : 0000:06:00.0
 PCI Slot : embedded
 sysfs Index: 1
 sysfs Label: Mellanox IB
 Embedded Index: 3

 Duplicate: True

Comment 8 Milos Vyletel 2016-08-11 14:44:46 UTC
will ask customer for lspci as well

Comment 11 Michal Sekletar 2017-03-31 14:34:29 UTC
biosdevname upstream recently merged this commit. Hence biosdevname will not assign any name to non-ethernet devices.

https://github.com/dell/biosdevname/commit/609f20c26f40ae4883f5e8c9b241470260722b3f

Since this bug was primarily about name clash between ethernet and IB device and non-ethernet devices are no longer supported I am closing this as CLOSED UPSTREAM.


Note You need to log in before you can comment on or make changes to this bug.