[openib-general] [PATCH] Diags/saquery: Add ability to query InformInfoRecords

Hal Rosenstock halr at voltaire.com
Mon Jan 15 06:19:28 PST 2007


Diags/saquery: Add ability to query InformInfoRecords

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

diff --git a/diags/man/saquery.8 b/diags/man/saquery.8
index 0389bd1..9af3a9f 100644
--- a/diags/man/saquery.8
+++ b/diags/man/saquery.8
@@ -1,11 +1,11 @@
-.TH SAQUERY 8 "December 7, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH SAQUERY 8 "January 15, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 saquery \- query InfiniBand subnet administration attributes 
 
 .SH SYNOPSIS
 .B saquery 
-[\-h] [\-d] [\-P] [\-N] [\-D] [\-S] [\-L] [\-l] [\-G] [\-C] [\-s] [\-g] [\-m] [--src-to-dst <src:dst>] [<name>]
+[\-h] [\-d] [\-P] [\-N] [\-D] [\-S] [\-I] [\-L] [\-l] [\-G] [\-C] [\-s] [\-g] [\-m] [--src-to-dst <src:dst>] [<name>]
 
 .SH DESCRIPTION
 .PP
@@ -27,6 +27,9 @@ get NodeDescriptions of CAs only
 \fB\-S\fR
 get ServiceRecord info
 .TP
+\fB\-I\fR
+get InformInfoRecord (subscription) info
+.TP
 \fB\-L\fR
 return the Lids of the name specified
 .TP
diff --git a/diags/src/saquery.c b/diags/src/saquery.c
index 7495f7d..6ce52ad 100644
--- a/diags/src/saquery.c
+++ b/diags/src/saquery.c
@@ -414,24 +414,101 @@ print_service_record(ib_service_record_t
 	       p_sr->service_data8[10], p_sr->service_data8[11],
 	       p_sr->service_data8[12], p_sr->service_data8[13],
 	       p_sr->service_data8[14], p_sr->service_data8[15],
-	       cl_ntoh16(p_sr->service_data16[0]),
-	       cl_ntoh16(p_sr->service_data16[1]),
-	       cl_ntoh16(p_sr->service_data16[2]),
-	       cl_ntoh16(p_sr->service_data16[3]),
-	       cl_ntoh16(p_sr->service_data16[4]),
-	       cl_ntoh16(p_sr->service_data16[5]),
-	       cl_ntoh16(p_sr->service_data16[6]),
-	       cl_ntoh16(p_sr->service_data16[7]),
-	       cl_ntoh32(p_sr->service_data32[0]),
-	       cl_ntoh32(p_sr->service_data32[1]),
-	       cl_ntoh32(p_sr->service_data32[2]),
-	       cl_ntoh32(p_sr->service_data32[3]),
-	       cl_ntoh64(p_sr->service_data64[0]),
-	       cl_ntoh64(p_sr->service_data64[1])
+	       cl_ntoh16( p_sr->service_data16[0] ),
+	       cl_ntoh16( p_sr->service_data16[1] ),
+	       cl_ntoh16( p_sr->service_data16[2] ),
+	       cl_ntoh16( p_sr->service_data16[3] ),
+	       cl_ntoh16( p_sr->service_data16[4] ),
+	       cl_ntoh16( p_sr->service_data16[5] ),
+	       cl_ntoh16( p_sr->service_data16[6] ),
+	       cl_ntoh16( p_sr->service_data16[7] ),
+	       cl_ntoh32( p_sr->service_data32[0] ),
+	       cl_ntoh32( p_sr->service_data32[1] ),
+	       cl_ntoh32( p_sr->service_data32[2] ),
+	       cl_ntoh32( p_sr->service_data32[3] ),
+	       cl_ntoh64( p_sr->service_data64[0] ),
+	       cl_ntoh64( p_sr->service_data64[1] )
 	      );
 }
 
 static void
+print_inform_info_record(ib_inform_info_record_t *p_iir)
+{
+	uint32_t qpn;
+	uint8_t  resp_time_val;
+
+	ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.generic.qpn_resp_time_val, &qpn, &resp_time_val);
+
+	if (p_iir->inform_info.is_generic) {
+		printf("InformInfoRecord dump:\n"
+		       "\t\tRID\n"
+		       "\t\tSubscriberGID...........0x%016" PRIx64 " : "
+		       "0x%016" PRIx64 "\n"
+		       "\t\tSubscriberEnum..........0x%X\n"
+		       "\t\tInformInfo dump:\n"
+		       "\t\tgid.....................0x%016" PRIx64 " : 0x%016" PRIx64 "\n"
+		       "\t\tlid_range_begin.........0x%X\n"
+		       "\t\tlid_range_end...........0x%X\n"
+		       "\t\tis_generic..............0x%X\n"
+		       "\t\tsubscribe...............0x%X\n"
+		       "\t\ttrap_type...............0x%X\n"
+		       "\t\ttrap_num................%u\n"
+		       "\t\tqpn.....................0x%06X\n"
+		       "\t\tresp_time_val...........0x%X\n"
+		       "\t\tnode_type...............0x%06X\n"
+		       "",
+		       cl_ntoh64( p_iir->subscriber_gid.unicast.prefix ),
+		       cl_ntoh64( p_iir->subscriber_gid.unicast.interface_id ),
+		       cl_ntoh16( p_iir->subscriber_enum ),
+		       cl_ntoh64( p_iir->inform_info.gid.unicast.prefix ),
+		       cl_ntoh64( p_iir->inform_info.gid.unicast.interface_id ),
+		       cl_ntoh16( p_iir->inform_info.lid_range_begin ),
+		       cl_ntoh16( p_iir->inform_info.lid_range_end ),
+		       p_iir->inform_info.is_generic,
+		       p_iir->inform_info.subscribe,
+		       cl_ntoh16( p_iir->inform_info.trap_type ),
+		       cl_ntoh16( p_iir->inform_info.g_or_v.generic.trap_num ),
+		       cl_ntoh32( qpn ),
+		       resp_time_val,
+		       cl_ntoh32(ib_inform_info_get_node_type( &p_iir->inform_info ))
+		      );
+	} else {
+		printf("InformInfoRecord dump:\n"
+		       "\t\tRID\n"
+		       "\t\tSubscriberGID...........0x%016" PRIx64 " : "
+		       "0x%016" PRIx64 "\n"
+		       "\t\tSubscriberEnum..........0x%X\n"
+		       "\t\tInformInfo dump:\n"
+		       "\t\tgid.....................0x%016" PRIx64 " : 0x%016" PRIx64 "\n"
+		       "\t\tlid_range_begin.........0x%X\n"
+		       "\t\tlid_range_end...........0x%X\n"
+		       "\t\tis_generic..............0x%X\n"
+		       "\t\tsubscribe...............0x%X\n"
+		       "\t\ttrap_type...............0x%X\n"
+		       "\t\tdev_id..................0x%X\n"
+		       "\t\tqpn.....................0x%06X\n"
+		       "\t\tresp_time_val...........0x%X\n"
+		       "\t\tvendor_id...............0x%06X\n"
+		       "",
+		       cl_ntoh64( p_iir->subscriber_gid.unicast.prefix ),
+		       cl_ntoh64( p_iir->subscriber_gid.unicast.interface_id ),
+		       cl_ntoh16( p_iir->subscriber_enum ),
+		       cl_ntoh64( p_iir->inform_info.gid.unicast.prefix ),
+		       cl_ntoh64( p_iir->inform_info.gid.unicast.interface_id ),
+		       cl_ntoh16( p_iir->inform_info.lid_range_begin ),
+		       cl_ntoh16( p_iir->inform_info.lid_range_end ),
+		       p_iir->inform_info.is_generic,
+		       p_iir->inform_info.subscribe,
+		       cl_ntoh16( p_iir->inform_info.trap_type ),
+		       cl_ntoh16( p_iir->inform_info.g_or_v.vend.dev_id ),
+		       cl_ntoh32( qpn ),
+		       resp_time_val,
+		       cl_ntoh32(ib_inform_info_get_node_type( &p_iir->inform_info ))
+		      );
+	}
+}
+
+static void
 return_mad(void)
 {
 	/*
@@ -763,6 +840,26 @@ print_service_records(osm_bind_handle_t
 	return (status);
 }
 
+static ib_api_status_t
+print_inform_info_records(osm_bind_handle_t bind_handle)
+{
+	int                      i = 0;
+	ib_inform_info_record_t  *inform_info_record = NULL;
+	ib_net16_t               attr_offset = ib_get_attr_offset(sizeof(*inform_info_record));
+	ib_api_status_t          status;
+
+	status = get_all_records(bind_handle, IB_MAD_ATTR_INFORM_INFO_RECORD, attr_offset, 0);
+	if (status != IB_SUCCESS)
+		return (status); 
+
+	for (i = 0; i < result.result_cnt; i++) {
+		inform_info_record = osmv_get_query_inform_info_rec(result.p_result_madw, i);
+		print_inform_info_record(inform_info_record);
+	}
+	return_mad();
+	return (status);
+}
+
 static osm_bind_handle_t
 get_bind_handle(void)
 {
@@ -847,13 +944,14 @@ clean_up(void)
 static void
 usage(void)
 {
-	fprintf(stderr, "Usage: %s [-h -d -P -N -D -S -L -l -G -C -s -g -m --src-to-dst <src:dst>] [<name>]\n", argv0);
+	fprintf(stderr, "Usage: %s [-h -d -P -N -D -S -I -L -l -G -C -s -g -m --src-to-dst <src:dst>] [<name>]\n", argv0);
 	fprintf(stderr, "   Queries node records by default\n");
 	fprintf(stderr, "   -d enable debugging\n");
 	fprintf(stderr, "   -P get PathRecord info\n");
 	fprintf(stderr, "   -N get NodeRecord info\n");
 	fprintf(stderr, "   -D get NodeDescriptions of CAs only\n");
 	fprintf(stderr, "   -S get ServiceRecord info\n");
+	fprintf(stderr, "   -I get InformInfoRecord (subscription) info\n");
 	fprintf(stderr, "   -L return the Lids of the name specified\n");
 	fprintf(stderr, "   -l return the unique Lid of the name specified\n");
 	fprintf(stderr, "   -G return the Guids of the name specified\n");
@@ -877,7 +975,7 @@ main(int argc, char **argv)
 	ib_net16_t         dst_lid;
 	ib_api_status_t    status;
 
-	static char const str_opts[] = "PNDLlGCSsgmdh";
+	static char const str_opts[] = "PNDLlGCSIsgmdh";
 	static const struct option long_opts [] = {
 	   {"P", 0, 0, 'P'},
 	   {"N", 0, 0, 'N'},
@@ -891,6 +989,7 @@ main(int argc, char **argv)
 	   {"d", 0, 0, 'd'},
 	   {"C", 0, 0, 'C'},
 	   {"S", 0, 0, 'S'},
+	   {"I", 0, 0, 'I'},
 	   {"help", 0, 0, 'h'},
 	   {"src-to-dst", 1, 0, 1},
 	   { }
@@ -929,6 +1028,9 @@ main(int argc, char **argv)
 		case 'S':
 			query_type = IB_MAD_ATTR_SERVICE_RECORD;
 			break;
+		case 'I':
+			query_type = IB_MAD_ATTR_INFORM_INFO_RECORD;
+			break;
 		case 'N':
 			query_type = IB_MAD_ATTR_NODE_RECORD;
 			break;
@@ -997,6 +1099,9 @@ main(int argc, char **argv)
 	case IB_MAD_ATTR_SERVICE_RECORD:
 		status = print_service_records(bind_handle);
 		break;
+	case IB_MAD_ATTR_INFORM_INFO_RECORD:
+		status = print_inform_info_records(bind_handle);
+		break;
 	default:
 		fprintf(stderr, "Unknown query type %d\n", query_type);
 		status = IB_UNKNOWN_ERROR;







More information about the general mailing list