[ofa-general] [PATCH] libibumad: umad_get_pkey() function
Sasha Khapyorsky
sashak at voltaire.com
Sun Jan 13 11:35:59 PST 2008
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;
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
More information about the general
mailing list