[ofa-general] ***SPAM*** [PATCH] Added send trap for trap 129 (local link integrity)
Eli Dorfman (Voltaire)
dorfman.eli at gmail.com
Mon Mar 16 02:20:38 PDT 2009
Added send trap for trap 129 (local link integrity).
Signed-off-by: Julia Volynsky <juliav at voltaire.com>
---
infiniband-diags/src/ibsendtrap.c | 45 +++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/infiniband-diags/src/ibsendtrap.c b/infiniband-diags/src/ibsendtrap.c
index f2b3e67..f867a6c 100644
--- a/infiniband-diags/src/ibsendtrap.c
+++ b/infiniband-diags/src/ibsendtrap.c
@@ -48,6 +48,8 @@
#include "ibdiag_common.h"
struct ibmad_port *srcport;
+/* for local link integrity */
+int error_port = 1;
static int send_144_node_desc_update(void)
{
@@ -85,13 +87,48 @@ static int send_144_node_desc_update(void)
return (mad_send_via(&trap_rpc, &sm_port, NULL, ¬ice, srcport));
}
+static int send_129_local_link_integrity(void)
+{
+ ib_portid_t sm_port;
+ ib_portid_t selfportid;
+ int selfport;
+ ib_rpc_t trap_rpc;
+ ib_mad_notice_attr_t notice;
+
+ if (ib_resolve_self_via(&selfportid, &selfport, NULL, srcport))
+ IBERROR("can't resolve self");
+
+ if (ib_resolve_smlid_via(&sm_port, 0, srcport))
+ IBERROR("can't resolve SM destination port");
+
+ memset(&trap_rpc, 0, sizeof(trap_rpc));
+ trap_rpc.mgtclass = IB_SMI_CLASS;
+ trap_rpc.method = IB_MAD_METHOD_TRAP;
+ trap_rpc.trid = mad_trid();
+ trap_rpc.attr.id = NOTICE;
+ trap_rpc.datasz = IB_SMP_DATA_SIZE;
+ trap_rpc.dataoffs = IB_SMP_DATA_OFFS;
+
+ memset(¬ice, 0, sizeof(notice));
+ notice.generic_type = 0x80 | IB_NOTICE_TYPE_INFO;
+ notice.g_or_v.generic.prod_type_lsb = cl_hton16(IB_NODE_TYPE_CA);
+ notice.g_or_v.generic.trap_num = cl_hton16(129);
+ notice.issuer_lid = cl_hton16((uint16_t) selfportid.lid);
+ notice.data_details.ntc_129_131.lid = cl_hton16((uint16_t) selfportid.lid);
+ notice.data_details.ntc_129_131.pad = 0;
+ notice.data_details.ntc_129_131.port_num = error_port;
+
+ return (mad_send_via(&trap_rpc, &sm_port, NULL, ¬ice, srcport));
+}
+
typedef struct _trap_def {
char *trap_name;
int (*send_func) (void);
} trap_def_t;
-trap_def_t traps[2] = {
+trap_def_t traps[3] = {
{"node_desc_change", send_144_node_desc_update},
+ {"local_link_integrity", send_129_local_link_integrity},
{NULL, NULL}
};
@@ -115,7 +152,7 @@ int main(int argc, char **argv)
char *trap_name = NULL;
int i, n, rc;
- n = sprintf(usage_args, "[<trap_name>]\n"
+ n = sprintf(usage_args, "[<trap_name>] [<error_port>]\n"
"\nArgument <trap_name> can be one of the following:\n");
for (i = 0; traps[i].trap_name; i++) {
n += snprintf(usage_args + n, sizeof(usage_args) - n,
@@ -138,6 +175,10 @@ int main(int argc, char **argv)
trap_name = argv[0];
}
+ if (argc > 1) {
+ error_port = atoi(argv[1]);
+ }
+
madrpc_show_errors(1);
srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 2);
--
1.5.5
More information about the general
mailing list