[ofa-general] [PATCH] librdmacm: fix typos in examples + start add port support

Dotan Barak dotanb at dev.mellanox.co.il
Tue Apr 1 05:45:10 PDT 2008


Fixed typo in test name + spelling typos.
Started to add support to control the port number from command line.

Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>

---

diff --git a/examples/cmatose.c b/examples/cmatose.c
index 2f6e5f6..ba6299e 100644
--- a/examples/cmatose.c
+++ b/examples/cmatose.c
@@ -80,6 +80,7 @@ static struct cmatest test;
 static int connections = 1;
 static int message_size = 100;
 static int message_count = 10;
+static uint16_t port = 7471;
 static uint8_t set_tos = 0;
 static uint8_t tos;
 static uint8_t migrate = 0;
@@ -536,7 +537,7 @@ static int run_server(void)
 	} else
 		test.src_in.sin_family = PF_INET;
 
-	test.src_in.sin_port = 7471;
+	test.src_in.sin_port = port;
 	ret = rdma_bind_addr(listen_id, test.src_addr);
 	if (ret) {
 		printf("cmatose: bind address failed: %d\n", ret);
@@ -613,7 +614,7 @@ static int run_client(void)
 	if (ret)
 		return ret;
 
-	test.dst_in.sin_port = 7471;
+	test.dst_in.sin_port = port;
 
 	printf("cmatose: connecting\n");
 	for (i = 0; i < connections; i++) {
@@ -666,7 +667,7 @@ int main(int argc, char **argv)
 {
 	int op, ret;
 
-	while ((op = getopt(argc, argv, "s:b:c:C:S:t:m")) != -1) {
+	while ((op = getopt(argc, argv, "s:b:c:C:S:t:p:m")) != -1) {
 		switch (op) {
 		case 's':
 			dst_addr = optarg;
@@ -687,6 +688,9 @@ int main(int argc, char **argv)
 			set_tos = 1;
 			tos = (uint8_t) atoi(optarg);
 			break;
+		case 'p':
+			port = atoi(optarg);
+			break;
 		case 'm':
 			migrate = 1;
 			break;
@@ -698,6 +702,7 @@ int main(int argc, char **argv)
 			printf("\t[-C message_count]\n");
 			printf("\t[-S message_size]\n");
 			printf("\t[-t type_of_service]\n");
+			printf("\t[-p port_number]\n");
 			printf("\t[-m(igrate)]\n");
 			exit(1);
 		}
diff --git a/examples/rping.c b/examples/rping.c
index 983ce1c..8bfa053 100644
--- a/examples/rping.c
+++ b/examples/rping.c
@@ -123,7 +123,7 @@ struct rping_cb {
 	struct rping_rdma_info recv_buf;/* malloc'd buffer */
 	struct ibv_mr *recv_mr;		/* MR associated with this buffer */
 
-	struct ibv_send_wr sq_wr;	/* send work requrest record */
+	struct ibv_send_wr sq_wr;	/* send work request record */
 	struct ibv_sge send_sgl;
 	struct rping_rdma_info send_buf;/* single send buf */
 	struct ibv_mr *send_mr;
@@ -600,7 +600,7 @@ static void *cq_thread(void *arg)
 			pthread_exit(NULL);
 		}
 		if (ev_cq != cb->cq) {
-			fprintf(stderr, "Unkown CQ!\n");
+			fprintf(stderr, "Unknown CQ!\n");
 			pthread_exit(NULL);
 		}
 		ret = ibv_req_notify_cq(cb->cq, 0);
diff --git a/examples/udaddy.c b/examples/udaddy.c
index 60d9e16..0d69b05 100644
--- a/examples/udaddy.c
+++ b/examples/udaddy.c
@@ -74,6 +74,7 @@ static struct cmatest test;
 static int connections = 1;
 static int message_size = 100;
 static int message_count = 10;
+static uint16_t port = 7174;
 static uint8_t set_tos = 0;
 static uint8_t tos;
 static char *dst_addr;
@@ -244,7 +245,7 @@ static int addr_handler(struct cmatest_node *node)
 		ret = rdma_set_option(node->cma_id, RDMA_OPTION_ID,
 				      RDMA_OPTION_ID_TOS, &tos, sizeof tos);
 		if (ret)
-			printf("cmatose: set TOS option failed: %d\n", ret);
+			printf("udaddy: set TOS option failed: %d\n", ret);
 	}
 
 	ret = rdma_resolve_route(node->cma_id, 2000);
@@ -542,7 +543,7 @@ static int run_server(void)
 	} else
 		test.src_in.sin_family = PF_INET;
 
-	test.src_in.sin_port = 7174;
+	test.src_in.sin_port = port;
 	ret = rdma_bind_addr(listen_id, test.src_addr);
 	if (ret) {
 		printf("udaddy: bind address failed: %d\n", ret);
@@ -595,7 +596,7 @@ static int run_client(void)
 	if (ret)
 		return ret;
 
-	test.dst_in.sin_port = 7174;
+	test.dst_in.sin_port = port;
 
 	printf("udaddy: connecting\n");
 	for (i = 0; i < connections; i++) {



More information about the general mailing list