linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-rc] IB/core: Use rdma_read_gid_l2_fields to compare GID L2 fields
@ 2019-10-02 12:17 Leon Romanovsky
  2019-10-18 18:58 ` Doug Ledford
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2019-10-02 12:17 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Parav Pandit, RDMA mailing list, Matan Barak, Leon Romanovsky

From: Parav Pandit <parav@mellanox.com>

Current code tries to derive VLAN ID and compares it with GID
attribute for matching entry. This raw search fails on macvlan
netdevice as its not a VLAN device, but its an upper device of a VLAN
netdevice.

Due to this limitation, incoming QP1 packets fail to match in the
GID table. Such packets are dropped.

Hence, to support it, use the existing rdma_read_gid_l2_fields()
that takes care of diffferent device types.

Fixes: dbf727de7440 ("IB/core: Use GID table in AH creation and dmac resolution")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/verbs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index f974b6854224..35c2841a569e 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -662,16 +662,17 @@ static bool find_gid_index(const union ib_gid *gid,
 			   void *context)
 {
 	struct find_gid_index_context *ctx = context;
+	u16 vlan_id = 0xffff;
+	int ret;
 
 	if (ctx->gid_type != gid_attr->gid_type)
 		return false;
 
-	if ((!!(ctx->vlan_id != 0xffff) == !is_vlan_dev(gid_attr->ndev)) ||
-	    (is_vlan_dev(gid_attr->ndev) &&
-	     vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id))
+	ret = rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL);
+	if (ret)
 		return false;
 
-	return true;
+	return ctx->vlan_id == vlan_id;
 }
 
 static const struct ib_gid_attr *
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH rdma-rc] IB/core: Use rdma_read_gid_l2_fields to compare GID L2 fields
  2019-10-02 12:17 [PATCH rdma-rc] IB/core: Use rdma_read_gid_l2_fields to compare GID L2 fields Leon Romanovsky
@ 2019-10-18 18:58 ` Doug Ledford
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Ledford @ 2019-10-18 18:58 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe
  Cc: Parav Pandit, RDMA mailing list, Matan Barak, Leon Romanovsky

[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

On Wed, 2019-10-02 at 15:17 +0300, Leon Romanovsky wrote:
> From: Parav Pandit <parav@mellanox.com>
> 
> Current code tries to derive VLAN ID and compares it with GID
> attribute for matching entry. This raw search fails on macvlan
> netdevice as its not a VLAN device, but its an upper device of a VLAN
> netdevice.
> 
> Due to this limitation, incoming QP1 packets fail to match in the
> GID table. Such packets are dropped.
> 
> Hence, to support it, use the existing rdma_read_gid_l2_fields()
> that takes care of diffferent device types.
> 
> Fixes: dbf727de7440 ("IB/core: Use GID table in AH creation and dmac
> resolution")
> Signed-off-by: Parav Pandit <parav@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Thanks, applied to for-rc.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-18 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-02 12:17 [PATCH rdma-rc] IB/core: Use rdma_read_gid_l2_fields to compare GID L2 fields Leon Romanovsky
2019-10-18 18:58 ` Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).