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

Moni Levy monil at voltaire.com
Mon Feb 19 04:15:39 PST 2007


Or,
On 2/19/07, Or Gerlitz <ogerlitz at voltaire.com> wrote:
> 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)) {

What about just using:
    if (!ret && pkey | 0x8000  == chk_pkey | 0x8000) {

even if not there is no need to check the ret twice in case of limited
membership

-- Moni
>                         *pkey_index = (uint16_t) i;
>                         return 0;
>                 }
>
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
>
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
>
>




More information about the general mailing list