[ofa-general] [PATCH] management: changed method_mask type in user_mad interface

Sasha Khapyorsky sashak at voltaire.com
Wed Oct 31 23:20:06 PDT 2007


This follows Roland's method mask bit ordering fix:

commit a394f83bdfec10b09d8cb111e622556b2e6fd0de
Author: Roland Dreier <rolandd at cisco.com>
Date:   Tue Oct 9 19:59:15 2007 -0700

    IB/umad: Fix bit ordering and 32-on-64 problems on big endian systems

The method_mask is array of longs now in all libibumad interfaces.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 libibmad/include/infiniband/mad.h    |    3 ++-
 libibmad/src/register.c              |    9 +++++----
 libibumad/include/infiniband/umad.h  |    4 ++--
 libibumad/src/umad.c                 |    8 ++++----
 opensm/libvendor/osm_vendor_ibumad.c |    3 +--
 5 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index ae847c9..15b8246 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -689,7 +689,8 @@ int	mad_build_pkt(void *umad, ib_rpc_t *rpc, ib_portid_t *dport, ib_rmpp_hdr_t *
 int	mad_register_port_client(int port_id, int mgmt, uint8_t rmpp_version);
 int	mad_register_client(int mgmt, uint8_t rmpp_version);
 int	mad_register_server(int mgmt, uint8_t rmpp_version,
-			    uint32_t method_mask[4], uint32_t class_oui);
+			    long method_mask[16/sizeof(long)],
+			    uint32_t class_oui);
 int	mad_class_agent(int mgmt);
 int	mad_agent_class(int agent);
 
diff --git a/libibmad/src/register.c b/libibmad/src/register.c
index d80fa14..1698f05 100644
--- a/libibmad/src/register.c
+++ b/libibmad/src/register.c
@@ -155,15 +155,16 @@ mad_register_client(int mgmt, uint8_t rmpp_version)
 
 int
 mad_register_server(int mgmt, uint8_t rmpp_version,
-		    uint32_t method_mask[4], uint32_t class_oui)
+		    long method_mask[], uint32_t class_oui)
 {
-	uint32_t class_method_mask[4] = {0xffffffff, 0xffffffff,
-					 0xffffffff, 0xffffffff};
+	long class_method_mask[16/sizeof(long)];
 	uint8_t oui[3];
 	int agent, vers, mad_portid;
 
-	if ((void *)method_mask != 0)
+	if (method_mask)
 		memcpy(class_method_mask, method_mask, sizeof class_method_mask);
+	else
+		memset(class_method_mask, 0xff, sizeof(class_method_mask));
 
 	if ((mad_portid = madrpc_portid()) < 0)
 		return -1;
diff --git a/libibumad/include/infiniband/umad.h b/libibumad/include/infiniband/umad.h
index 1b70eb4..21cf729 100644
--- a/libibumad/include/infiniband/umad.h
+++ b/libibumad/include/infiniband/umad.h
@@ -180,9 +180,9 @@ int	umad_poll(int portid, int timeout_ms);
 int	umad_get_fd(int portid);
 
 int	umad_register(int portid, int mgmt_class, int mgmt_version,
-		      uint8_t rmpp_version, uint32_t method_mask[4]);
+		      uint8_t rmpp_version, long method_mask[16/sizeof(long)]);
 int	umad_register_oui(int portid, int mgmt_class, uint8_t rmpp_version,
-			  uint8_t oui[3], uint32_t method_mask[4]);
+			  uint8_t oui[3], long method_mask[16/sizeof(long)]);
 int	umad_unregister(int portid, int agentid);
 
 int	umad_debug(int level);
diff --git a/libibumad/src/umad.c b/libibumad/src/umad.c
index 25cea3b..9d9f9c3 100644
--- a/libibumad/src/umad.c
+++ b/libibumad/src/umad.c
@@ -832,7 +832,7 @@ umad_get_fd(int fd)
 
 int
 umad_register_oui(int fd, int mgmt_class, uint8_t rmpp_version,
-		  uint8_t oui[3], uint32_t method_mask[4])
+		  uint8_t oui[3], long method_mask[])
 {
 	struct ib_user_mad_reg_req req;
 
@@ -851,7 +851,7 @@ umad_register_oui(int fd, int mgmt_class, uint8_t rmpp_version,
 	memcpy(req.oui, oui, sizeof req.oui);
 	req.rmpp_version = rmpp_version;
 
-	if ((void *)method_mask != 0)
+	if (method_mask)
 		memcpy(req.method_mask, method_mask, sizeof req.method_mask);
 	else
 		memset(req.method_mask, 0, sizeof req.method_mask);
@@ -871,7 +871,7 @@ umad_register_oui(int fd, int mgmt_class, uint8_t rmpp_version,
 
 int
 umad_register(int fd, int mgmt_class, int mgmt_version,
-	      uint8_t rmpp_version, uint32_t method_mask[4])
+	      uint8_t rmpp_version, long method_mask[])
 {
 	struct ib_user_mad_reg_req req;
 	uint32_t oui = htonl(IB_OPENIB_OUI);
@@ -885,7 +885,7 @@ umad_register(int fd, int mgmt_class, int mgmt_version,
 	req.mgmt_class_version = mgmt_version;
 	req.rmpp_version = rmpp_version;
 
-	if ((void *)method_mask != 0)
+	if (method_mask)
 		memcpy(req.method_mask, method_mask, sizeof req.method_mask);
 	else
 		memset(req.method_mask, 0, sizeof req.method_mask);
diff --git a/opensm/libvendor/osm_vendor_ibumad.c b/opensm/libvendor/osm_vendor_ibumad.c
index 3830024..6d78573 100644
--- a/opensm/libvendor/osm_vendor_ibumad.c
+++ b/opensm/libvendor/osm_vendor_ibumad.c
@@ -82,7 +82,6 @@ typedef struct _osm_umad_bind_info {
 	osm_mad_pool_t *p_mad_pool;
 	osm_vend_mad_recv_callback_t mad_recv_callback;
 	osm_vend_mad_send_err_callback_t send_err_callback;
-
 	ib_net64_t port_guid;
 	int port_id;
 	int agent_id;
@@ -805,7 +804,7 @@ osm_vendor_bind(IN osm_vendor_t * const p_vend,
 {
 	ib_net64_t port_guid;
 	osm_umad_bind_info_t *p_bind = 0;
-	uint32_t method_mask[4];
+	long method_mask[16/sizeof(long)];
 	int umad_port_id;
 	uint8_t rmpp_version;
 
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list