[PATCH 2/4] IB/rxe: create a new udp port for ipv4 and ipv6

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

 



A new port is created to listen to udp sockets for ipv4 and ipv6.
The new udp port is 4891. The original udp port is 4791.

CC: Srinivas Eeda <srinivas.eeda@xxxxxxxxxx>
CC: Junxiao Bi <junxiao.bi@xxxxxxxxxx>
Reviewed-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
Signed-off-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxxx>
---
 drivers/infiniband/sw/rxe/rxe_net.c | 22 +++++++++++++++++++++-
 drivers/infiniband/sw/rxe/rxe_net.h |  4 ++++
 include/rdma/ib_verbs.h             |  3 +++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 9da6e37..fb5c7ff 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -720,7 +720,15 @@ static int rxe_net_ipv4_init(void)
 		pr_err("Failed to create IPv4 UDP tunnel\n");
 		return -1;
 	}
-
+#ifdef CONFIG_RDMA_RXE_DUAL_PORT_MODULE
+	recv_sockets.dual_sk4 = rxe_setup_udp_tunnel(&init_net,
+				htons(ROCE_V2_UDP_DUAL_DPORT), false);
+	if (IS_ERR(recv_sockets.dual_sk4)) {
+		recv_sockets.dual_sk4 = NULL;
+		pr_err("Failed to create IPv4 secondary UDP tunnel\n");
+		return -1;
+	}
+#endif
 	return 0;
 }
 
@@ -735,6 +743,18 @@ static int rxe_net_ipv6_init(void)
 		pr_err("Failed to create IPv6 UDP tunnel\n");
 		return -1;
 	}
+#ifdef CONFIG_RDMA_RXE_DUAL_PORT_MODULE
+{
+	__be16 dport = htons(ROCE_V2_UDP_DUAL_DPORT);
+
+	recv_sockets.dual_sk6 = rxe_setup_udp_tunnel(&init_net, dport, true);
+	if (IS_ERR(recv_sockets.dual_sk6)) {
+		recv_sockets.dual_sk6 = NULL;
+		pr_err("Failed to create dual IPv6 UDP tunnel\n");
+		return -1;
+	}
+}
+#endif
 #endif
 	return 0;
 }
diff --git a/drivers/infiniband/sw/rxe/rxe_net.h b/drivers/infiniband/sw/rxe/rxe_net.h
index 728d8c7..ec33762 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.h
+++ b/drivers/infiniband/sw/rxe/rxe_net.h
@@ -41,6 +41,10 @@
 struct rxe_recv_sockets {
 	struct socket *sk4;
 	struct socket *sk6;
+#ifdef CONFIG_RDMA_RXE_DUAL_PORT_MODULE
+	struct socket *dual_sk4;
+	struct socket *dual_sk6;
+#endif
 };
 
 extern struct notifier_block rxe_net_notifier;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 9fc8a82..9a4332b 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -91,6 +91,9 @@ enum ib_gid_type {
 };
 
 #define ROCE_V2_UDP_DPORT      4791
+#ifdef CONFIG_RDMA_RXE_DUAL_PORT_MODULE
+#define ROCE_V2_UDP_DUAL_DPORT	4891
+#endif
 struct ib_gid_attr {
 	struct net_device	*ndev;
 	struct ib_device	*device;
-- 
2.7.4

--
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