Skip to contentSkip to conversation

IB/core: Use rdma_read_gid_l2_fields to compare GID L2 fields

PATCH Applied Leon Romanovsky 2 participants 2 messages Oct 2, 2019 – Oct 18, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/core: Use rdma_read_gid_l2_fields to compare GID L2 fields

From: Parav Pandit <[email protected]>

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")
---
 drivers/infiniband/core/verbs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/core/verbs.c +5 -4
index f974b6854224..35c2841a569e 100644
@@ -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 *
Signature · 1 line
2.20.1
Applied
#1 lore raw
Quoted 10 lines · Leon Romanovsky

From: Parav Pandit <[email protected]>

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.

Quoted 7 lines

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")

Thanks, applied to for-rc.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD