Skip to contentSkip to conversation

RDMA/core: Fix find_gid_index to use the proper API to retrieve the vlan ID

PATCH In review Yuval Basson 3 participants 3 messages Sep 25, 2019 – Sep 26, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/core: Fix find_gid_index to use the proper API to retrieve the vlan ID

When working over a macvlan device which was itself
created over a vlan device, the roce CM traffic should use the vlan from the lower vlan device, but instead it simply queries the macvlan device as to whether it is itself a vlan device. Since it is not, the roce CM traffic is sent without any vlan, which causes it not to be accepted by the peer which is running directly over a vlan device, and will thus only accept roce CM traffic carrying the vlan.

Fixes dbf727de7440 ("Use GID table in AH creation and dmac resolution")
---
 drivers/infiniband/core/verbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/core/verbs.c +3 -3
index f974b68..1d2d9be0 100644
@@ -662,13 +662,13 @@ static bool find_gid_index(const union ib_gid *gid,
 			   void *context)
 {
 	struct find_gid_index_context *ctx = context;
+	u16 vlan_id;
 
 	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))
+	rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL);
+	if (ctx->vlan_id != vlan_id)
 		return false;
 
 	return true;
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Yuval,

Quoted 34 lines

-----Original Message-----
From: [email protected] <linux-rdma- [email protected]> On Behalf Of Yuval Basson
Sent: Wednesday, September 25, 2019 6:23 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Yuval Basson <[email protected]>; Ariel Elior <[email protected]>
Subject: [PATCH rdma-next] RDMA/core: Fix find_gid_index to use the proper API to retrieve the vlan ID

When working over a macvlan device which was itself created over a vlan device, the roce CM traffic should use the vlan from the lower vlan device, but instead it simply queries the macvlan device as to whether it is itself a vlan device.
Since it is not, the roce CM traffic is sent without any vlan, which causes it not to be accepted by the peer which is running directly over a vlan device, and will thus only accept roce CM traffic carrying the vlan.

Fixes dbf727de7440 ("Use GID table in AH creation and dmac resolution")
---
 drivers/infiniband/core/verbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/core/verbs.c +1 -0
index f974b68..1d2d9be0 100644
@@ -662,13 +662,13 @@ static bool find_gid_index(const union ib_gid *gid,
 			   void *context)
 {
 	struct find_gid_index_context *ctx = context;
+	u16 vlan_id;

drivers/infiniband/core/verbs.c static bool find_gid_index(const union ib_gid *gid, · line 672

Quoted 10 lines
drivers/infiniband/core/verbs.c +2 -3
 
 	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))
+	rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL);
+	if (ctx->vlan_id != vlan_id)
 		return false;

A little shorter version [1] along with rdmacm support [2] are in Leon's queue which is needed for macvlan to work properly.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?h=rdma-next&id=9811bdac481cf6278512a8d052c5ba91cfb69c71
[2] https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?h=rdma-next&id=d190d04808be104a2a3ef71841ff03c5ffaa16f8

Quoted 4 lines
drivers/infiniband/core/verbs.c +0 -1
 	return true;
--

1.8.3.1

#2 lore raw
Quoted 41 lines · Parav Pandit

Hi Yuval,

Quoted 38 lines

-----Original Message-----
From: [email protected] <linux-rdma- [email protected]> On Behalf Of Yuval Basson
Sent: Wednesday, September 25, 2019 6:23 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Yuval Basson <[email protected]>; Ariel Elior <[email protected]>
Subject: [PATCH rdma-next] RDMA/core: Fix find_gid_index to use the proper API to retrieve the vlan ID

When working over a macvlan device which was itself created over a vlan device, the roce CM traffic should use the vlan from the lower vlan device, but instead it simply queries the macvlan device as to whether it is itself a vlan device.
Since it is not, the roce CM traffic is sent without any vlan, which causes it not to be accepted by the peer which is running directly over a vlan device, and will thus only accept roce CM traffic carrying the vlan.

Fixes dbf727de7440 ("Use GID table in AH creation and dmac resolution")
---
 drivers/infiniband/core/verbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/core/verbs.c +1 -0
index f974b68..1d2d9be0 100644
@@ -662,13 +662,13 @@ static bool find_gid_index(const union ib_gid *gid,
 			   void *context)
 {
 	struct find_gid_index_context *ctx = context;
+	u16 vlan_id;
 
 	if (ctx->gid_type != gid_attr->gid_type)
 		return false;
 
Quoted 8 lines

drivers/infiniband/core/verbs.c static bool find_gid_index(const union ib_gid *gid, · line 672

Quoted 6 lines
drivers/infiniband/core/verbs.c +2 -3
-	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))
+	rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL);
+	if (ctx->vlan_id != vlan_id)
 		return false;

A little shorter version [1] along with rdmacm support [2] are in Leon's queue which is needed for macvlan to work properly.

I'll start sending after merge window will end.

Thanks

Quoted 9 lines

[1] https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?h=rdma-next&id=9811bdac481cf6278512a8d052c5ba91cfb69c71
[2] https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?h=rdma-next&id=d190d04808be104a2a3ef71841ff03c5ffaa16f8

Quoted 4 lines
drivers/infiniband/core/verbs.c +0 -1
 	return true;
--

1.8.3.1