Skip to content

Commit a4048c8

Browse files
Anumula-Murali-Mohan-Reddyrleon
authored andcommitted
RDMA/core: Fix ENODEV error for iWARP test over vlan
If traffic is over vlan, cma_validate_port() fails to match net_device ifindex with bound_if_index and results in ENODEV error. As iWARP gid table is static, it contains entry corresponding to only one net device which is either real netdev or vlan netdev for cases like siw attached to a vlan interface. This patch fixes the issue by assigning bound_if_index with net device index, if real net device obtained from bound if index matches with net device retrieved from gid table Fixes: f8ef1be ("RDMA/cma: Avoid GID lookups on iWARP devices") Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Anumula Murali Mohan Reddy <[email protected]> Signed-off-by: Potnuri Bharat Teja <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent d507d29 commit a4048c8

File tree

1 file changed

+16
-0
lines changed
  • drivers/infiniband/core

1 file changed

+16
-0
lines changed

drivers/infiniband/core/cma.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ cma_validate_port(struct ib_device *device, u32 port,
690690
int bound_if_index = dev_addr->bound_dev_if;
691691
int dev_type = dev_addr->dev_type;
692692
struct net_device *ndev = NULL;
693+
struct net_device *pdev = NULL;
693694

694695
if (!rdma_dev_access_netns(device, id_priv->id.route.addr.dev_addr.net))
695696
goto out;
@@ -714,6 +715,21 @@ cma_validate_port(struct ib_device *device, u32 port,
714715

715716
rcu_read_lock();
716717
ndev = rcu_dereference(sgid_attr->ndev);
718+
if (ndev->ifindex != bound_if_index) {
719+
pdev = dev_get_by_index_rcu(dev_addr->net, bound_if_index);
720+
if (pdev) {
721+
if (is_vlan_dev(pdev)) {
722+
pdev = vlan_dev_real_dev(pdev);
723+
if (ndev->ifindex == pdev->ifindex)
724+
bound_if_index = pdev->ifindex;
725+
}
726+
if (is_vlan_dev(ndev)) {
727+
pdev = vlan_dev_real_dev(ndev);
728+
if (bound_if_index == pdev->ifindex)
729+
bound_if_index = ndev->ifindex;
730+
}
731+
}
732+
}
717733
if (!net_eq(dev_net(ndev), dev_addr->net) ||
718734
ndev->ifindex != bound_if_index) {
719735
rdma_put_gid_attr(sgid_attr);

0 commit comments

Comments
 (0)