[ofa-general] [PATCH 5/8] Convert ibportstate to "new" ibmad interface

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


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


Signed-off-by: weiny2 at llnl.gov <weiny2 at wopri.(none)>
---
 infiniband-diags/src/ibportstate.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/infiniband-diags/src/ibportstate.c b/infiniband-diags/src/ibportstate.c
index d1a112b..4edafd0 100644
--- a/infiniband-diags/src/ibportstate.c
+++ b/infiniband-diags/src/ibportstate.c
@@ -46,6 +46,8 @@
 
 #include "ibdiag_common.h"
 
+struct ibmad_port *srcport;
+
 /*******************************************/
 
 static int
@@ -53,7 +55,7 @@ get_node_info(ib_portid_t *dest, uint8_t *data)
 {
 	int node_type;
 
-	if (!smp_query(data, dest, IB_ATTR_NODE_INFO, 0, 0))
+	if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport))
 		return -1;
 
 	node_type = mad_get_field(data, 0, IB_NODE_TYPE_F);
@@ -69,7 +71,7 @@ get_port_info(ib_portid_t *dest, uint8_t *data, int portnum, int port_op)
 	char buf[2048];
 	char val[64];
 
-	if (!smp_query(data, dest, IB_ATTR_PORT_INFO, portnum, 0))
+	if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport))
 		return -1;
 
 	if (port_op != 4) {
@@ -223,9 +225,12 @@ int main(int argc, char **argv)
 	if (argc < 2)
 		ibdiag_show_usage();
 
-	madrpc_init(ibd_ca, ibd_ca_port, mgmt_classes, 3);
+	srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 3);
+	if (!srcport)
+		IBERROR("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
 
-	if (ib_resolve_portid_str(&portid, argv[0], ibd_dest_type, ibd_sm_id) < 0)
+	if (ib_resolve_portid_str_via(&portid, argv[0], ibd_dest_type,
+				ibd_sm_id, srcport) < 0)
 		IBERROR("can't resolve destination port %s", argv[0]);
 
 	/* First, make sure it is a switch port if it is a "set" */
@@ -314,7 +319,8 @@ int main(int argc, char **argv)
 					peerportid.drpath.p[1] = portnum;
 
 					/* Set DrSLID to local lid */
-					if (ib_resolve_self(&selfportid, &selfport, 0) < 0)
+					if (ib_resolve_self_via(&selfportid,
+							&selfport, 0, srcport) < 0)
 						IBERROR("could not resolve self");
 					peerportid.drpath.drslid = selfportid.lid;
 					peerportid.drpath.drdlid = 0xffff;
-- 
1.5.4.5




More information about the general mailing list