* [PATCH for-rc v2] RDMA/core: Fix ENODEV error for iWARP test over vlan
@ 2024-10-07 13:09 Anumula Murali Mohan Reddy
2024-10-07 18:10 ` Leon Romanovsky
0 siblings, 1 reply; 5+ messages in thread
From: Anumula Murali Mohan Reddy @ 2024-10-07 13:09 UTC (permalink / raw)
To: jgg, leonro; +Cc: linux-rdma, Anumula Murali Mohan Reddy, Potnuri Bharat Teja
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")
Signed-off-by: Anumula Murali Mohan Reddy <anumula@chelsio.com>
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
---
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(+)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index be0743dac3ff..8962fc0fe4c4 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -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;
}
--
2.39.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH for-rc v2] RDMA/core: Fix ENODEV error for iWARP test over vlan
2024-10-07 13:09 [PATCH for-rc v2] RDMA/core: Fix ENODEV error for iWARP test over vlan Anumula Murali Mohan Reddy
@ 2024-10-07 18:10 ` Leon Romanovsky
0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2024-10-07 18:10 UTC (permalink / raw)
To: Anumula Murali Mohan Reddy; +Cc: jgg, linux-rdma, Potnuri Bharat Teja
On Mon, Oct 07, 2024 at 06:39:41PM +0530, Anumula Murali Mohan Reddy wrote:
> 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")
> Signed-off-by: Anumula Murali Mohan Reddy <anumula@chelsio.com>
> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> ---
> 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(+)
>
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> index be0743dac3ff..8962fc0fe4c4 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -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
> + dev = vlan_dev_real_dev(dev);
> return ret ? ERR_PTR(ret) : dev;
> }
>
> --
> 2.39.3
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH for-rc v2] RDMA/core: Fix ENODEV error for iWARP test over vlan
@ 2024-12-03 14:00 Anumula Murali Mohan Reddy
2024-12-05 8:42 ` Leon Romanovsky
2024-12-10 8:59 ` Leon Romanovsky
0 siblings, 2 replies; 5+ messages in thread
From: Anumula Murali Mohan Reddy @ 2024-12-03 14:00 UTC (permalink / raw)
To: jgg, leonro; +Cc: linux-rdma, bharat, Anumula Murali Mohan Reddy
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: f8ef1be816bf ("RDMA/cma: Avoid GID lookups on iWARP devices")
Link: https://lore.kernel.org/all/ZzNgdrjo1kSCGbRz@chelsio.com/
Signed-off-by: Anumula Murali Mohan Reddy <anumula@chelsio.com>
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
---
Changes since v1:
Addressed previous review comments
---
drivers/infiniband/core/cma.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 64ace0b968f0..91db10515d74 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -690,6 +690,7 @@ cma_validate_port(struct ib_device *device, u32 port,
int bound_if_index = dev_addr->bound_dev_if;
int dev_type = dev_addr->dev_type;
struct net_device *ndev = NULL;
+ struct net_device *pdev = NULL;
if (!rdma_dev_access_netns(device, id_priv->id.route.addr.dev_addr.net))
goto out;
@@ -714,6 +715,21 @@ cma_validate_port(struct ib_device *device, u32 port,
rcu_read_lock();
ndev = rcu_dereference(sgid_attr->ndev);
+ if (ndev->ifindex != bound_if_index) {
+ pdev = dev_get_by_index_rcu(dev_addr->net, bound_if_index);
+ if (pdev) {
+ if (is_vlan_dev(pdev)) {
+ pdev = vlan_dev_real_dev(pdev);
+ if (ndev->ifindex == pdev->ifindex)
+ bound_if_index = pdev->ifindex;
+ }
+ if (is_vlan_dev(ndev)) {
+ pdev = vlan_dev_real_dev(ndev);
+ if (bound_if_index == pdev->ifindex)
+ bound_if_index = ndev->ifindex;
+ }
+ }
+ }
if (!net_eq(dev_net(ndev), dev_addr->net) ||
ndev->ifindex != bound_if_index) {
rdma_put_gid_attr(sgid_attr);
--
2.39.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH for-rc v2] RDMA/core: Fix ENODEV error for iWARP test over vlan
2024-12-03 14:00 Anumula Murali Mohan Reddy
@ 2024-12-05 8:42 ` Leon Romanovsky
2024-12-10 8:59 ` Leon Romanovsky
1 sibling, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2024-12-05 8:42 UTC (permalink / raw)
To: Anumula Murali Mohan Reddy; +Cc: jgg, linux-rdma, bharat
On Tue, Dec 03, 2024 at 07:30:53PM +0530, Anumula Murali Mohan Reddy wrote:
> 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: f8ef1be816bf ("RDMA/cma: Avoid GID lookups on iWARP devices")
> Link: https://lore.kernel.org/all/ZzNgdrjo1kSCGbRz@chelsio.com/
> Signed-off-by: Anumula Murali Mohan Reddy <anumula@chelsio.com>
> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> ---
> Changes since v1:
> Addressed previous review comments
> ---
> drivers/infiniband/core/cma.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
I added this patch to our regression run, if everything works, I will
merge it next week.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH for-rc v2] RDMA/core: Fix ENODEV error for iWARP test over vlan
2024-12-03 14:00 Anumula Murali Mohan Reddy
2024-12-05 8:42 ` Leon Romanovsky
@ 2024-12-10 8:59 ` Leon Romanovsky
1 sibling, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2024-12-10 8:59 UTC (permalink / raw)
To: Jason Gunthorpe, Leon Romanovsky, Anumula Murali Mohan Reddy
Cc: linux-rdma, bharat
On Tue, 03 Dec 2024 19:30:53 +0530, Anumula Murali Mohan Reddy wrote:
> 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
>
> [...]
Applied, thanks!
[1/1] RDMA/core: Fix ENODEV error for iWARP test over vlan
https://git.kernel.org/rdma/rdma/c/a4048c83fd87c6
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-10 8:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 13:09 [PATCH for-rc v2] RDMA/core: Fix ENODEV error for iWARP test over vlan Anumula Murali Mohan Reddy
2024-10-07 18:10 ` Leon Romanovsky
-- strict thread matches above, loose matches on Subject: below --
2024-12-03 14:00 Anumula Murali Mohan Reddy
2024-12-05 8:42 ` Leon Romanovsky
2024-12-10 8:59 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox