[openib-general] [PATCH] librdmacm: fix bug causing failure to work with partial membership pkey

Or Gerlitz ogerlitz at voltaire.com
Sun Feb 18 22:40:19 PST 2007


Hi Sean,

this fixes a bug which did not allow to run librdmacm apps over a node
which is partial member of a partition. The patch takes the approach of the
kernel ib_find_cached_pkey implementation.

If you approve this, i suggest pushing it also into OFED 1.2 as a bug fix.

Or.

----------------------------------------------------------------------
The pkey extracted by the RDMA CM from the IPoIB device hardware address always
has the full membership bit set. However, when looking in the pkey table the
search must mask out the full membership bit.

Signed-off-by: Or Gerlitz <ogerlitz at voltaire.com>
Signed-off-by: Olga Shern <olgas at voltaire.com>

diff --git a/src/cma.c b/src/cma.c
index c5f8cd9..9c24c6a 100644
--- a/src/cma.c
+++ b/src/cma.c
@@ -661,7 +661,7 @@ static int ucma_find_pkey(struct cma_dev

 	for (i = 0, ret = 0; !ret; i++) {
 		ret = ibv_query_pkey(cma_dev->verbs, port_num, i, &chk_pkey);
-		if (!ret && pkey == chk_pkey) {
+		if ((!ret && pkey  == chk_pkey) || (!ret && htons(ntohs(pkey) & 0x7fff)  == chk_pkey)) {
 			*pkey_index = (uint16_t) i;
 			return 0;
 		}




More information about the general mailing list