[ewg] [PATCH] perftest: Add command line SL support

orenmeron orenmeron at dev.mellanox.co.il
Sun Jun 28 06:11:10 PDT 2009


Signed-off-by: Oren Meron <orenmeron at dev.mellanox.co.il>
---
diff --git a/rdma_bw.c b/rdma_bw.c
index 0a6c6ac..2628ac4 100755
--- a/rdma_bw.c
+++ b/rdma_bw.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -59,6 +60,7 @@
 
 #define PINGPONG_RDMA_WRID	3
 
+static int sl = 0;
 static int page_size;
 static pid_t pid;
 
@@ -651,7 +653,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, struct pp_data data)
 	attr.min_rnr_timer 	= 12;
 	attr.ah_attr.is_global  = 0;
 	attr.ah_attr.dlid       = data.rem_dest->lid;
-	attr.ah_attr.sl         = 0;
+	attr.ah_attr.sl         = sl;
 	attr.ah_attr.src_path_bits = 0;
 	attr.ah_attr.port_num   = data.ib_port;
 	if (ibv_modify_qp(ctx->qp, &attr,
@@ -858,6 +860,7 @@ static void usage(const char *argv0)
 	printf("  -s, --size=<size>      size of message to exchange (default 65536)\n");
 	printf("  -t, --tx-depth=<dep>   size of tx queue (default 100)\n");
 	printf("  -n, --iters=<iters>    number of exchanges (at least 2, default 1000)\n");
+	printf("  -S, --sl=<sl>          SL (default 0)\n");
 	printf("  -b, --bidirectional    measure bidirectional bandwidth (default unidirectional)\n");
 	printf("  -c, --cma		 use RDMA CM\n");
 }
@@ -943,12 +946,13 @@ int main(int argc, char *argv[])
 			{ .name = "size",           .has_arg = 1, .val = 's' },
 			{ .name = "iters",          .has_arg = 1, .val = 'n' },
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "bidirectional",  .has_arg = 0, .val = 'b' },
 			{ .name = "cma", 	    .has_arg = 0, .val = 'c' },
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:d:i:s:n:t:bc", long_options, NULL);
+		c = getopt_long(argc, argv, "p:d:i:s:n:t:S:bc", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -995,6 +999,11 @@ int main(int argc, char *argv[])
 
 			break;
 
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 1; }
+			break;
+
 		case 'b':
 			duplex = 1;
 			break;
@@ -1021,9 +1030,9 @@ int main(int argc, char *argv[])
 	 */
 	pid = getpid();
 
-	printf("%d: | port=%d | ib_port=%d | size=%d | tx_depth=%d | iters=%d | duplex=%d | cma=%d |\n",
+	printf("%d: | port=%d | ib_port=%d | size=%d | tx_depth=%d | sl=%d | iters=%d | duplex=%d | cma=%d |\n",
 		 pid, data.port, data.ib_port, data.size, data.tx_depth,
-		 iters, duplex, data.use_cma);
+		 sl, iters, duplex, data.use_cma);
 		
 	/* Done with parameter parsing. Perform setup. */
 
diff --git a/rdma_lat.c b/rdma_lat.c
index 09a5f78..3681b35 100755
--- a/rdma_lat.c
+++ b/rdma_lat.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
  * Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler)
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -61,6 +62,7 @@
 #define MAX_INLINE 400
 
 static int inline_size = MAX_INLINE;
+static int sl = 0;
 static int page_size;
 static pid_t pid;
 
@@ -656,7 +658,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, struct pp_data *data)
 		.min_rnr_timer 	= 12,
 		.ah_attr.is_global  = 0,
 		.ah_attr.dlid       = data->rem_dest->lid,
-		.ah_attr.sl         = 0,
+		.ah_attr.sl         = sl,
 		.ah_attr.src_path_bits = 0,
 		.ah_attr.port_num   = data->ib_port
 	};
@@ -921,6 +923,7 @@ static void usage(const char *argv0)
 	printf("  -s, --size=<size>      size of message to exchange (default 1)\n");
 	printf("  -t, --tx-depth=<dep>   size of tx queue (default 50)\n");
 	printf("  -n, --iters=<iters>    number of exchanges (at least 2, default 1000)\n");
+	printf("  -S, --sl=<sl>          SL (default 0)\n");
 	printf("  -I, --inline_size=<size>  max size of message to be sent in inline mode (default 400)\n");
 	printf("  -C, --report-cycles    report times in cpu cycle units (default microseconds)\n");
 	printf("  -H, --report-histogram print out all results (default print summary only)\n");
@@ -1043,6 +1046,7 @@ int main(int argc, char *argv[])
 			{ .name = "size",           .has_arg = 1, .val = 's' },
 			{ .name = "iters",          .has_arg = 1, .val = 'n' },
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "inline_size",     .has_arg = 1, .val = 'I' },
 			{ .name = "report-cycles",  .has_arg = 0, .val = 'C' },
 			{ .name = "report-histogram",.has_arg = 0, .val = 'H' },
@@ -1051,7 +1055,7 @@ int main(int argc, char *argv[])
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:d:i:s:n:t:I:CHUc", long_options, NULL);
+		c = getopt_long(argc, argv, "p:d:i:s:n:t:S:I:CHUc", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -1094,6 +1098,11 @@ int main(int argc, char *argv[])
 				}
 				break;
 
+			case 'S':
+				sl = strtol(optarg, NULL, 0);
+				if (sl > 15) { usage(argv[0]); return 6; }
+				break;
+
 			case 'I':
 				inline_size = strtol(optarg, NULL, 0);
 				break;
@@ -1116,7 +1125,7 @@ int main(int argc, char *argv[])
 
 			default:
 				usage(argv[0]);
-				return 5;
+				return 7;
 		}
 	}
 
diff --git a/read_bw.c b/read_bw.c
index 8c3d553..6e0fa1d 100755
--- a/read_bw.c
+++ b/read_bw.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2006 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -71,6 +72,7 @@ struct user_parameters {
 	int use_event;
 	int qp_timeout;
 };
+static int sl = 0;
 static int page_size;
 cycles_t	*tposted;
 cycles_t	*tcompleted;
@@ -421,7 +423,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 	attr.min_rnr_timer          = 12;
 	attr.ah_attr.is_global  = 0;
 	attr.ah_attr.dlid       = dest->lid;
-	attr.ah_attr.sl         = 0;
+	attr.ah_attr.sl         = sl;
 	attr.ah_attr.src_path_bits = 0;
 	attr.ah_attr.port_num   = port;
 	if (ibv_modify_qp(ctx->qp, &attr,
@@ -471,6 +473,7 @@ static void usage(const char *argv0)
 	printf("  -t, --tx-depth=<dep>   size of tx queue (default 100)\n");
 	printf("  -n, --iters=<iters>    number of exchanges (at least 2, default 1000)\n");
 	printf("  -u, --qp-timeout=<timeout> QP timeout, timeout value is 4 usec * 2 ^(timeout), default 14\n");
+	printf("  -S, --sl=<sl>          SL (default 0)\n");
 	printf("  -b, --bidirectional    measure bidirectional bandwidth (default unidirectional)\n");
 	printf("  -V, --version          display version number\n");
 	printf("  -e, --events           sleep on CQ events (default poll)\n");
@@ -630,6 +633,7 @@ int main(int argc, char *argv[])
 			{ .name = "iters",          .has_arg = 1, .val = 'n' },
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
 			{ .name = "qp-timeout",     .has_arg = 1, .val = 'u' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "all",            .has_arg = 0, .val = 'a' },
 			{ .name = "bidirectional",  .has_arg = 0, .val = 'b' },
 			{ .name = "version",        .has_arg = 0, .val = 'V' },
@@ -638,7 +642,7 @@ int main(int argc, char *argv[])
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:d:i:m:o:s:n:t:u:abVeF", long_options, NULL);
+		c = getopt_long(argc, argv, "p:d:i:m:o:s:n:t:u:S:abVeF", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -712,6 +716,11 @@ int main(int argc, char *argv[])
 			user_param.qp_timeout = strtol(optarg, NULL, 0);
 			break;
 
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 1; }
+			break;
+
 		default:
 			usage(argv[0]);
 			return 1;
diff --git a/read_lat.c b/read_lat.c
index 49f28cf..4615179 100755
--- a/read_lat.c
+++ b/read_lat.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
  * Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler)
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -59,6 +60,7 @@
 #define PINGPONG_READ_WRID	1
 #define VERSION 1.1
 #define ALL 1
+static int sl = 0;
 static int page_size;
 cycles_t *tstamp;
 struct pingpong_dest my_dest;
@@ -444,7 +446,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 	attr.min_rnr_timer          = 12;
 	attr.ah_attr.is_global      = 0;
 	attr.ah_attr.dlid           = dest->lid;
-	attr.ah_attr.sl             = 0;
+	attr.ah_attr.sl             = sl;
 	attr.ah_attr.src_path_bits  = 0;
 	attr.ah_attr.port_num       = port;
 	if (ibv_modify_qp(ctx->qp, &attr,
@@ -563,6 +565,7 @@ static void usage(const char *argv0)
 	printf("  -n, --iters=<iters>          number of exchanges (at least 2, default 1000)\n");
 	printf("  -o, --outs=<num>             num of outstanding read/atom(default 4)\n");
 	printf("  -u, --qp-timeout=<timeout> QP timeout, timeout value is 4 usec * 2 ^(timeout), default 14\n");
+	printf("  -S, --sl=<sl>                SL (default 0)\n");
 	printf("  -a, --all                    Run sizes from 2 till 223\n");
 	printf("  -C, --report-cycles          report times in cpu cycle units (default microseconds)\n");
 	printf("  -H, --report-histogram       print out all results (default print summary only)\n");
@@ -767,6 +770,7 @@ int main(int argc, char *argv[])
 			{ .name = "outs",           .has_arg = 1, .val = 'o' },
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
 			{ .name = "qp-timeout",     .has_arg = 1, .val = 'u' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "all",            .has_arg = 0, .val = 'a' },
 			{ .name = "report-cycles",  .has_arg = 0, .val = 'C' },
 			{ .name = "report-histogram",.has_arg = 0, .val = 'H' },
@@ -777,7 +781,7 @@ int main(int argc, char *argv[])
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:c:m:d:i:s:o:n:t:u:aeHUVF", long_options, NULL);
+		c = getopt_long(argc, argv, "p:c:m:d:i:s:o:n:t:u:S:aeHUVF", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -866,9 +870,14 @@ int main(int argc, char *argv[])
 			user_param.qp_timeout = strtol(optarg, NULL, 0);
 			break;
 
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 5; }
+			break;
+
 		default:
 			usage(argv[0]);
-			return 5;
+			return 6;
 		}
 	}
 
diff --git a/send_bw.c b/send_bw.c
index a04703c..98b17f0 100755
--- a/send_bw.c
+++ b/send_bw.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -84,6 +85,7 @@ struct user_parameters {
 	int inline_size;
 	int qp_timeout;
 };
+static int sl = 0;
 static int page_size;
 cycles_t	*tposted;
 cycles_t	*tcompleted;
@@ -504,7 +506,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 	}
 	attr.ah_attr.is_global  = 0;
 	attr.ah_attr.dlid       = dest->lid;
-	attr.ah_attr.sl         = 0;
+	attr.ah_attr.sl         = sl;
 	attr.ah_attr.src_path_bits = 0;
 	attr.ah_attr.port_num   = port;
 	if ((user_parm->connection_type==UD) && (user_parm->use_mcg)) {
@@ -629,6 +631,7 @@ static void usage(const char *argv0)
 	printf("  -n, --iters=<iters>         number of exchanges (at least 2, default 1000)\n");
 	printf("  -I, --inline_size=<size>    max size of message to be sent in inline mode (default 400)\n");
 	printf("  -u, --qp-timeout=<timeout> QP timeout, timeout value is 4 usec * 2 ^(timeout), default 14\n");
+	printf("  -S, --sl=<sl>               SL (default 0)\n");
 	printf("  -b, --bidirectional         measure bidirectional bandwidth (default unidirectional)\n");
 	printf("  -V, --version               display version number\n");
 	printf("  -e, --events                sleep on CQ events (default poll)\n");
@@ -970,6 +973,7 @@ int main(int argc, char *argv[])
 			{ .name = "inline_size",    .has_arg = 1, .val = 'I' },
 			{ .name = "rx-depth",       .has_arg = 1, .val = 'r' },
 			{ .name = "qp-timeout",     .has_arg = 1, .val = 'u' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "all",            .has_arg = 0, .val = 'a' },
 			{ .name = "bidirectional",  .has_arg = 0, .val = 'b' },
 			{ .name = "version",        .has_arg = 0, .val = 'V' },
@@ -980,7 +984,7 @@ int main(int argc, char *argv[])
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:d:i:m:c:s:n:t:I:r:u:ebaVgNF", long_options, NULL);
+		c = getopt_long(argc, argv, "p:d:i:m:c:s:n:t:I:r:u:S:ebaVgNF", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -1078,6 +1082,11 @@ int main(int argc, char *argv[])
 			user_param.qp_timeout = strtol(optarg, NULL, 0);
 			break;
 
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 1; }
+			break;
+
 		default:
 			usage(argv[0]);
 			return 1;
diff --git a/send_lat.c b/send_lat.c
index d3b884a..8d2598d 100755
--- a/send_lat.c
+++ b/send_lat.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
  * Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler)
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -66,6 +67,7 @@
 #define MAX_INLINE 400
 #define MCG_LID 0xc001
 #define MCG_GID {255,1,0,0,0,2,201,133,0,0,0,0,0,0,0,0}
+static int sl = 0;
 static int page_size;
 cycles_t                *tstamp;
 struct user_parameters {
@@ -522,7 +524,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 
 	attr.ah_attr.is_global      = 0;
 	attr.ah_attr.dlid           = dest->lid;
-	attr.ah_attr.sl             = 0;
+	attr.ah_attr.sl             = sl;
 	attr.ah_attr.src_path_bits  = 0;
 	attr.ah_attr.port_num       = port;
 	if ((user_parm->connection_type==UD) && (user_parm->use_mcg)) {
@@ -711,6 +713,7 @@ static void usage(const char *argv0)
 	printf("  -n, --iters=<iters>          number of exchanges (at least 2, default 1000)\n");
 	printf("  -I, --inline_size=<size>     max size of message to be sent in inline mode (default 400)\n");
 	printf("  -u, --qp-timeout=<timeout> QP timeout, timeout value is 4 usec * 2 ^(timeout), default 14\n");
+	printf("  -S, --sl=<sl>                SL (default 0)\n");
 	printf("  -C, --report-cycles          report times in cpu cycle units (default microseconds)\n");
 	printf("  -H, --report-histogram       print out all results (default print summary only)\n");
 	printf("  -U, --report-unsorted        (implies -H) print out unsorted results (default sorted)\n");
@@ -1023,6 +1026,7 @@ int main(int argc, char *argv[])
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
 			{ .name = "inline_size",    .has_arg = 1, .val = 'I' },
 			{ .name = "qp-timeout",     .has_arg = 1, .val = 'u' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "signal",         .has_arg = 0, .val = 'l' },
 			{ .name = "all",            .has_arg = 0, .val = 'a' },
 			{ .name = "report-cycles",  .has_arg = 0, .val = 'C' },
@@ -1034,7 +1038,7 @@ int main(int argc, char *argv[])
 			{ .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
 			{ 0 }
 		};
-		c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:u:laeCHUVgF", long_options, NULL);
+		c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:u:S:laeCHUVgF", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -1135,9 +1139,14 @@ int main(int argc, char *argv[])
 			user_param.qp_timeout = strtol(optarg, NULL, 0);
 			break;
 
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 6; }
+			break;
+
 		default:
 			usage(argv[0]);
-			return 5;
+			return 7;
 		}
 	}
 
diff --git a/write_bw.c b/write_bw.c
index 683fb80..21f994b 100755
--- a/write_bw.c
+++ b/write_bw.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -79,6 +80,7 @@ struct extended_qp {
   struct ibv_qp           *qp;
   int                      scnt, ccnt ;
 };
+static int sl = 0;
 static int page_size;
 
 cycles_t	*tposted;
@@ -444,7 +446,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 	}
 	attr.ah_attr.is_global  = 0;
 	attr.ah_attr.dlid       = dest->lid;
-	attr.ah_attr.sl         = 0;
+	attr.ah_attr.sl         = sl;
 	attr.ah_attr.src_path_bits = 0;
 	attr.ah_attr.port_num   = port;
 	if (user_parm->connection_type == RC) {
@@ -521,6 +523,7 @@ static void usage(const char *argv0)
 	printf("  -n, --iters=<iters>       number of exchanges (at least 2, default 5000)\n");
 	printf("  -I, --inline_size=<size>  max size of message to be sent in inline mode (default 400)\n");
 	printf("  -u, --qp-timeout=<timeout> QP timeout, timeout value is 4 usec * 2 ^(timeout), default 14\n");
+	printf("  -S, --sl=<sl>             SL (default 0)\n");
 	printf("  -b, --bidirectional       measure bidirectional bandwidth (default unidirectional)\n");
 	printf("  -V, --version             display version number\n");
 	printf("  -N, --no peak-bw          cancel peak-bw calculation (default with peak-bw)\n");
@@ -712,6 +715,7 @@ int main(int argc, char *argv[])
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
 			{ .name = "inline_size",    .has_arg = 1, .val = 'I' },
 			{ .name = "qp-timeout",     .has_arg = 1, .val = 'u' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "all",            .has_arg = 0, .val = 'a' },
 			{ .name = "bidirectional",  .has_arg = 0, .val = 'b' },
 			{ .name = "version",        .has_arg = 0, .val = 'V' },
@@ -720,7 +724,7 @@ int main(int argc, char *argv[])
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:u:baVNF", long_options, NULL);
+		c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:u:S:baVNF", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -812,6 +816,11 @@ int main(int argc, char *argv[])
 			user_param.qp_timeout = strtol(optarg, NULL, 0);
 			break;
 
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 1; }
+			break;
+
 		default:
 			usage(argv[0]);
 			return 1;
diff --git a/write_bw_postlist.c b/write_bw_postlist.c
index d9e8dc2..d7b369a 100755
--- a/write_bw_postlist.c
+++ b/write_bw_postlist.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -79,6 +80,7 @@ struct extended_qp {
   struct ibv_qp           *qp;
   int                      scnt, ccnt ;
 };
+static int sl = 0;
 static int page_size;
 
 cycles_t	*tposted;
@@ -444,7 +446,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 	}
 	attr.ah_attr.is_global  = 0;
 	attr.ah_attr.dlid       = dest->lid;
-	attr.ah_attr.sl         = 0;
+	attr.ah_attr.sl         = sl;
 	attr.ah_attr.src_path_bits = 0;
 	attr.ah_attr.port_num   = port;
 	if (user_parm->connection_type == RC) {
@@ -521,6 +523,7 @@ static void usage(const char *argv0)
 	printf("  -n, --iters=<iters>       number of exchanges (at least 2, default 5000)\n");
 	printf("  -I, --inline_size=<size>  max size of message to be sent in inline mode (default 400)\n");
 	printf("  -u, --qp-timeout=<timeout> QP timeout, timeout value is 4 usec * 2 ^(timeout), default 14\n");
+	printf("  -S, --sl=<sl>             SL (default 0)\n");
 	printf("  -b, --bidirectional       measure bidirectional bandwidth (default unidirectional)\n");
 	printf("  -V, --version             display version number\n");
 	printf("  -F, --CPU-freq            do not fail even if cpufreq_ondemand module is loaded\n");
@@ -710,6 +713,7 @@ int main(int argc, char *argv[])
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
 			{ .name = "inline_size",    .has_arg = 1, .val = 'I' },
 			{ .name = "qp-timeout",     .has_arg = 1, .val = 'u' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "all",            .has_arg = 0, .val = 'a' },
 			{ .name = "bidirectional",  .has_arg = 0, .val = 'b' },
 			{ .name = "version",        .has_arg = 0, .val = 'V' },
@@ -717,7 +721,7 @@ int main(int argc, char *argv[])
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:u:baVF", long_options, NULL);
+		c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:u:S:baVF", long_options, NULL);
 		if (c == -1)
 			break;
 
@@ -806,6 +810,11 @@ int main(int argc, char *argv[])
 			user_param.qp_timeout = strtol(optarg, NULL, 0);
 			break;
 
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 1; }
+			break;
+
 		default:
 			usage(argv[0]);
 			return 1;
diff --git a/write_lat.c b/write_lat.c
index 819cf33..89aefbe 100755
--- a/write_lat.c
+++ b/write_lat.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
  * Copyright (c) 2005 Hewlett Packard, Inc (Grant Grundler)
+ * Copyright (c) 2009 HNR Consulting.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -60,6 +61,7 @@
 #define VERSION 1.0
 #define ALL 1
 #define MAX_INLINE 400
+static int sl = 0;
 static int page_size;
 cycles_t                *tstamp;
 struct user_parameters {
@@ -439,7 +441,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn,
 
 	attr.ah_attr.is_global      = 0;
 	attr.ah_attr.dlid           = dest->lid;
-	attr.ah_attr.sl             = 0;
+	attr.ah_attr.sl             = sl;
 	attr.ah_attr.src_path_bits  = 0;
 	attr.ah_attr.port_num       = port;
 
@@ -579,6 +581,7 @@ static void usage(const char *argv0)
 	printf("  -n, --iters=<iters>          number of exchanges (at least 2, default 1000)\n");
 	printf("  -I, --inline_size=<size>     max size of message to be sent in inline mode (default 400)\n");
 	printf("  -u, --qp-timeout=<timeout> QP timeout, timeout value is 4 usec * 2 ^(timeout), default 14\n");
+	printf("  -S, --sl=<sl>                SL (default 0)\n");
 	printf("  -C, --report-cycles          report times in cpu cycle units (default microseconds)\n");
 	printf("  -H, --report-histogram       print out all results (default print summary only)\n");
 	printf("  -U, --report-unsorted        (implies -H) print out unsorted results (default sorted)\n");
@@ -789,6 +792,7 @@ int main(int argc, char *argv[])
 			{ .name = "tx-depth",       .has_arg = 1, .val = 't' },
 			{ .name = "inline_size",    .has_arg = 1, .val = 'I' },
 			{ .name = "qp-timeout",     .has_arg = 1, .val = 'u' },
+			{ .name = "sl",             .has_arg = 1, .val = 'S' },
 			{ .name = "all",            .has_arg = 0, .val = 'a' },
 			{ .name = "report-cycles",  .has_arg = 0, .val = 'C' },
 			{ .name = "report-histogram",.has_arg = 0, .val = 'H' },
@@ -798,7 +802,7 @@ int main(int argc, char *argv[])
 			{ 0 }
 		};
 
-		c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:u:aCHUVF", long_options, NULL);///cpufreq
+		c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:u:S:aCHUVF", long_options, NULL);///cpufreq
 		if (c == -1)
 			break;
 
@@ -887,10 +891,14 @@ int main(int argc, char *argv[])
 		case 'u':
 			user_param.qp_timeout = strtol(optarg, NULL, 0);
 			break;
+		case 'S':
+			sl = strtol(optarg, NULL, 0);
+			if (sl > 15) { usage(argv[0]); return 6; }
+			break;
 
 		default:
 			usage(argv[0]);
-			return 5;
+			return 7;
 		}
 	}
 



More information about the ewg mailing list