Skip to content

Commit 9b8b2a3

Browse files
bonktreedledford
authored andcommitted
IB/ipoib: Use dev_port to expose network interface port numbers
Some InfiniBand network devices have multiple ports on the same PCI function. This initializes the `dev_port' sysfs field of those network interfaces with their port number. Prior to this the kernel erroneously used the `dev_id' sysfs field of those network interfaces to convey the port number to userspace. The use of `dev_id' was considered correct until Linux 3.15, when another field, `dev_port', was defined for this particular purpose and `dev_id' was reserved for distinguishing stacked ifaces (e.g: VLANs) with the same hardware address as their parent device. Similar fixes to net/mlx4_en and many other drivers, which started exporting this information through `dev_id' before 3.15, were accepted into the kernel 4 years ago. See 76a066f (`net/mlx4_en: Expose port number through sysfs'). Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 4c0b653 commit 9b8b2a3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/infiniband/ulp/ipoib/ipoib_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,8 @@ static int ipoib_parent_init(struct net_device *ndev)
18811881
sizeof(union ib_gid));
18821882

18831883
SET_NETDEV_DEV(priv->dev, priv->ca->dev.parent);
1884+
priv->dev->dev_port = priv->port - 1;
1885+
/* Let's set this one too for backwards compatibility. */
18841886
priv->dev->dev_id = priv->port - 1;
18851887

18861888
return 0;

0 commit comments

Comments
 (0)