[openib-general] [PATCH 2/2] Diags/smpquery: Add support for DrSLID

Hal Rosenstock halr at voltaire.com
Mon Oct 16 05:50:45 PDT 2006


Diags/smpquery: Add support for DrSLID

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

---

Index: src/smpquery.c
===================================================================
--- src/smpquery.c	(revision 9776)
+++ src/smpquery.c	(working copy)
@@ -376,7 +376,8 @@ usage(void)
 	fprintf(stderr, "\n\texamples:\n");
 	fprintf(stderr, "\t\t%s portinfo 3 1\t\t\t\t# portinfo by lid, with port modifier\n", basename);
 	fprintf(stderr, "\t\t%s -G switchinfo 0x2C9000100D051 1\t# switchinfo by guid\n", basename);
-	fprintf(stderr, "\t\t%s -D nodeinfo 0\t\t\t# nodeinfo by direct route\n", basename);
+	fprintf(stderr, "\t\t%s -D nodeinfo 0\t\t\t\t# nodeinfo by direct route\n", basename);
+	fprintf(stderr, "\t\t%s -c nodeinfo 6 0,12\t\t\t# nodeinfo by combined route\n", basename);
 	exit(-1);
 }
 
@@ -393,7 +394,7 @@ main(int argc, char **argv)
 	char *err;
 	op_fn_t *fn;
 
-	static char const str_opts[] = "C:P:t:s:devDGVhu";
+	static char const str_opts[] = "C:P:t:s:devDcGVhu";
 	static const struct option long_opts[] = {
 		{ "C", 1, 0, 'C'},
 		{ "P", 1, 0, 'P'},
@@ -401,6 +402,7 @@ main(int argc, char **argv)
 		{ "err_show", 0, 0, 'e'},
 		{ "verbose", 0, 0, 'v'},
 		{ "Direct", 0, 0, 'D'},
+		{ "combined", 0, 0, 'c'},
 		{ "Guid", 0, 0, 'G'},
 		{ "smlid", 1, 0, 's'},
 		{ "timeout", 1, 0, 't'},
@@ -429,6 +431,9 @@ main(int argc, char **argv)
 		case 'D':
 			dest_type = IB_DEST_DRPATH;
 			break;
+		case 'c':
+			dest_type = IB_DEST_DRSLID;
+			break;
 		case 'G':
 			dest_type = IB_DEST_GUID;
 			break;
@@ -469,11 +474,20 @@ main(int argc, char **argv)
 
 	madrpc_init(ca, ca_port, mgmt_classes, 3);
 
-	if (ib_resolve_portid_str(&portid, argv[1], dest_type, sm_id) < 0)
-		IBERROR("can't resolve destination port %s", argv[1]);
-
-	if ((err = fn(&portid, argv+2, argc-2)))
-		IBERROR("operation %s: %s", argv[0], err);
-
+	if (dest_type != IB_DEST_DRSLID) {
+		if (ib_resolve_portid_str(&portid, argv[1], dest_type, sm_id) < 0)
+			IBERROR("can't resolve destination port %s", argv[1]);
+		if ((err = fn(&portid, argv+2, argc-2)))
+			IBERROR("operation %s: %s", argv[0], err);
+	} else {
+		char concat[64];
+
+		memset(concat, 0, 64);
+		snprintf(concat, sizeof(concat), "%s %s", argv[1], argv[2]);
+		if (ib_resolve_portid_str(&portid, concat, dest_type, sm_id) < 0)
+			IBERROR("can't resolve destination port %s", concat); 
+		if ((err = fn(&portid, argv+3, argc-3)))
+			IBERROR("operation %s: %s", argv[0], err);
+	}
 	exit(0);
 }
Index: man/smpquery.8
===================================================================
--- man/smpquery.8	(revision 9776)
+++ man/smpquery.8	(working copy)
@@ -1,4 +1,4 @@
-.TH SMPQUERY 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH SMPQUERY 8 "October 16, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 smpquery \- query InfiniBand subnet management attributes 
@@ -54,6 +54,11 @@ using the util_name -h syntax.
         "0"             # self port
         "0,1,2,1,4"     # out via port 1, then 2, ...
 .PP
+\-c      use combined route address arguments. The 
+        address is a combination of a LID and a direct route path.
+        The LID specified is the DLID and the local LID is used
+        as the DrSLID.
+.PP
 \-G      use GUID address argument. In most cases, it is the Port GUID.
         Example:
         "0x08f1040023"
@@ -88,6 +93,8 @@ smpquery portinfo 3 1        # portinfo 
 smpquery -G switchinfo 0x2C9000100D051 1        # switchinfo by guid
 .PP
 smpquery -D nodeinfo 0       # nodeinfo by direct route
+.PP
+smpquery -c nodeinfo 6 0,12  # nodeinfo by combined route
 
 .SH SEE ALSO
 .BR smpdump (8)







More information about the general mailing list