]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS: Enable use of user named pkey devices
authorMukesh Kacker <mukesh.kacker@oracle.com>
Sat, 19 Jul 2014 06:59:21 +0000 (23:59 -0700)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Wed, 8 Jul 2015 21:00:11 +0000 (14:00 -0700)
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 <mukesh.kacker@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Chien-Hua Yen <chien.yen@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
net/rds/ib.c

index e950745838c90196616d4cb15541dbe56c7b182c..94a211414a150bf5842ba5727a2fe7dfe2955483 100644 (file)
@@ -42,6 +42,7 @@
 #include <net/sock.h>
 #include <net/route.h>
 #include <net/inet_common.h>
+#include <net/ipoib/if_ipoib.h>
 #include <linux/rtnetlink.h>
 
 #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,