I noticed that the pkey is handled differently between ipoib's
create_child and delete_child functions.  So a user can create a
interface with a pkey, but not delete it with the same pkey.  Sort of
makes it confusing for the average person.

# sys/class/net/ib0 > echo 0x6fff > create_child
# /sys/class/net/ib0 > echo 0x6fff > delete_child
-bash: echo: write error: No such file or directory
# /sys/class/net/ib0 > echo 0xefff > delete_child
# /sys/class/net/ib0 >

The attached patch simply bitwise-ORs the full membership bit into the
delete_child function for consistency.  A check for a valid full-
membership bit on the create_child function would be fine as well, but
IMO this is the lesser confusing option (and is backwards compatible to
any scripts people have already written).

Al

-- 
Albert Chu
[EMAIL PROTECTED]
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From a7c8089b1866da124628ca3f55f2fe0a9e884d0c Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Thu, 13 Nov 2008 09:29:37 -0800
Subject: [PATCH] handle pkey in create_child and delete_child consistently


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

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index fddded7..2d68fd5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1161,6 +1161,12 @@ static ssize_t delete_child(struct device *dev,
 	if (pkey < 0 || pkey > 0xffff)
 		return -EINVAL;
 
+	/*
+	 * Set the full membership bit, for consistency
+	 * to create_child.
+	 */
+	pkey |= 0x8000;
+
 	ret = ipoib_vlan_delete(to_net_dev(dev), pkey);
 
 	return ret ? ret : count;
-- 
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