[ofa-general] [PATCH 7/8] Convert ibsendtrap to "new" ibmad interface

Ira Weiny weiny2 at llnl.gov
Tue Feb 17 21:06:54 PST 2009


>From ac3d76c8ed77ab406a3297c1ba15598ae7cc15d2 Mon Sep 17 00:00:00 2001
From: weiny2 at llnl.gov <weiny2 at wopri.(none)>
Date: Tue, 17 Feb 2009 20:45:16 -0800
Subject: [PATCH] Convert ibsendtrap to "new" ibmad interface

   also make mad_send_via public to do the conversion

Signed-off-by: weiny2 at llnl.gov <weiny2 at wopri.(none)>
---
 infiniband-diags/src/ibsendtrap.c |   13 +++++++++----
 libibmad/src/libibmad.map         |    1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/infiniband-diags/src/ibsendtrap.c b/infiniband-diags/src/ibsendtrap.c
index ba6aa8b..d038dff 100644
--- a/infiniband-diags/src/ibsendtrap.c
+++ b/infiniband-diags/src/ibsendtrap.c
@@ -47,6 +47,8 @@
 
 #include "ibdiag_common.h"
 
+struct ibmad_port *srcport;
+
 static int send_144_node_desc_update(void)
 {
 	ib_portid_t sm_port;
@@ -55,10 +57,10 @@ static int send_144_node_desc_update(void)
 	ib_rpc_t trap_rpc;
 	ib_mad_notice_attr_t notice;
 
-	if (ib_resolve_self(&selfportid, &selfport, NULL))
+	if (ib_resolve_self_via(&selfportid, &selfport, NULL, srcport))
 		IBERROR("can't resolve self");
 
-	if (ib_resolve_smlid(&sm_port, 0))
+	if (ib_resolve_smlid_via(&sm_port, 0, srcport))
 		IBERROR("can't resolve SM destination port");
 
 	memset(&trap_rpc, 0, sizeof(trap_rpc));
@@ -80,7 +82,7 @@ static int send_144_node_desc_update(void)
 	notice.data_details.ntc_144.change_flgs =
 	    TRAP_144_MASK_NODE_DESCRIPTION_CHANGE;
 
-	return (mad_send(&trap_rpc, &sm_port, NULL, &notice));
+	return (mad_send_via(&trap_rpc, &sm_port, NULL, &notice, srcport));
 }
 
 typedef struct _trap_def {
@@ -137,7 +139,10 @@ int main(int argc, char **argv)
 	}
 
 	madrpc_show_errors(1);
-	madrpc_init(ibd_ca, ibd_ca_port, mgmt_classes, 2);
+
+	srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 2);
+	if (!srcport)
+		IBERROR("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
 
 	return (send_trap(trap_name));
 }
diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map
index ee1804a..4a44f02 100644
--- a/libibmad/src/libibmad.map
+++ b/libibmad/src/libibmad.map
@@ -90,6 +90,7 @@ IBMAD_1.3 {
 		mad_receive_via;
 		mad_respond_via;
 		mad_send;
+		mad_send_via;
 		smp_query;
 		smp_set;
 		ib_vendor_call;
-- 
1.5.4.5




More information about the general mailing list