diff --git a/SOURCES/0001-Add-port-code-for-Mellanox-driver.patch b/SOURCES/0001-Add-port-code-for-Mellanox-driver.patch new file mode 100644 index 0000000..bedaffb --- /dev/null +++ b/SOURCES/0001-Add-port-code-for-Mellanox-driver.patch @@ -0,0 +1,157 @@ +From c140ce659a204d67e4cc61d2191443123f7dd970 Mon Sep 17 00:00:00 2001 +From: Jordan Hargrave +Date: Mon, 3 Mar 2014 11:06:44 -0600 +Subject: [PATCH] Add port code for Mellanox driver + +--- + configure.ac | 2 +- + src/bios_device.c | 47 ++++++++++++++++++++++++++++++++++------------- + src/bios_device.h | 2 ++ + src/naming_policy.c | 12 +++++++++--- + 4 files changed, 46 insertions(+), 17 deletions(-) + +diff --git a/configure.ac b/configure.ac +index e75e64a..d08d42f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3,7 +3,7 @@ + # vim:tw=0:ts=8:sw=8:et + + AC_PREREQ(2.59) +-AC_INIT([biosdevname],[0.5.0],[Jordan_Hargrave@dell.com]) ++AC_INIT([biosdevname],[0.5.1],[Jordan_Hargrave@dell.com]) + AC_LANG([C]) + AC_USE_SYSTEM_EXTENSIONS + AC_CONFIG_SRCDIR([src/read_proc.c]) +diff --git a/src/bios_device.c b/src/bios_device.c +index 132877e..ba0661f 100644 +--- a/src/bios_device.c ++++ b/src/bios_device.c +@@ -212,6 +212,16 @@ static void sort_device_list(struct libbiosdevname_state *state) + list_splice(&sorted_devices, &state->bios_devices); + } + ++/* Check for Mellanox/Chelsio drivers */ ++int ismultiport(const char *driver) ++{ ++ if (!strncmp(driver, "mlx", 3)) ++ return 1; ++ if (!strncmp(driver, "cxgb", 4)) ++ return 1; ++ return 0; ++} ++ + static void match_pci_and_eth_devs(struct libbiosdevname_state *state) + { + struct pci_device *p; +@@ -223,20 +233,30 @@ static void match_pci_and_eth_devs(struct libbiosdevname_state *state) + if (!is_pci_network(p)) + continue; + ++ /* Loop through all ether devices to find match */ + unparse_pci_name(pci_name, sizeof(pci_name), p->pci_dev); +- n = find_net_device_by_bus_info(state, pci_name); +- if (!n) +- continue; +- +- b = malloc(sizeof(*b)); +- if (!b) +- continue; +- memset(b, 0, sizeof(*b)); +- INIT_LIST_HEAD(&b->node); +- b->pcidev = p; +- b->netdev = n; +- claim_netdev(b->netdev); +- list_add(&b->node, &state->bios_devices); ++ list_for_each_entry(n, &state->network_devices, node) { ++ if (strncmp(n->drvinfo.bus_info, pci_name, sizeof(n->drvinfo.bus_info))) ++ continue; ++ b = malloc(sizeof(*b)); ++ if (!b) ++ continue; ++ memset(b, 0, sizeof(*b)); ++ INIT_LIST_HEAD(&b->node); ++ b->pcidev = p; ++ b->netdev = n; ++ b->port = NULL; ++ if (ismultiport(n->drvinfo.driver)) { ++ b->port = malloc(sizeof(struct pci_port)); ++ if (b->port != NULL) { ++ b->port->port = n->devid+1; ++ b->port->pfi = p->is_sriov_virtual_function ? ++ p->vf_index : -1; ++ } ++ } ++ claim_netdev(b->netdev); ++ list_add(&b->node, &state->bios_devices); ++ } + } + } + +@@ -258,6 +278,7 @@ static void match_unknown_eths(struct libbiosdevname_state *state) + memset(b, 0, sizeof(*b)); + INIT_LIST_HEAD(&b->node); + b->netdev = n; ++ b->port = NULL; + list_add(&b->node, &state->bios_devices); + } + } +diff --git a/src/bios_device.h b/src/bios_device.h +index 690ed6f..158a2af 100644 +--- a/src/bios_device.h ++++ b/src/bios_device.h +@@ -12,12 +12,14 @@ + #include "pci.h" + #include "naming_policy.h" + ++struct pci_port; + + struct bios_device { + struct list_head node; + struct network_device *netdev; + struct pci_device *pcidev; + char *bios_name; ++ struct pci_port *port; + int duplicate; + }; + +diff --git a/src/naming_policy.c b/src/naming_policy.c +index 4f2033c..7138a4b 100644 +--- a/src/naming_policy.c ++++ b/src/naming_policy.c +@@ -55,7 +55,9 @@ static void use_physical(const struct libbiosdevname_state *state, const char *p + vf = vf->vpd_pf; + if (vf->pf) + vf = vf->pf; +- if (vf->uses_sysfs & HAS_SYSFS_INDEX) ++ 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; +@@ -68,7 +70,9 @@ static void use_physical(const struct libbiosdevname_state *state, const char *p + } + else if (dev->pcidev->physical_slot < PHYSICAL_SLOT_UNKNOWN) { + snprintf(location, sizeof(location), "p%u", dev->pcidev->physical_slot); +- if (dev->pcidev->vpd_port < INT_MAX) ++ if (dev->port) ++ portnum = dev->port->port; ++ else if (dev->pcidev->vpd_port < INT_MAX) + portnum = dev->pcidev->vpd_port; + else if (!dev->pcidev->is_sriov_virtual_function) + portnum = dev->pcidev->index_in_slot; +@@ -78,7 +82,9 @@ static void use_physical(const struct libbiosdevname_state *state, const char *p + known=1; + } + +- if (dev->pcidev->is_sriov_virtual_function) ++ if (dev->port && dev->port->pfi != -1) ++ snprintf(interface, sizeof(interface), "_%u", dev->port->pfi); ++ else if (dev->pcidev->is_sriov_virtual_function) + snprintf(interface, sizeof(interface), "_%u", dev->pcidev->vf_index); + else if (dev->pcidev->vpd_pfi < INT_MAX) + snprintf(interface, sizeof(interface), "_%u", dev->pcidev->vpd_pfi); +-- +1.8.4.2 + diff --git a/SOURCES/0001-Add-port-structure-to-PCI-device-handle-multiple-por.patch b/SOURCES/0001-Add-port-structure-to-PCI-device-handle-multiple-por.patch new file mode 100644 index 0000000..43522eb --- /dev/null +++ b/SOURCES/0001-Add-port-structure-to-PCI-device-handle-multiple-por.patch @@ -0,0 +1,85 @@ +From f3e6790b7986a4f9dd4a407901717ef8de3cbbc6 Mon Sep 17 00:00:00 2001 +From: Jordan Hargrave +Date: Tue, 25 Feb 2014 16:35:40 -0600 +Subject: [PATCH] Add port structure to PCI device, handle multiple ports per + BDF (Mellanox) + +--- + src/pci.c | 21 +++++++++++++++++++++ + src/pci.h | 7 +++++++ + 2 files changed, 28 insertions(+) + +diff --git a/src/pci.c b/src/pci.c +index e85cb03..a2d8145 100644 +--- a/src/pci.c ++++ b/src/pci.c +@@ -121,6 +121,25 @@ static int pci_vpd_find_info_subkey(const u8 *buf, unsigned int off, unsigned in + return -1; + } + ++/* Add port identifier(s) to PCI device */ ++static void add_port(struct pci_device *pdev, int port, int pfi) ++{ ++ struct pci_port *p; ++ ++ list_for_each_entry(p, &pdev->ports, node) { ++ if (p->port == port && p->pfi == pfi) ++ return; ++ } ++ p = malloc(sizeof(*p)); ++ if (p == NULL) ++ return; ++ memset(p, 0, sizeof(*p)); ++ INIT_LIST_HEAD(&p->node); ++ p->port = port; ++ p->pfi = pfi; ++ list_add_tail(&p->node, &pdev->ports); ++} ++ + static int parse_vpd(struct libbiosdevname_state *state, struct pci_device *pdev, int len, unsigned char *vpd) + { + int i, j, k, isz, jsz, port, func, pfi; +@@ -155,6 +174,7 @@ static int parse_vpd(struct libbiosdevname_state *state, struct pci_device *pdev + pdev->pci_dev->bus, + pdev->pci_dev->dev, + func)) != NULL) { ++ add_port(vf, port, pfi); + if (vf->vpd_port == INT_MAX) { + vf->vpd_port = port; + vf->vpd_pfi = pfi; +@@ -597,6 +617,7 @@ static void add_pci_dev(struct libbiosdevname_state *state, + INIT_LIST_HEAD(&dev->node); + INIT_LIST_HEAD(&dev->vfnode); + INIT_LIST_HEAD(&dev->vfs); ++ INIT_LIST_HEAD(&dev->ports); + dev->pci_dev = p; + dev->physical_slot = PHYSICAL_SLOT_UNKNOWN; + dev->class = pci_read_word(p, PCI_CLASS_DEVICE); +diff --git a/src/pci.h b/src/pci.h +index 77b4746..eacb539 100644 +--- a/src/pci.h ++++ b/src/pci.h +@@ -20,6 +20,12 @@ struct slotlist + int count; + }; + ++struct pci_port { ++ struct list_head node; ++ int port; ++ int pfi; ++}; ++ + struct pci_device { + struct list_head node; + struct pci_dev *pci_dev; +@@ -44,6 +50,7 @@ struct pci_device { + struct pci_device *pf; + struct list_head vfnode; + struct list_head vfs; ++ struct list_head ports; + unsigned int is_sriov_physical_function:1; + unsigned int is_sriov_virtual_function:1; + unsigned int embedded_index_valid:1; +-- +1.8.4.2 + diff --git a/SOURCES/0001-Cleanup-SRIOV-scanner-code.patch b/SOURCES/0001-Cleanup-SRIOV-scanner-code.patch new file mode 100644 index 0000000..0ca571e --- /dev/null +++ b/SOURCES/0001-Cleanup-SRIOV-scanner-code.patch @@ -0,0 +1,238 @@ +From 4834d5d108506c979f0e98e50afd570140503338 Mon Sep 17 00:00:00 2001 +From: Jordan Hargrave +Date: Fri, 28 Feb 2014 14:31:53 -0600 +Subject: [PATCH 1/2] Cleanup SRIOV scanner code + +--- + src/pci.c | 166 ++++++++++++++++++++------------------------------------------ + 1 file changed, 54 insertions(+), 112 deletions(-) + +diff --git a/src/pci.c b/src/pci.c +index dabb158..9b851df 100644 +--- a/src/pci.c ++++ b/src/pci.c +@@ -351,67 +351,15 @@ static int read_pci_sysfs_physfn(char *buf, size_t bufsize, const struct pci_dev + return 0; + } + +-static int virtfn_filter(const struct dirent *dent) +-{ +- return (!strncmp(dent->d_name,"virtfn",6)); +-} +- +-static int _read_virtfn_index(unsigned int *index, const char *path, const char *basename, const char *pci_name) +-{ +- char buf[PATH_MAX], *b; +- char fullpath[PATH_MAX]; +- ssize_t size; +- unsigned int u=INT_MAX; +- int scanned, rc=1; +- +- snprintf(fullpath, sizeof(fullpath), "%s/%s", path, basename); +- size = readlink(fullpath, buf, sizeof(buf)); +- if (size > 0) { +- /* form is ../0000:05:10.0 */ +- b=buf+3; /* skip ../ */ +- if (strlen(b) == strlen(pci_name) && +- !strncmp(b, pci_name, strlen(pci_name))) { +- scanned = sscanf(basename, "virtfn%u", &u); +- if (scanned == 1) { +- rc = 0; +- *index = u; +- } +- } +- } +- return rc; +-} +- +-static int read_virtfn_index(unsigned int *index, const struct pci_dev *pdev) +-{ +- char pci_name[16]; +- char path[PATH_MAX]; +- char cpath[PATH_MAX]; +- struct dirent **namelist; +- int n, rc=1; +- +- unparse_pci_name(pci_name, sizeof(pci_name), pdev); +- snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/physfn", pci_name); +- if (realpath(path, cpath) == NULL) +- return rc; +- +- n = scandir(cpath, &namelist, virtfn_filter, versionsort); +- if (n < 0) +- return rc; +- else { +- while (n--) { +- if (rc) +- rc = _read_virtfn_index(index, cpath, namelist[n]->d_name, pci_name); +- free(namelist[n]); +- } +- free(namelist); +- } +- +- return rc; +-} +- + static int parse_pci_name(const char *s, int *domain, int *bus, int *dev, int *func) + { + int err; ++ const char *r; ++ ++ /* Allow parsing pathnames */ ++ if ((r = strrchr(s, '/')) != NULL) ++ s = r+1; ++ + /* The domain part was added in 2.6 kernels. Test for that first. */ + err = sscanf(s, "%x:%2x:%2x.%x", domain, bus, dev, func); + if (err != 4) { +@@ -431,29 +379,6 @@ static struct pci_dev * find_pdev_by_pci_name(struct pci_access *pacc, const cha + return pci_get_dev(pacc, domain, bus, device, func); + } + +-static struct pci_device * +-find_physfn(struct libbiosdevname_state *state, struct pci_device *dev) +-{ +- int rc; +- char path[PATH_MAX]; +- char *c; +- struct pci_dev *pdev; +- memset(path, 0, sizeof(path)); +- rc = read_pci_sysfs_physfn(path, sizeof(path), dev->pci_dev); +- if (rc != 0) +- return NULL; +- /* we get back a string like +- ../0000:05:0.0 +- where the last component is the parent device +- */ +- /* find the last backslash */ +- c = rindex(path, '/'); +- c++; +- pdev = find_pdev_by_pci_name(state->pacc, c); +- dev = find_dev_by_pci(state, pdev); +- return dev; +-} +- + static int is_same_pci(const struct pci_dev *a, const struct pci_dev *b) + { + if (pci_domain_nr(a) == pci_domain_nr(b) && +@@ -464,25 +389,6 @@ static int is_same_pci(const struct pci_dev *a, const struct pci_dev *b) + return 0; + } + +-static void try_add_vf_to_pf(struct libbiosdevname_state *state, struct pci_device *vf) +-{ +- struct pci_device *pf; +- unsigned int index=0; +- int rc; +- pf = find_physfn(state, vf); +- +- if (!pf) +- return; +- list_add_tail(&vf->vfnode, &pf->vfs); +- rc = read_virtfn_index(&index, vf->pci_dev); +- if (!rc) { +- vf->vf_index = index; +- pf->is_sriov_physical_function = 1; +- } +- vf->pf = pf; +- vf->physical_slot = pf->physical_slot; +-} +- + static struct pci_device * + find_parent(struct libbiosdevname_state *state, struct pci_device *dev) + { +@@ -492,12 +398,6 @@ find_parent(struct libbiosdevname_state *state, struct pci_device *dev) + struct pci_device *physfn; + struct pci_dev *pdev; + memset(path, 0, sizeof(path)); +- /* if this device has a physfn pointer, then treat _that_ as the parent */ +- physfn = find_physfn(state, dev); +- if (physfn) { +- dev->is_sriov_virtual_function=1; +- return physfn; +- } + + rc = read_pci_sysfs_path(path, sizeof(path), dev->pci_dev); + if (rc != 0) +@@ -715,15 +615,57 @@ static int set_embedded_index(struct libbiosdevname_state *state) + return 0; + } + ++static int virtfn_filter(const struct dirent *dent) ++{ ++ return (!strncmp(dent->d_name,"virtfn",6)); ++} + +- +-static void set_sriov_pf_vf(struct libbiosdevname_state *state) ++/* Assign Virtual Function to Physical Function */ ++static void set_sriov(struct libbiosdevname_state *state, struct pci_device *pf, const char *virtpath) + { + struct pci_device *vf; +- list_for_each_entry(vf, &state->pci_devices, node) { +- if (!vf->is_sriov_virtual_function) ++ char pci_name[32]; ++ char path[PATH_MAX], cpath[PATH_MAX]; ++ int vf_index; ++ ++ if (sscanf(virtpath, "virtfn%u", &vf_index) != 1) ++ return; ++ unparse_pci_name(pci_name, sizeof(pci_name), pf->pci_dev); ++ snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/%s", pci_name, virtpath); ++ ++ memset(cpath, 0, sizeof(cpath)); ++ if (readlink(path, cpath, sizeof(cpath)) < 0) ++ return; ++ if ((vf = find_dev_by_pci_name(state, cpath)) != NULL) { ++ vf->is_sriov_virtual_function = 1; ++ vf->vf_index = vf_index; ++ vf->pf = pf; ++ pf->is_sriov_physical_function = 1; ++ list_add_tail(&vf->vfnode, &pf->vfs); ++ } ++} ++ ++static void scan_sriov(struct libbiosdevname_state *state) ++{ ++ struct pci_device *pf; ++ char path[PATH_MAX]; ++ char pci_name[32]; ++ struct dirent **namelist; ++ int n; ++ ++ list_for_each_entry(pf, &state->pci_devices, node) { ++ unparse_pci_name(pci_name, sizeof(pci_name), pf->pci_dev); ++ snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s", pci_name); ++ ++ namelist = NULL; ++ n = scandir(path, &namelist, virtfn_filter, versionsort); ++ if (n <= 0) + continue; +- try_add_vf_to_pf(state, vf); ++ while (n--) { ++ set_sriov(state, pf, namelist[n]->d_name); ++ free(namelist[n]); ++ } ++ free(namelist); + } + } + +@@ -799,6 +741,7 @@ int get_pci_devices(struct libbiosdevname_state *state) + /* ordering here is important */ + dmidecode_main(state); /* this will fail on Xen guests, that's OK */ + sort_device_list(state); ++ scan_sriov(state); + set_pci_vpd_instance(state); + rc = set_pci_slots(state); + if(rc) +@@ -806,7 +749,6 @@ int get_pci_devices(struct libbiosdevname_state *state) + + set_embedded_index(state); + set_pci_slot_index(state); +- set_sriov_pf_vf(state); + + out: + return rc; +-- +1.9.0 + diff --git a/SOURCES/0001-Place-udev-rules-to-usr-lib.patch b/SOURCES/0001-Place-udev-rules-to-usr-lib.patch index b25dc0e..8f7c721 100644 --- a/SOURCES/0001-Place-udev-rules-to-usr-lib.patch +++ b/SOURCES/0001-Place-udev-rules-to-usr-lib.patch @@ -9,18 +9,6 @@ Subject: [PATCH] Place udev rules to /usr/lib 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/biosdevname.rules.in b/biosdevname.rules.in -index 0a32aa5..eb2ed3c 100644 ---- a/biosdevname.rules.in -+++ b/biosdevname.rules.in -@@ -19,6 +19,6 @@ LABEL="netdevicename_start" - - # using NAME= instead of setting INTERFACE_NAME, so that persistent - # names aren't generated for these devices, they are "named" on each boot. --SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" -+SUBSYSTEMS=="pci", PROGRAM="/usr/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" - - LABEL="netdevicename_end" -diff --git a/configure.ac b/configure.ac index e26ba98..8c12cb8 100644 --- a/configure.ac +++ b/configure.ac diff --git a/SOURCES/0001-Scan-for-devid-for-Mellanox-cards.patch b/SOURCES/0001-Scan-for-devid-for-Mellanox-cards.patch new file mode 100644 index 0000000..84fd9f4 --- /dev/null +++ b/SOURCES/0001-Scan-for-devid-for-Mellanox-cards.patch @@ -0,0 +1,58 @@ +From cee3f7b101fb22540e2f92067a5c49d3f817e441 Mon Sep 17 00:00:00 2001 +From: Jordan Hargrave +Date: Tue, 25 Feb 2014 15:51:50 -0600 +Subject: [PATCH] Scan for devid for Mellanox cards + +--- + src/eths.c | 15 +++++++++++++++ + src/eths.h | 1 + + 2 files changed, 16 insertions(+) + +diff --git a/src/eths.c b/src/eths.c +index bcd02e1..38bb7fe 100644 +--- a/src/eths.c ++++ b/src/eths.c +@@ -34,6 +34,20 @@ char *pr_ether(char *buf, const int size, const unsigned char *s) + return (buf); + } + ++static int eths_get_devid(const char *devname, int *devid) ++{ ++ char path[PATH_MAX]; ++ char *devidstr = NULL; ++ ++ *devid = -1; ++ snprintf(path, sizeof(path), "/sys/class/net/%s/dev_id", devname); ++ if (sysfs_read_file(path, &devidstr) == 0) { ++ sscanf(devidstr, "%i", devid); ++ free(devidstr); ++ } ++ return NULL; ++} ++ + static int eths_get_ifindex(const char *devname, int *ifindex) + { + int fd, err; +@@ -149,6 +163,7 @@ static void fill_eth_dev(struct network_device *dev) + eths_get_ifindex(dev->kernel_name, &dev->ifindex); + eths_get_hwaddr(dev->kernel_name, dev->dev_addr, sizeof(dev->dev_addr), &dev->arphrd_type); + eths_get_permaddr(dev->kernel_name, dev->perm_addr, sizeof(dev->perm_addr)); ++ eths_get_devid(dev->kernel_name, &dev->devid); + rc = eths_get_info(dev->kernel_name, &dev->drvinfo); + if (rc == 0) + dev->drvinfo_valid = 1; +diff --git a/src/eths.h b/src/eths.h +index f686136..12c278b 100644 +--- a/src/eths.h ++++ b/src/eths.h +@@ -27,6 +27,7 @@ struct network_device { + int arphrd_type; /* e.g. ARPHDR_ETHER */ + int hardware_claimed; /* true when recognized as PCI or PCMCIA and added to list of bios_devices */ + int ifindex; ++ int devid; + }; + + extern void get_eths(struct libbiosdevname_state *state); +-- +1.8.4.2 + diff --git a/SOURCES/0001-Stop-reading-VPD-data-once-VPD-R-section-has-been-re.patch b/SOURCES/0001-Stop-reading-VPD-data-once-VPD-R-section-has-been-re.patch new file mode 100644 index 0000000..446471c --- /dev/null +++ b/SOURCES/0001-Stop-reading-VPD-data-once-VPD-R-section-has-been-re.patch @@ -0,0 +1,43 @@ +From cf9db86987ccbc1a0eefd77e7b2f8b1c761be1a9 Mon Sep 17 00:00:00 2001 +From: Jordan Hargrave +Date: Wed, 16 Oct 2013 15:12:06 -0500 +Subject: [PATCH] Stop reading VPD data once VPD-R section has been read + Mellanox cards were taking too long to read entire VPD + +--- + src/pci.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/pci.c b/src/pci.c +index 7aa32fc..a2b9faa 100644 +--- a/src/pci.c ++++ b/src/pci.c +@@ -30,6 +30,7 @@ extern int is_valid_smbios; + /* Borrowed from kernel vpd code */ + #define PCI_VPD_LRDT 0x80 + #define PCI_VPD_SRDT_END 0x78 ++#define PCI_VPDR_TAG 0x90 + + #define PCI_VPD_SRDT_LEN_MASK 0x7 + #define PCI_VPD_LRDT_TAG_SIZE 3 +@@ -71,7 +72,7 @@ static int pci_vpd_size(struct pci_device *pdev, int fd) + tag = buf[0] & ~PCI_VPD_SRDT_LEN_MASK; + off += PCI_VPD_SRDT_TAG_SIZE + pci_vpd_srdt_size(buf); + } +- if (tag == 0 || tag == 0xFF || tag == PCI_VPD_SRDT_END) ++ if (tag == 0 || tag == 0xFF || tag == PCI_VPD_SRDT_END || tag == PCI_VPDR_TAG) + break; + } + return off; +@@ -125,7 +126,7 @@ static int parse_vpd(struct libbiosdevname_state *state, struct pci_device *pdev + int i, j, k, isz, jsz, port, func, pfi; + struct pci_device *vf; + +- i = pci_vpd_find_tag(vpd, 0, len, 0x90); ++ i = pci_vpd_find_tag(vpd, 0, len, PCI_VPDR_TAG); + if (i < 0) + return 1; + isz = pci_vpd_lrdt_size(&vpd[i]); +-- +1.8.5.3 + diff --git a/SOURCES/biosdevname-0.5.0-rules.patch b/SOURCES/biosdevname-0.5.0-rules.patch index 61941c3..bf673b1 100644 --- a/SOURCES/biosdevname-0.5.0-rules.patch +++ b/SOURCES/biosdevname-0.5.0-rules.patch @@ -1,21 +1,35 @@ -diff -up biosdevname-0.5.0/biosdevname.rules.in.new biosdevname-0.5.0/biosdevname.rules.in ---- biosdevname-0.5.0/biosdevname.rules.in.new 2013-03-12 13:26:06.000000000 +0100 -+++ biosdevname-0.5.0/biosdevname.rules.in 2013-09-02 19:07:01.953956219 +0200 -@@ -1,7 +1,8 @@ +diff --git a/biosdevname.rules.in b/biosdevname.rules.in +index 6379164..2e73207 100644 +--- a/biosdevname.rules.in ++++ b/biosdevname.rules.in +@@ -1,7 +1,12 @@ SUBSYSTEM!="net", GOTO="netdevicename_end" -KERNEL!="eth*", GOTO="netdevicename_end" ACTION!="add", GOTO="netdevicename_end" NAME=="?*", GOTO="netdevicename_end" +ATTR{type}!="1", GOTO="netdevicename_end" +ENV{DEVTYPE}=="?*", GOTO="netdevicename_end" ++ ++ ++# whitelist all Dell systems ++ATTR{[dmi/id]sys_vendor}=="Dell*", ENV{UDEV_BIOSDEVNAME}="1" # kernel command line "biosdevname={0|1}" can turn off/on biosdevname IMPORT{cmdline}="biosdevname" -@@ -18,6 +19,6 @@ LABEL="netdevicename_start" +@@ -11,13 +16,13 @@ ENV{biosdevname}=="?*", ENV{UDEV_BIOSDEVNAME}="$env{biosdevname}" + ENV{UDEV_BIOSDEVNAME}=="0", GOTO="netdevicename_end" + ENV{UDEV_BIOSDEVNAME}=="1", GOTO="netdevicename_start" + +-# uncomment the next line for biosdevname to be off by default +-# GOTO="netdevicename_end" ++# off by default ++GOTO="netdevicename_end" + + LABEL="netdevicename_start" # using NAME= instead of setting INTERFACE_NAME, so that persistent # names aren't generated for these devices, they are "named" on each boot. -PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" -+SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" ++SUBSYSTEMS=="pci", PROGRAM="/usr/sbin/biosdevname --smbios 2.6 --nopirq --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" LABEL="netdevicename_end" diff --git a/SPECS/biosdevname.spec b/SPECS/biosdevname.spec index 1a3d96a..4e1e9b7 100644 --- a/SPECS/biosdevname.spec +++ b/SPECS/biosdevname.spec @@ -1,6 +1,6 @@ Name: biosdevname Version: 0.5.0 -Release: 5%{?dist} +Release: 10%{?dist} Summary: Udev helper for naming devices per BIOS names Group: System Environment/Base @@ -26,6 +26,11 @@ Patch1: biosdevname-0.5.0-rules.patch Patch2: 0001-CoverityScan-update.patch Patch3: 0001-Fix-regression-introduced-by-the-addslot-function.patch Patch4: 0001-Place-udev-rules-to-usr-lib.patch +Patch5: 0001-Stop-reading-VPD-data-once-VPD-R-section-has-been-re.patch +Patch6: 0001-Scan-for-devid-for-Mellanox-cards.patch +Patch7: 0001-Add-port-structure-to-PCI-device-handle-multiple-por.patch +Patch8: 0001-Cleanup-SRIOV-scanner-code.patch +Patch9: 0001-Add-port-code-for-Mellanox-driver.patch %description biosdevname in its simplest form takes a kernel device name as an @@ -41,6 +46,11 @@ name (e.g. eth0). %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 %build @@ -66,6 +76,21 @@ make install install-data DESTDIR=%{buildroot} %changelog +* Tue Mar 18 2014 Michal Sekletar - 0.5.0-10 +- rename Mellanox card correctly (#1067135) + +* Thu Mar 06 2014 Lukáš Nykrýn - 0.5.0-9 +- stop reading VPD data once VPD-R section has been read (#1054414) + +* Fri Feb 28 2014 Lukáš Nykrýn - 0.5.0-8 +- remove KERNEL!="eth*", GOTO="netdevicename_end" (#1069817) + +* Mon Feb 10 2014 Lukáš Nykrýn - 0.5.0-7 +- Change 71-biosdevname.rules to match rhel6 setup (#1054170) + +* Fri Dec 27 2013 Daniel Mach - 0.5.0-6 +- Mass rebuild 2013-12-27 + * Fri Sep 20 2013 Václav Pavlín - 0.5.0-5 - Fix regression introduced by the addslot function - CoverityScan fixes