Skip to content

Commit

Permalink
RDMA/ipoib: Allow user space differentiate between valid dev_port
Browse files Browse the repository at this point in the history
Systemd triggers the following warning during IPoIB device load:

 mlx5_core 0000:00:0c.0 ib0: "systemd-udevd" wants to know my dev_id.
        Should it look at dev_port instead?
        See Documentation/ABI/testing/sysfs-class-net for more info.

This is caused due to user space attempt to differentiate old systems
without dev_port and new systems with dev_port. In case dev_port will be
zero, the systemd will try to read dev_id instead.

There is no need to print a warning in such case, because it is valid
situation and it is needed to ensure systemd compatibility with old
kernels.

Link: https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L358
Cc: <[email protected]> # 4.19
Fixes: f6350da ("IB/ipoib: Log sysfs 'dev_id' accesses from userspace")
Signed-off-by: Leon Romanovsky <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
Leon Romanovsky authored and jgunthorpe committed May 7, 2019
1 parent ba7d811 commit b79656e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/infiniband/ulp/ipoib/ipoib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2402,7 +2402,18 @@ static ssize_t dev_id_show(struct device *dev,
{
struct net_device *ndev = to_net_dev(dev);

if (ndev->dev_id == ndev->dev_port)
/*
* ndev->dev_port will be equal to 0 in old kernel prior to commit
* 9b8b2a323008 ("IB/ipoib: Use dev_port to expose network interface
* port numbers") Zero was chosen as special case for user space
* applications to fallback and query dev_id to check if it has
* different value or not.
*
* Don't print warning in such scenario.
*
* https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L358
*/
if (ndev->dev_port && ndev->dev_id == ndev->dev_port)
netdev_info_once(ndev,
"\"%s\" wants to know my dev_id. Should it look at dev_port instead? See Documentation/ABI/testing/sysfs-class-net for more info.\n",
current->comm);
Expand Down

0 comments on commit b79656e

Please sign in to comment.