[ofa-general] [PATCH 6/10] infiniband-diags: Convert ibsendtrap to "new" ibmad interface
Ira Weiny
weiny2 at llnl.gov
Thu Feb 19 19:05:46 PST 2009
>From 9fcd0a9ec62fff981770e823281c660089b22d91 Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2 at llnl.gov>
Date: Thu, 19 Feb 2009 17:53:30 -0800
Subject: [PATCH] infiniband-diags: Convert ibsendtrap to "new" ibmad interface
also make mad_send_via public to do the conversion
Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
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, ¬ice));
+ return (mad_send_via(&trap_rpc, &sm_port, NULL, ¬ice, 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 bac74a9..0412027 100644
--- a/libibmad/src/libibmad.map
+++ b/libibmad/src/libibmad.map
@@ -91,6 +91,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