Skip to content

Commit 60c41a4

Browse files
author
Mukesh Kacker
committed
RDS: Enable use of user named pkey devices
RDS code currently derives pkey associated with a device by parsing its name. With user-named pkey devices which do not have pkey as part of the name, that is not possible and ipoib module exports api to query the pkey from netdev. Here we switch to use that api instead. Orabug: 19064704 Ported from parts of UEK2 commit a101f60 Signed-off-by: Mukesh Kacker <[email protected]> Reviewed-by: Yuval Shaia <[email protected]> Reviewed-by: Chien-Hua Yen <[email protected]> Signed-off-by: Guangyu Sun <[email protected]>
1 parent 2864ecb commit 60c41a4

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

net/rds/ib.c

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <net/sock.h>
4343
#include <net/route.h>
4444
#include <net/inet_common.h>
45+
#include <net/ipoib/if_ipoib.h>
4546
#include <linux/rtnetlink.h>
4647

4748
#include "rds.h"
@@ -1725,21 +1726,6 @@ static void rds_ib_dump_ip_config(void)
17251726
}
17261727
}
17271728

1728-
/*
1729-
* Parse device name to extract pkey
1730-
*/
1731-
static uint16_t
1732-
get_netdev_pkey(struct net_device *dev)
1733-
{
1734-
uint16_t pkey = 0;
1735-
int ibdevnum = -1;
1736-
1737-
if (sscanf(dev->name, "ib%d.%04hx", &ibdevnum, &pkey) == 2)
1738-
return pkey;
1739-
else
1740-
return 0xffff; /* default pkey value! */
1741-
}
1742-
17431729

17441730
/*
17451731
* Scheduling initial failovers. The ASCII art below documents the startup
@@ -1889,7 +1875,12 @@ static int rds_ib_ip_config_init(void)
18891875
!(dev->flags & IFF_SLAVE) &&
18901876
!(dev->flags & IFF_MASTER) &&
18911877
in_dev) {
1892-
uint16_t pkey = get_netdev_pkey(dev);
1878+
u16 pkey = 0;
1879+
1880+
if (ipoib_get_netdev_pkey(dev, &pkey) != 0) {
1881+
printk(KERN_ERR "RDS/IB: failed to get pkey "
1882+
"for devname %s\n", dev->name);
1883+
}
18931884

18941885
memcpy(&gid, dev->dev_addr + 4, sizeof gid);
18951886

@@ -2266,7 +2257,12 @@ static void rds_ib_joining_ip(struct work_struct *_work)
22662257
work->timeout -= msecs_to_jiffies(100);
22672258
queue_delayed_work(rds_wq, &work->work, msecs_to_jiffies(100));
22682259
} else if (in_dev && in_dev->ifa_list) {
2269-
uint16_t pkey = get_netdev_pkey(ndev);
2260+
u16 pkey = 0;
2261+
2262+
if (ipoib_get_netdev_pkey(ndev, &pkey) != 0) {
2263+
printk(KERN_ERR "RDS/IB: failed to get pkey "
2264+
"for devname %s\n", ndev->name);
2265+
}
22702266

22712267
memcpy(&gid, ndev->dev_addr + 4, sizeof gid);
22722268
list_for_each_entry_rcu(rds_ibdev,

0 commit comments

Comments
 (0)