[ofa-general] [PATCH] libibumad: umad_get_pkey() function

Hal Rosenstock hal.rosenstock at gmail.com
Mon Jan 14 18:06:49 PST 2008


On 1/13/08, Sasha Khapyorsky <sashak at voltaire.com> wrote:
>
> This returns value of pkey_index in network byte order from user_mad
> header. If we are running with kernel where pkey_index is not supported
> yet it will return 0.
>
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
>  libibumad/include/infiniband/umad.h |    1 +
>  libibumad/src/libibumad.map         |    1 +
>  libibumad/src/umad.c                |   13 ++++++++++++-
>  3 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/libibumad/include/infiniband/umad.h b/libibumad/include/infiniband/umad.h
> index 681b440..742c7b0 100644
> --- a/libibumad/include/infiniband/umad.h
> +++ b/libibumad/include/infiniband/umad.h
> @@ -174,6 +174,7 @@ int umad_set_grh(void *umad, void *mad_addr);
>  int    umad_set_addr_net(void *umad, int dlid, int dqp, int sl, int qkey);
>  int    umad_set_addr(void *umad, int dlid, int dqp, int sl, int qkey);
>  int    umad_set_pkey(void *umad, int pkey_index);
> +int    umad_get_pkey(void *umad);
>
>  int    umad_send(int portid, int agentid, void *umad, int length,
>                  int timeout_ms, int retries);
> diff --git a/libibumad/src/libibumad.map b/libibumad/src/libibumad.map
> index 9444aa9..0154b7f 100644
> --- a/libibumad/src/libibumad.map
> +++ b/libibumad/src/libibumad.map
> @@ -15,6 +15,7 @@ IBUMAD_1.0 {
>                umad_size;
>                umad_set_grh;
>                umad_set_pkey;
> +               umad_get_pkey;

Shouldn't running rev in libibumad.ver be updated to go along with
this added API ?

-- Hal

>                umad_set_addr;
>                umad_set_addr_net;
>                umad_send;
> diff --git a/libibumad/src/umad.c b/libibumad/src/umad.c
> index 1dc328d..b01e313 100644
> --- a/libibumad/src/umad.c
> +++ b/libibumad/src/umad.c
> @@ -722,7 +722,18 @@ umad_set_pkey(void *umad, int pkey_index)
>        struct ib_user_mad *mad = umad;
>
>        if (new_user_mad_api)
> -               mad->addr.pkey_index = htons(pkey_index);
> +               mad->addr.pkey_index = pkey_index;
> +
> +       return 0;
> +}
> +
> +int
> +umad_get_pkey(void *umad)
> +{
> +       struct ib_user_mad *mad = umad;
> +
> +       if (new_user_mad_api)
> +               return mad->addr.pkey_index;
>
>        return 0;
>  }
> --
> 1.5.4.rc2.60.gb2e62
>
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
>



More information about the general mailing list