[ofa-general] [PATCH] saquery: --smkey command line option

Sasha Khapyorsky sashak at voltaire.com
Thu May 22 06:53:29 PDT 2008


This adds possibility to specify SM_Key value with saquery. It should
work with queries where OSM_DEFAULT_SM_KEY was used.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 infiniband-diags/src/saquery.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index ed61721..8edac5d 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -69,6 +69,7 @@ char *argv0 = "saquery";
 
 static char *node_name_map_file = NULL;
 static nn_map_t *node_name_map = NULL;
+static ib_net64_t smkey = OSM_DEFAULT_SM_KEY;
 
 /**
  * Declare some globals because I don't want this to be too complex.
@@ -730,7 +731,7 @@ get_all_records(osm_bind_handle_t bind_handle,
 		int trusted)
 {
 	return get_any_records(bind_handle, query_id, 0, 0, NULL, attr_offset,
-			       trusted ? OSM_DEFAULT_SM_KEY : 0);
+			       trusted ? smkey : 0);
 }
 
 /**
@@ -1254,8 +1255,7 @@ print_pkey_tbl_records(const struct query_cmd *q, osm_bind_handle_t bind_handle,
 
 	status = get_any_records(bind_handle, IB_MAD_ATTR_PKEY_TBL_RECORD, 0,
 				 comp_mask, &pktr,
-				 ib_get_attr_offset(sizeof(pktr)),
-				 OSM_DEFAULT_SM_KEY);
+				 ib_get_attr_offset(sizeof(pktr)), smkey);
 	if (status != IB_SUCCESS)
 		return status;
 
@@ -1411,6 +1411,7 @@ usage(void)
 				"IPv6 format\n");
 	fprintf(stderr, "   -C <ca_name> specify the SA query HCA\n");
 	fprintf(stderr, "   -P <ca_port> specify the SA query port\n");
+	fprintf(stderr, "   --smkey <val> specify SM_Key value for the query\n");
 	fprintf(stderr, "   -t | --timeout <msec> specify the SA query "
 				"response timeout (default %u msec)\n",
 			DEFAULT_SA_TIMEOUT_MS);
@@ -1466,6 +1467,7 @@ main(int argc, char **argv)
 	   {"sgid-to-dgid", 1, 0, 2},
 	   {"timeout", 1, 0, 't'},
 	   {"node-name-map", 1, 0, 3},
+	   {"smkey", 1, 0, 4},
 	   { }
 	};
 
@@ -1512,6 +1514,9 @@ main(int argc, char **argv)
 		case 3:
 			node_name_map_file = strdup(optarg);
 			break;
+		case 4:
+			smkey = cl_hton64(strtoull(optarg, NULL, 0));
+			break;
 		case 'p':
 			query_type = IB_MAD_ATTR_PATH_RECORD;
 			break;
-- 
1.5.5.1.178.g1f811




More information about the general mailing list