Skip to contentSkip to conversation

RDMA/core: Fix ENODEV error for iWARP test over vlan

PATCH Superseded Anumula Murali Mohan Reddy 2 participants 2 messages Oct 7, 2024 InfiniBand

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 RDMA/core: Fix ENODEV error for iWARP test over vlan

If traffic is over vlan, cma_validate_port() fails to match vlan net_device ifindex with bound_if_index and results in ENODEV error. It is because rdma_copy_src_l2_addr() always assigns bound_if_index with real net_device ifindex.
This patch fixes the issue by assigning bound_if_index with vlan net_device index if traffic is over vlan.

Fixes f8ef1be816bf ("RDMA/cma: Avoid GID lookups on iWARP devices")

---
Changes since v1:
Added fixes line
Addressed static checker warnings
Targeting to rc since this is a bug fix

---
 drivers/infiniband/core/addr.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/infiniband/core/addr.c +2 -0
index be0743dac3ff..8962fc0fe4c4 100644
@@ -269,6 +269,8 @@ rdma_find_ndev_for_src_ip_rcu(struct net *net, const struct sockaddr *src_in)
 		break;
 #endif
 	}
+	if (dev && is_vlan_dev(dev))
+		dev = vlan_dev_real_dev(dev);
 	return ret ? ERR_PTR(ret) : dev;
 }
 
Signature · 1 line
2.39.3
#1 lore raw
Quoted 24 lines · Anumula Murali Mohan Reddy

If traffic is over vlan, cma_validate_port() fails to match vlan net_device ifindex with bound_if_index and results in ENODEV error. It is because rdma_copy_src_l2_addr() always assigns bound_if_index with real net_device ifindex.
This patch fixes the issue by assigning bound_if_index with vlan net_device index if traffic is over vlan.

Fixes f8ef1be816bf ("RDMA/cma: Avoid GID lookups on iWARP devices")

---
Changes since v1:
Added fixes line
Addressed static checker warnings
Targeting to rc since this is a bug fix

---
 drivers/infiniband/core/addr.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/infiniband/core/addr.c +0 -0
index be0743dac3ff..8962fc0fe4c4 100644

drivers/infiniband/core/addr.c rdma_find_ndev_for_src_ip_rcu(struct net *net, const struct sockaddr *src_in) · line 272

Quoted 4 lines
drivers/infiniband/core/addr.c +1 -0
@@ -269,6 +269,8 @@ rdma_find_ndev_for_src_ip_rcu(struct net *net, const struct sockaddr *src_in)
 		break;
 #endif
 	}
+	if (dev && is_vlan_dev(dev))

You should take "ret" into consideration here, and probably the right way is to check is "if (!ret && dev && is_vlan_dev(dev))". The "&& dev &&" is not really needed, but it is a good thing to have it for static checkers.

Thanks

Quoted 8 lines
drivers/infiniband/core/addr.c +1 -0
+		dev = vlan_dev_real_dev(dev);
 	return ret ? ERR_PTR(ret) : dev;
 }
 
Signature · 1 line
2.39.3