[PATCH] librdmacm: Add command line option to specify server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a command line option to allow selecting specific address as done in
rdma_client.

Signed-off-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
---
 librdmacm/examples/rdma_server.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/librdmacm/examples/rdma_server.c b/librdmacm/examples/rdma_server.c
index bcf649fe..77c021ac 100644
--- a/librdmacm/examples/rdma_server.c
+++ b/librdmacm/examples/rdma_server.c
@@ -36,6 +36,7 @@
 #include <rdma/rdma_cma.h>
 #include <rdma/rdma_verbs.h>
 
+static const char *server = "127.0.0.1";
 static const char *port = "7471";
 
 static struct rdma_cm_id *listen_id, *id;
@@ -55,7 +56,7 @@ static int run(void)
 	memset(&hints, 0, sizeof hints);
 	hints.ai_flags = RAI_PASSIVE;
 	hints.ai_port_space = RDMA_PS_TCP;
-	ret = rdma_getaddrinfo(NULL, port, &hints, &res);
+	ret = rdma_getaddrinfo(server, port, &hints, &res);
 	if (ret) {
 		printf("rdma_getaddrinfo: %s\n", gai_strerror(ret));
 		return ret;
@@ -163,8 +164,11 @@ int main(int argc, char **argv)
 {
 	int op, ret;
 
-	while ((op = getopt(argc, argv, "p:")) != -1) {
+	while ((op = getopt(argc, argv, "s:p:")) != -1) {
 		switch (op) {
+		case 's':
+			server = optarg;
+			break;
 		case 'p':
 			port = optarg;
 			break;
-- 
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux