[openib-general] [PATCH] Osmtest - update command options + vapi fix

Liran Sorani liran at mellanox.co.il
Tue Nov 1 03:14:43 PST 2005


Hi , Hal .
We've decided to keep and maintain Osmtest in the main trunk , since it is
not only a test but a tool to validate SA/SM.
The following is a small patch for the follwoing :
1. Support old form of running osmtest , i.e  instead of -g=<port guid> ,
use -g <port guid> and add '-p' option to display current available port
guids.
2. Support Vapi stack.
3. Update Service flow (Update one of the service lease checks from 1 sec to
4 sec).
4. Ident switch-case) issues in main.c 

Thanks , Liran .


Signed-off-by:  Liran Sorani <liran at mellanox.co.il>

Index: osmt_mtl_regular_qp.c
===================================================================
--- osmt_mtl_regular_qp.c	(revision 3928)
+++ osmt_mtl_regular_qp.c	(working copy)
@@ -73,7 +73,7 @@
 #include <vapi_common.h>
 #include <ib_defs.h>
 #include <osmt_mtl_regular_qp.h>
-
+#include <complib/cl_types.h>
 /*
  * Initialize the QP etc.
  * Given in res: port_num, max_outs_sq, max_outs_rq
Index: osmt_service.c
===================================================================
--- osmt_service.c	(revision 3928)
+++ osmt_service.c	(working copy)
@@ -1266,7 +1266,7 @@
     p_osmt,
     cl_ntoh64(id[1]),  /*  IN ib_net64_t      service_id, */
     IB_DEFAULT_PKEY,/*  IN ib_net16_t      service_pkey, */
-    cl_hton32(0x00000001), /*  IN ib_net32_t     service_lease, */
+    cl_hton32(0x00000004), /*  IN ib_net32_t     service_lease, */
     11,             /*  IN uint8_t         service_key_lsb, */
     (char*)service_name[1]   /*  IN char            *service_name */
     );
Index: main.c
===================================================================
--- main.c	(revision 3928)
+++ main.c	(working copy)
@@ -128,9 +128,11 @@
 			"--guid <GUID in hex>\n"
 			"          This option specifies the local port GUID
value\n"
 			"          with which osmtest should bind.  osmtest
may be\n"
-			"          bound to 1 port at a time.\n"
-			"          Without -g, osmtest displays a menu of
possible\n"
-			"          port GUIDs and waits for user input.\n\n"
);
+			"          bound to 1 port at a time.\n\n");
+        printf( "-p \n"
+                        "--port\n"
+                        "          This option display menu of possible
local port GUID values\n"
+                        "          with which osmtest could bind.\n\n");
 	printf( "-h\n"
 			"--help\n" "          Display this usage info then
exit.\n\n" );
 	printf( "-i <filename>\n"
@@ -160,9 +162,9 @@
             "          ---    -----------------\n"
             "          -M1  - Short Multicast Flow (default) - single
mode.\n"
             "          -M2  - Short Multicast Flow  - multiple mode.\n"
-            "          -M3  - Long Multicast Flow - single mode.\n"
-            "          -M4  - Long Multicast Flow - mutiple mode.\n"
-            " Single mode - Osmtest is tested alone, with no other\n"
+            "          -M3  - Long MultiCast Flow - single mode.\n"
+            "          -M4  - Long MultiCast Flow - mutiple mode.\n"
+            " Single mode - Osmtest is tested alone , with no other  \n"
             "   apps that interact vs. OpenSM MC.\n"
             " Multiple mode - Could be run with other apps using MC vs.\n"
             "   OpenSM."
@@ -305,7 +307,7 @@
     char flow_name[64];
    boolean_t mem_track = FALSE;
 	uint32_t next_option;
-	const char *const short_option = "f:l:m:M:d:g::s:t:i:cvVh";
+	const char *const short_option = "f:l:m:M:d:g:s:t:i:pcvVh";
 
 	/*
 	 * In the array below, the 2nd parameter specified the number
@@ -322,9 +324,10 @@
 		{"inventory", 1, NULL, 'i'},
 		{"max_lid",   1, NULL, 'm'},
 		{"guid",      2, NULL, 'g'},
+		{"port",      0, NULL, 'p'},
 		{"help",      0, NULL, 'h'},
 		{"stress",    1, NULL, 's'},
-        {"Multicast_Mode",    1, NULL, 'M'},
+        {"MultiCast_Mode",    1, NULL, 'M'},
 		{"timeout",   1, NULL, 't'},
 		{"verbose",   0, NULL, 'v'},
 		{"log_file",  1, NULL, 'l'},
@@ -363,7 +366,6 @@
 	{
 		next_option = getopt_long_only( argc, argv, short_option,
 
long_option, NULL );
-
 		switch ( next_option )
 		{
 		case 'c':
@@ -446,28 +448,30 @@
 			break;
 
 		case 'g':
-		/*
-            Specifies port guid with which to bind.
-            */
-            if (optarg) {
-                guid = cl_hton64( strtoull( optarg, NULL, 16 ));
-                printf(" Guid <0x%"PRIx64">\n", cl_hton64( guid ));
-            } else
-                guid = INVALID_GUID;
-            break;
-
+			/*
+	                * Specifies port guid with which to bind.
+	                */
+       		        guid = cl_hton64( strtoull( optarg, NULL, 16
));
+                	printf(" Guid <0x%"PRIx64">\n", cl_hton64( guid ));
+	                break;
+		case 'p':
+			/*
+			* Display current port guids
+			*/
+                	guid = INVALID_GUID;
+	            	break;
 		case 't':
-			/*
+               		/*
 			 * Specifies transaction timeout.
-			 */
-		  opt.transaction_timeout = strtol( optarg, NULL, 0 );
-		  printf( "\tTransaction timeout = %d\n",
opt.transaction_timeout );
-		  break;
+			*/
+		  	opt.transaction_timeout = strtol( optarg, NULL, 0 );
+	  		printf( "\tTransaction timeout = %d\n",
opt.transaction_timeout );
+			break;
 
 		case 'l':
-		  opt.log_file = optarg;
-		  printf("\tLog File:%s\n", opt.log_file );
-		  break;
+			opt.log_file = optarg;
+			printf("\tLog File:%s\n", opt.log_file );
+			break;
 
 		case 'v':
 			/*
@@ -510,32 +514,32 @@
 			}
 			break;
 
-        case 'M':
-            /*
-             * Perform stress test.
-             */
-            opt.mmode = strtol( optarg, NULL, 0 );
-            printf( "\tMulticast test enabled: " );
-            switch ( opt.mmode )
-            {
-            case 1:
-                printf( "Short MC Flow - single mode (default)\n" );
-                break;
-            case 2:
-                printf( "Short MC Flow - mutiple mode\n" );
-                break;
-            case 3:
-                printf( "Long MC Flow - single mode\n" );
-                break;
-            case 4:
-                printf( "Long MC Flow - mutiple mode\n" );
-                break;
-            default:
-                printf( "Unknown value %u (ignored)\n", opt.stress );
-                opt.mmode = 0;
-                break;
-            }
-            break;
+	        case 'M':
+            		/*
+		         * Perform stress test.
+		        */
+            		opt.mmode = strtol( optarg, NULL, 0 );
+            		printf( "\tMultiCast test enabled: " );
+		        switch ( opt.mmode )
+		        {
+		        case 1:
+                		printf( "Short MC Flow - single mode
(default)\n" );
+		                break;
+		        case 2:
+                		printf( "Short MC Flow - mutiple mode\n" );
+		                break;
+		        case 3:
+                		printf( "Long MC Flow - single mode\n" );
+		                break;
+		        case 4:
+		                printf( "Long MC Flow - mutiple mode\n" );
+		                break;
+		        default:
+                		printf( "Unknown value %u (ignored)\n",
opt.stress );
+		                opt.mmode = 0;
+                		break;
+            		}
+		        break;
 
 		case 'd':
 			/*
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 3928)
+++ Makefile.am	(working copy)
@@ -13,9 +13,11 @@
 bin_PROGRAMS = osmtest 
 osmtest_SOURCES = main.c osmtest.c osmt_service.c osmt_slvl_vl_arb.c \
 		 osmt_multicast.c osmt_inform.c
-
+if OSMV_VAPI
+osmtest_SOURCES = osmt_mtl_regular_qp.c
+endif
 osmtest_CFLAGS = -Wall $(OSMV_CFLAGS) -DVENDOR_RMPP_SUPPORT $(DBGFLAGS)
-osmtest_LDADD = -L../complib -L../libvendor -L../opensm -L$(libdir) \
+osmtest_LDADD = -L../complib -L../libvendor -L../opensm -L$(libdir) -L. \
 	$(OSMV_LDADD) -lopensm -losmcomp -losmvendor
 
 osmtest_LDFLAGS = -Wl,--rpath -Wl,$(libdir) -lpthread  -L../opensm



> 	Liran Sorani
> 	Mellanox Technologies LTD.
> 	mailto:liran at mellanox.co.il
> 	Phone: +972(4)9097200 Ext: 214
> 	Israel, Yokneam P.O.B 586 ZIP 20692
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051101/4fa9744e/attachment.html>


More information about the general mailing list