netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use dev_port for the ID of a network device.
@ 2014-06-30 20:36 Thadeu Lima de Souza Cascardo
  2014-07-01  0:33 ` Kay Sievers
  2014-07-01  6:45 ` Bjørn Mork
  0 siblings, 2 replies; 10+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2014-06-30 20:36 UTC (permalink / raw)
  To: systemd-devel; +Cc: netdev, Thadeu Lima de Souza Cascardo

For network devices on the same PCI function, dev_id should not be used,
since its purpose is for IPv6 support on interfaces with the same MAC
address.

The new dev_port sysfs attribute should be used when it is found. When
it is not, using dev_id might work.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
---
 src/udev/udev-builtin-net_id.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index c80c30a..6de9c98 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -186,9 +186,14 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
                 return -ENOENT;
 
         /* kernel provided multi-device index */
-        attr = udev_device_get_sysattr_value(dev, "dev_id");
-        if (attr)
+        attr = udev_device_get_sysattr_value(dev, "dev_port");
+        if (attr) {
                 dev_id = strtol(attr, NULL, 16);
+        } else {
+                attr = udev_device_get_sysattr_value(dev, "dev_id");
+                if (attr)
+                        dev_id = strtol(attr, NULL, 16);
+        }
 
         /* compose a name based on the raw kernel's PCI bus, slot numbers */
         s = names->pci_path;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-07-01 13:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-30 20:36 [PATCH] Use dev_port for the ID of a network device Thadeu Lima de Souza Cascardo
2014-07-01  0:33 ` Kay Sievers
2014-07-01 12:32   ` [systemd-devel] " Thadeu Lima de Souza Cascardo
2014-07-01 12:45     ` Tom Gundersen
2014-07-01 12:59       ` Kay Sievers
2014-07-01 13:18         ` Amir Vadai
2014-07-01  6:45 ` Bjørn Mork
2014-07-01  7:40   ` Bjørn Mork
2014-07-01 12:25     ` Thadeu Lima de Souza Cascardo
2014-07-01 12:26   ` Thadeu Lima de Souza Cascardo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).