diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2019-05-06 07:23:04 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-05-07 15:13:23 -0400 |
commit | b79656ed44c6865e17bcd93472ec39488bcc4984 (patch) | |
tree | 403a47c6404c47141bb42351fd62d2e8572a199f /drivers/infiniband/ulp | |
parent | ba7d8117f3cca8eb70d579fde3f9ec8cd6a28f39 (diff) |
RDMA/ipoib: Allow user space differentiate between valid dev_port
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: <stable@vger.kernel.org> # 4.19
Fixes: f6350da41dc7 ("IB/ipoib: Log sysfs 'dev_id' accesses from userspace")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 48eda16db1a7..9b5e11d3fb85 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -2402,7 +2402,18 @@ static ssize_t dev_id_show(struct device *dev, | |||
2402 | { | 2402 | { |
2403 | struct net_device *ndev = to_net_dev(dev); | 2403 | struct net_device *ndev = to_net_dev(dev); |
2404 | 2404 | ||
2405 | if (ndev->dev_id == ndev->dev_port) | 2405 | /* |
2406 | * ndev->dev_port will be equal to 0 in old kernel prior to commit | ||
2407 | * 9b8b2a323008 ("IB/ipoib: Use dev_port to expose network interface | ||
2408 | * port numbers") Zero was chosen as special case for user space | ||
2409 | * applications to fallback and query dev_id to check if it has | ||
2410 | * different value or not. | ||
2411 | * | ||
2412 | * Don't print warning in such scenario. | ||
2413 | * | ||
2414 | * https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L358 | ||
2415 | */ | ||
2416 | if (ndev->dev_port && ndev->dev_id == ndev->dev_port) | ||
2406 | netdev_info_once(ndev, | 2417 | netdev_info_once(ndev, |
2407 | "\"%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", | 2418 | "\"%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", |
2408 | current->comm); | 2419 | current->comm); |