Skip to contentSkip to conversation

RDMA/mlx5: Set GRH fields in query QP on RoCE

PATCH Applied Leon Romanovsky 2 participants 3 messages Apr 13, 2020 – Apr 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mlx5: Set GRH fields in query QP on RoCE

From: Aharon Landau <[email protected]>

GRH fields such as sgid_index, hop limit and etc. are set in the QP context when QP is created/modified.

Currently, when query QP is performed, we fill the GRH fields only if the GRH bit is set in the QP context, but this bit is not set for RoCE. Adjust the check so we will set all relevant data for the RoCE too.

Fixes d8966fcd4c25 ("IB/core: Use rdma_ah_attr accessor functions")
---
 drivers/infiniband/hw/mlx5/qp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +5 -5
index 1456db4b6295..a4f8e7c7ed24 100644
@@ -5558,13 +5558,13 @@ static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev,
 	rdma_ah_set_path_bits(ah_attr, path->grh_mlid & 0x7f);
 	rdma_ah_set_static_rate(ah_attr,
 				path->static_rate ? path->static_rate - 5 : 0);
-	if (path->grh_mlid & (1 << 7)) {
+
+	if (path->grh_mlid & (1 << 7) ||
+	    ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
 		u32 tc_fl = be32_to_cpu(path->tclass_flowlabel);
 
-		rdma_ah_set_grh(ah_attr, NULL,
-				tc_fl & 0xfffff,
-				path->mgid_index,
-				path->hop_limit,
+		rdma_ah_set_grh(ah_attr, NULL, tc_fl & 0xfffff,
+				path->mgid_index, path->hop_limit,
 				(tc_fl >> 20) & 0xff);
 		rdma_ah_set_dgid_raw(ah_attr, path->rgid);
 	}
Signature · 1 line
2.25.2
#1 lore raw
Quoted 28 lines · Leon Romanovsky

From: Aharon Landau <[email protected]>

GRH fields such as sgid_index, hop limit and etc. are set in the QP context when QP is created/modified.

Currently, when query QP is performed, we fill the GRH fields only if the GRH bit is set in the QP context, but this bit is not set for RoCE. Adjust the check so we will set all relevant data for the RoCE too.

Fixes d8966fcd4c25 ("IB/core: Use rdma_ah_attr accessor functions")
---
 drivers/infiniband/hw/mlx5/qp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +1 -1
index 1456db4b6295..a4f8e7c7ed24 100644
@@ -5558,13 +5558,13 @@ static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev,
 	rdma_ah_set_path_bits(ah_attr, path->grh_mlid & 0x7f);
 	rdma_ah_set_static_rate(ah_attr,
 				path->static_rate ? path->static_rate - 5 : 0);
-	if (path->grh_mlid & (1 << 7)) {
+

drivers/infiniband/hw/mlx5/qp.c static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev, · line 5567

Quoted 10 lines
drivers/infiniband/hw/mlx5/qp.c +4 -4
+	if (path->grh_mlid & (1 << 7) ||
+	    ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
 		u32 tc_fl = be32_to_cpu(path->tclass_flowlabel);
 
-		rdma_ah_set_grh(ah_attr, NULL,
-				tc_fl & 0xfffff,
-				path->mgid_index,
-				path->hop_limit,
+		rdma_ah_set_grh(ah_attr, NULL, tc_fl & 0xfffff,
+				path->mgid_index, path->hop_limit,

Why is whitespace reformatting in a -rc patch? I dropped this.

Applied to for-rc

Jason

#2 lore raw
Quoted 33 lines · Jason Gunthorpe
Quoted 32 lines · Leon Romanovsky

From: Aharon Landau <[email protected]>

GRH fields such as sgid_index, hop limit and etc. are set in the QP context when QP is created/modified.

Currently, when query QP is performed, we fill the GRH fields only if the GRH bit is set in the QP context, but this bit is not set for RoCE. Adjust the check so we will set all relevant data for the RoCE too.

Fixes d8966fcd4c25 ("IB/core: Use rdma_ah_attr accessor functions")
---
 drivers/infiniband/hw/mlx5/qp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +3 -1
index 1456db4b6295..a4f8e7c7ed24 100644
@@ -5558,13 +5558,13 @@ static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev,
 	rdma_ah_set_path_bits(ah_attr, path->grh_mlid & 0x7f);
 	rdma_ah_set_static_rate(ah_attr,
 				path->static_rate ? path->static_rate - 5 : 0);
-	if (path->grh_mlid & (1 << 7)) {
+
+	if (path->grh_mlid & (1 << 7) ||
+	    ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
 		u32 tc_fl = be32_to_cpu(path->tclass_flowlabel);
 
Quoted 8 lines

drivers/infiniband/hw/mlx5/qp.c static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev, · line 5567

Quoted 6 lines
drivers/infiniband/hw/mlx5/qp.c +2 -4
-		rdma_ah_set_grh(ah_attr, NULL,
-				tc_fl & 0xfffff,
-				path->mgid_index,
-				path->hop_limit,
+		rdma_ah_set_grh(ah_attr, NULL, tc_fl & 0xfffff,
+				path->mgid_index, path->hop_limit,

Why is whitespace reformatting in a -rc patch? I dropped this.

I'm running clang formatter before posting patches.

Thanks

Quoted 4 lines

Applied to for-rc

Jason