[openib-general] cmatose questions

Steve Wise swise at opengridcomputing.com
Tue Feb 28 19:25:31 PST 2006


On Tue, 2006-02-28 at 09:45 -0800, Sean Hefty wrote:
> Michael S. Tsirkin wrote:
> > I then unloaded the client and loaded it again:
> > modprobe rdma_cmatose dst_ip=11.4.8.155; rmmod rdma_cmatose
> 
> The kernel dst_ip isn't this smart.  You'll need to provide the IP address as:
> 
> x9b08040b
> 
> Note that there's a userspace version of cmatose in librdmacm that's easier to 
> interface to, and can handle normal IP addresses and host names as input.
> 

Here's a patch that allows you to specify the ip addresses in dotted
decimal format for the kernel version of cmatose.

Signed-off-by: Steve Wise <swise at opengridcomputing.com>



Index: cmatose.c
===================================================================
--- cmatose.c	(revision 5533)
+++ cmatose.c	(working copy)
@@ -40,6 +40,7 @@
 #include <linux/pci.h>
 #include <linux/time.h>
 #include <linux/workqueue.h>
+#include <linux/inet.h>
 
 #include <rdma/rdma_cm.h>
 
@@ -49,8 +50,8 @@
 
 /*
  * To execute:
- * Server: insmod rdma_cmatose.ko "src_ip=ip"
- * Client: insmod rdma_cmatose.ko ["src_ip=ip"] "dst_ip=ip"
+ * Server: insmod rdma_cmatose.ko "src_ip=x.x.x.x"
+ * Client: insmod rdma_cmatose.ko ["src_ip=x.x.x.x"] "dst_ip=y.y.y.y"
  */
 
 struct cmatest_node {
@@ -85,14 +86,14 @@
 };
 
 static struct cmatest test;
-static int src_ip = 0;
-static int dst_ip = 0;
+static char *src_ip = "000.000.000.000";
+static char *dst_ip = "x00.000.000.000";
 static int connections = 1;
 static int message_size = 100;
 static int message_count = 0;
 
-module_param(src_ip, int, 0444);
-module_param(dst_ip, int, 0444);
+module_param(src_ip, charp, 0444);
+module_param(dst_ip, charp, 0444);
 module_param(connections, int, 0444);
 module_param(message_size, int, 0444);
 module_param(message_count, int, 0444);
@@ -411,7 +412,7 @@
 
 	for (i = 0; i < connections; i++) {
 		test.nodes[i].id = i;
-		if (dst_ip) {
+		if (dst_ip[0] != 'x') {
 			test.nodes[i].cma_id = rdma_create_id(cma_handler,
 							      &test.nodes[i],
 							      RDMA_PS_TCP);
@@ -448,13 +449,13 @@
 	test.src_in.sin_family = AF_INET;
 	test.src_in.sin_port = 7471;
 	if (src_ip)
-		test.src_in.sin_addr.s_addr = src_ip;
+		test.src_in.sin_addr.s_addr = in_aton(src_ip);
 	test.src_addr = (struct sockaddr *) &test.src_in;
 
-	if (dst_ip) {
+	if (dst_ip[0] != 'x') {
 		test.dst_in.sin_family = AF_INET;
 		test.dst_in.sin_port = 7471;
-		test.dst_in.sin_addr.s_addr = dst_ip;
+		test.dst_in.sin_addr.s_addr = in_aton(dst_ip);
 	}
 	test.dst_addr = (struct sockaddr *) &test.dst_in;
 }
@@ -594,7 +595,7 @@
 	if (ret)
 		return;
 
-	if (dst_ip)
+	if (dst_ip[0] != 'x')
 		run_client();
 	else
 		run_server();





More information about the general mailing list