Hi all,

As far as I can tell, the only way to create an ipoib interface w/ a
non-default pkey is to:

1) goto /sys/class/net/ibX/
2) echo $MY_NEW_PKEY > create_child
3) then bring up ibX.MY_NEW_PKEY interface
3a) assuming I don't want the original ib0, bring it down (although
leaving it up, I guess may not harm anything)

It seems somewhat cumbersome for an administrator to script this all up
if they only want 1 ipoib interface w/ a non-default pkey.  The attached
patch creates a module option called "default_pkey" to allow ipoib to
default to a different pkey.  If nothing is input, it still uses the
pkey at index 0.

Al

-- 
Albert Chu
[EMAIL PROTECTED]
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From bd54ffde3b9a53c883ef4db40f38570478342f7d Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Mon, 17 Nov 2008 17:09:21 -0800
Subject: [PATCH] support ipoib default_pkey module option


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index fddded7..e4e1789 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -69,6 +69,10 @@ module_param(lro_max_aggr, int, 0644);
 MODULE_PARM_DESC(lro_max_aggr, "LRO: Max packets to be aggregated "
 		"(default = 64)");
 
+static int ipoib_default_pkey __read_mostly = -1;
+module_param_named(default_pkey, ipoib_default_pkey, int, 0444);
+MODULE_PARM_DESC(default_pkey, "Specify default pkey");
+
 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
 int ipoib_debug_level;
 
@@ -1236,12 +1240,16 @@ static struct net_device *ipoib_add_port(const char *format,
 	priv->dev->mtu  = IPOIB_UD_MTU(priv->max_ib_mtu);
 	priv->mcast_mtu  = priv->admin_mtu = priv->dev->mtu;
 
-	result = ib_query_pkey(hca, port, 0, &priv->pkey);
-	if (result) {
-		printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n",
-		       hca->name, port, result);
-		goto device_init_failed;
+	if (ipoib_default_pkey < 0 || ipoib_default_pkey > 0xffff) {
+		result = ib_query_pkey(hca, port, 0, &priv->pkey);
+		if (result) {
+			printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n",
+			       hca->name, port, result);
+			goto device_init_failed;
+		}
 	}
+	else
+		priv->pkey = ipoib_default_pkey;
 
 	if (ipoib_set_dev_features(priv, hca))
 		goto device_init_failed;
-- 
1.5.4.5

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to