Skip to contentSkip to conversation

RDMA/rxe: Disable ipv6 features when ipv6.disable set in cmdline

PATCH Superseded Zhu Yanjun 3 participants 5 messages Mar 25, 2021 – Apr 11, 2021

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Zhu Yanjun

author
#0 lore raw

PATCH v3 1/1 RDMA/rxe: Disable ipv6 features when ipv6.disable set in cmdline

From: Zhu Yanjun <[email protected]>

When ipv6.disable=1 is set in cmdline, ipv6 is actually disabled in the stack. As such, the operations of ipv6 in RXE will fail. So ipv6 features in RXE should also be disabled in RXE.

Fixes 8700e3e7c4857 ("Soft RoCE driver")

---
V2->V3: Remove print message
V1->V2: Modify the pr_info messages
---

---
 drivers/infiniband/sw/rxe/rxe_net.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/infiniband/sw/rxe/rxe_net.c +5 -0
index 01662727dca0..3b8ed007e8af 100644
@@ -72,6 +72,9 @@ static struct dst_entry *rxe_find_route6(struct net_device *ndev,
 	struct dst_entry *ndst;
 	struct flowi6 fl6 = { { 0 } };
 
+	if (!ipv6_mod_enabled())
+		return NULL;
+
 	memset(&fl6, 0, sizeof(fl6));
 	fl6.flowi6_oif = ndev->ifindex;
 	memcpy(&fl6.saddr, saddr, sizeof(*saddr));
@@ -616,6 +619,8 @@ static int rxe_net_ipv4_init(void)
 static int rxe_net_ipv6_init(void)
 {
 #if IS_ENABLED(CONFIG_IPV6)
+	if (!ipv6_mod_enabled())
+		return 0;
 
 	recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net,
 						htons(ROCE_V2_UDP_DPORT), true);
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 20 lines · Zhu Yanjun

From: Zhu Yanjun <[email protected]>

When ipv6.disable=1 is set in cmdline, ipv6 is actually disabled in the stack. As such, the operations of ipv6 in RXE will fail. So ipv6 features in RXE should also be disabled in RXE.

Fixes 8700e3e7c4857 ("Soft RoCE driver")

V2->V3: Remove print message
V1->V2: Modify the pr_info messages

 drivers/infiniband/sw/rxe/rxe_net.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/infiniband/sw/rxe/rxe_net.c +1 -0
index 01662727dca0..3b8ed007e8af 100644
+++ b/drivers/infiniband/sw/rxe/rxe_net.c

drivers/infiniband/sw/rxe/rxe_net.c static struct dst_entry *rxe_find_route6(struct net_device *ndev, · line 80

Quoted 9 lines
drivers/infiniband/sw/rxe/rxe_net.c +3 -0
@@ -72,6 +72,9 @@ static struct dst_entry *rxe_find_route6(struct net_device *ndev,
 	struct dst_entry *ndst;
 	struct flowi6 fl6 = { { 0 } };
 
+	if (!ipv6_mod_enabled())
+		return NULL;
+
 	memset(&fl6, 0, sizeof(fl6));
 	fl6.flowi6_oif = ndev->ifindex;
 	memcpy(&fl6.saddr, saddr, sizeof(*saddr));

What is this actually fixing?

ndst = ipv6_stub->ipv6_dst_lookup_flow() will return an error if the ipv6 support is not loaded so why do we need more tests?

drivers/infiniband/sw/rxe/rxe_net.c static int rxe_net_ipv4_init(void) · line 626

Quoted 9 lines
drivers/infiniband/sw/rxe/rxe_net.c +2 -0
@@ -616,6 +619,8 @@ static int rxe_net_ipv4_init(void)
 static int rxe_net_ipv6_init(void)
 {
 #if IS_ENABLED(CONFIG_IPV6)
+	if (!ipv6_mod_enabled())
+		return 0;
 
 	recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net,
 						htons(ROCE_V2_UDP_DPORT), true);

rxe_setup_udp_tunnel() should already fail naturally because the V6 socket won't be created

What is the actual symptom this patch is trying to address?

Jason

maintainer
#2 lore raw
Quoted 34 lines · Jason Gunthorpe
Quoted 20 lines · Zhu Yanjun

From: Zhu Yanjun <[email protected]>

When ipv6.disable=1 is set in cmdline, ipv6 is actually disabled in the stack. As such, the operations of ipv6 in RXE will fail. So ipv6 features in RXE should also be disabled in RXE.

Fixes 8700e3e7c4857 ("Soft RoCE driver")

V2->V3: Remove print message
V1->V2: Modify the pr_info messages

 drivers/infiniband/sw/rxe/rxe_net.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/infiniband/sw/rxe/rxe_net.c +1 -0
index 01662727dca0..3b8ed007e8af 100644
+++ b/drivers/infiniband/sw/rxe/rxe_net.c

drivers/infiniband/sw/rxe/rxe_net.c static struct dst_entry *rxe_find_route6(struct net_device *ndev, · line 80

Quoted 9 lines
drivers/infiniband/sw/rxe/rxe_net.c +3 -0
@@ -72,6 +72,9 @@ static struct dst_entry *rxe_find_route6(struct net_device *ndev,
      struct dst_entry *ndst;
      struct flowi6 fl6 = { { 0 } };
 
+     if (!ipv6_mod_enabled())
+             return NULL;
+
      memset(&fl6, 0, sizeof(fl6));
      fl6.flowi6_oif = ndev->ifindex;
      memcpy(&fl6.saddr, saddr, sizeof(*saddr));

What is this actually fixing?

Quoted 2 lines

ndst = ipv6_stub->ipv6_dst_lookup_flow() will return an error if the ipv6 support is not loaded so why do we need more tests?

As what I said in commit log, when "When ipv6.disable=1 is set in cmdline, ipv6 is actually disabled"
That is, when cat /proc/cmdline, the command line is
"
cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.12.0-rc3+ root=/dev/mapper/cl-root ro resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap crashkernel=512M ipv6.disable=1
"
And if you make the above configurations, then modprobe rdma_rxe should work. then ''rdma link add rxe0 type rxe netdev eth0" should work well. ndst = ipv6_stub->ipv6_dst_lookup_flow should not be called.
Can you tell me how to disable IPV6 in your test host?

Quoted 11 lines

in the stack. As such, the operations of ipv6 in RXE will fail. So ipv6 features in RXE should also be disabled in RXE."

Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_net.c +2 -0
@@ -616,6 +619,8 @@ static int rxe_net_ipv4_init(void)
 static int rxe_net_ipv6_init(void)
 {
 #if IS_ENABLED(CONFIG_IPV6)
+     if (!ipv6_mod_enabled())
+             return 0;
 
Quoted 7 lines

drivers/infiniband/sw/rxe/rxe_net.c static int rxe_net_ipv4_init(void) · line 626

Quoted 2 lines
drivers/infiniband/sw/rxe/rxe_net.c +0 -0
      recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net,
                                              htons(ROCE_V2_UDP_DPORT), true);

rxe_setup_udp_tunnel() should already fail naturally because the V6 socket won't be created

What is the actual symptom this patch is trying to address?

This patch is try to fix the problem in the link
https://lore.kernel.org/linux-rdma/[email protected]/T/#t

Zhu Yanjun

Quoted 2 lines

Jason

maintainer
#4 lore raw
Quoted 9 lines · Jason Gunthorpe
Quoted 4 lines · Zhu Yanjun
Quoted 1 line

What is the actual symptom this patch is trying to address?

This patch is try to fix the problem in the link
https://lore.kernel.org/linux-rdma/[email protected]/T/#t

you should ignore the -97 return code when creating the UDP v6 socket

Got it. I will send V4 for this IPv6 problem.

Zhu Yanjun

Quoted 2 lines

Jason