Skip to contentSkip to conversation

osm_pkey.c: Fix find common pkey bug fix

PATCH New Hal Rosenstock 1 participant 1 message Oct 20, 2013 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 osm_pkey.c: Fix find common pkey bug fix

From: Daniel Klein <danielk-VPRAkNaXOzVWk0Htik3J/[email protected]>

When OpenSM supports keeping both full and limited membership pkeys for same port, search common pkey algorithm might miss a pkey shared by two ports.

OpenSM iterates over pkey table of both ports, trying to find a matching pkey, where the pkeys are sorted by network order value of the pkeys (including membership bit).

When OpenSM searches for the shared pkey, it advances the iterator with the lower key value. when comparing the keys without ignoring the membership bit, OpenSM might miss a shared pkey.

For example:
Port 1 pkeys : 0x0081 0x0082
Port 2 pkeys : 0x0002 0x0003

---
 opensm/osm_pkey.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
opensm/osm_pkey.c +4 -4
index 4f5aa73..7a24156 100644
@@ -430,8 +430,8 @@ ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1,
 			return *pkey1;
 
 		/* advance the lower value if they are not equal */
-		pkey1_base = cl_map_key(map_iter1);
-		pkey2_base = cl_map_key(map_iter2);
+		pkey1_base = ib_pkey_get_base(cl_map_key(map_iter1));
+		pkey2_base = ib_pkey_get_base(cl_map_key(map_iter2));
 		if (pkey2_base == pkey1_base) {
 			map_iter1 = cl_map_next(map_iter1);
 			map_iter2 = cl_map_next(map_iter2);
@@ -463,8 +463,8 @@ ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1,
 			return *pkey1;
 
 		/* advance the lower value if they are not equal */
-		pkey1_base = cl_map_key(map_iter1);
-		pkey2_base = cl_map_key(map_iter2);
+		pkey1_base = ib_pkey_get_base(cl_map_key(map_iter1));
+		pkey2_base = ib_pkey_get_base(cl_map_key(map_iter2));
 		if (pkey2_base == pkey1_base) {
 			map_iter1 = cl_map_next(map_iter1);
 			map_iter2 = cl_map_next(map_iter2);
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html