From: Mukesh Kacker Date: Sat, 19 Jul 2014 06:59:21 +0000 (-0700) Subject: RDS: Enable use of user named pkey devices X-Git-Tag: v4.1.12-92~293^2^2~18 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=60c41a4aa7f71f0f74e1a4a21c7f18f0b7111e6a;p=users%2Fjedix%2Flinux-maple.git 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 a101f6037e882b1c12143416d48345fe7ea62979 Signed-off-by: Mukesh Kacker Reviewed-by: Yuval Shaia Reviewed-by: Chien-Hua Yen Signed-off-by: Guangyu Sun --- diff --git a/net/rds/ib.c b/net/rds/ib.c index e950745838c90..94a211414a150 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include "rds.h" @@ -1725,21 +1726,6 @@ static void rds_ib_dump_ip_config(void) } } -/* - * Parse device name to extract pkey - */ -static uint16_t -get_netdev_pkey(struct net_device *dev) -{ - uint16_t pkey = 0; - int ibdevnum = -1; - - if (sscanf(dev->name, "ib%d.%04hx", &ibdevnum, &pkey) == 2) - return pkey; - else - return 0xffff; /* default pkey value! */ -} - /* * Scheduling initial failovers. The ASCII art below documents the startup @@ -1889,7 +1875,12 @@ static int rds_ib_ip_config_init(void) !(dev->flags & IFF_SLAVE) && !(dev->flags & IFF_MASTER) && in_dev) { - uint16_t pkey = get_netdev_pkey(dev); + u16 pkey = 0; + + if (ipoib_get_netdev_pkey(dev, &pkey) != 0) { + printk(KERN_ERR "RDS/IB: failed to get pkey " + "for devname %s\n", dev->name); + } memcpy(&gid, dev->dev_addr + 4, sizeof gid); @@ -2266,7 +2257,12 @@ static void rds_ib_joining_ip(struct work_struct *_work) work->timeout -= msecs_to_jiffies(100); queue_delayed_work(rds_wq, &work->work, msecs_to_jiffies(100)); } else if (in_dev && in_dev->ifa_list) { - uint16_t pkey = get_netdev_pkey(ndev); + u16 pkey = 0; + + if (ipoib_get_netdev_pkey(ndev, &pkey) != 0) { + printk(KERN_ERR "RDS/IB: failed to get pkey " + "for devname %s\n", ndev->name); + } memcpy(&gid, ndev->dev_addr + 4, sizeof gid); list_for_each_entry_rcu(rds_ibdev,