Skip to contentSkip to conversation

mlx4 RSS fixes for 4.15

PATCH In review Leon Romanovsky 2 participants 6 messages Oct 25, 2017 – Nov 13, 2017 3 messages not in the archive

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

cover mlx4 RSS fixes for 4.15

Hi Doug,

There are two mlx4 RSS fixes for v4.15

Thanks

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-10-25

Thanks
---------------------------------------

Guy Levi (2):
IB/mlx4: Add report for RSS capabilities by vendor channel IB/mlx4: Fix RSS's QPC attributes assignments

 drivers/infiniband/hw/mlx4/main.c    | 17 +++++++++++++++++
 drivers/infiniband/hw/mlx4/mlx4_ib.h | 16 +++++++++++-----
 drivers/infiniband/hw/mlx4/qp.c      | 16 +++++++++-------
 3 files changed, 37 insertions(+), 12 deletions(-)

--
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20171025193935.1075-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw

PATCH 1/2 IB/mlx4: Add report for RSS capabilities by vendor channel

From: Guy Levi <guyle-VPRAkNaXOzVWk0Htik3J/[email protected]>

The mlx4's RSS patches submission missed a report of RSS capabilities which should be reported by the vendor channel in query_device.

---
 drivers/infiniband/hw/mlx4/main.c    | 17 +++++++++++++++++
 drivers/infiniband/hw/mlx4/mlx4_ib.h | 16 +++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx4/main.c +17 -0
index c6420e26f2d8..8c8a16791a3f 100644
@@ -584,6 +584,23 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
 			sizeof(struct mlx4_wqe_data_seg);
 	}
 
+	if (uhw->outlen >= resp.response_length + sizeof(resp.rss_caps)) {
+		resp.response_length += sizeof(resp.rss_caps);
+		if (props->rss_caps.supported_qpts) {
+			resp.rss_caps.rx_hash_function =
+				MLX4_IB_RX_HASH_FUNC_TOEPLITZ;
+			resp.rss_caps.rx_hash_fields_mask =
+				MLX4_IB_RX_HASH_SRC_IPV4 |
+				MLX4_IB_RX_HASH_DST_IPV4 |
+				MLX4_IB_RX_HASH_SRC_IPV6 |
+				MLX4_IB_RX_HASH_DST_IPV6 |
+				MLX4_IB_RX_HASH_SRC_PORT_TCP |
+				MLX4_IB_RX_HASH_DST_PORT_TCP |
+				MLX4_IB_RX_HASH_SRC_PORT_UDP |
+				MLX4_IB_RX_HASH_DST_PORT_UDP;
+		}
+	}
+
 	if (uhw->outlen) {
 		err = ib_copy_to_udata(uhw, &resp, resp.response_length);
 		if (err)
drivers/infiniband/hw/mlx4/mlx4_ib.h +11 -5
index 9a55064ed69a..65c66dbff754 100644
@@ -645,12 +645,18 @@ enum query_device_resp_mask {
 	QUERY_DEVICE_RESP_MASK_TIMESTAMP = 1UL << 0,
 };
 
+struct mlx4_ib_rss_caps {
+	__u64 rx_hash_fields_mask; /* enum mlx4_rx_hash_fields */
+	__u8 rx_hash_function; /* enum mlx4_rx_hash_function_flags */
+	__u8 reserved[7];
+};
+
 struct mlx4_uverbs_ex_query_device_resp {
-	__u32 comp_mask;
-	__u32 response_length;
-	__u64 hca_core_clock_offset;
-	__u32 max_inl_recv_sz;
-	__u32 reserved;
+	__u32			comp_mask;
+	__u32			response_length;
+	__u64			hca_core_clock_offset;
+	__u32			max_inl_recv_sz;
+	struct mlx4_ib_rss_caps	rss_caps;
 };
 
 static inline struct mlx4_ib_dev *to_mdev(struct ib_device *ibdev)
Signature · 6 lines
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 2/2 IB/mlx4: Fix RSS's QPC attributes assignments

In reply to a message not in the archive

From: Guy Levi <guyle-VPRAkNaXOzVWk0Htik3J/[email protected]>

In the modify QP handler the base_qpn_udp field in the RSS QPC is overwrite later by irrelevant value assignment. Hence, ingress packets which gets to the RSS QP will be steered then to a garbage QPN.

The patch fixes this by skipping the above assignment when a RSS QP is modified, also, the RSS context's attributes assignments are relocated just before the context is posted to avoid future issues like this.

Additionally, this patch takes the opportunity to change the code to be disciplined to the device's manual and assigns the RSS QP context just at RESET to INIT transition.

---
 drivers/infiniband/hw/mlx4/qp.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/infiniband/hw/mlx4/qp.c +9 -7
index b6b33d99b0b4..26f3345948e2 100644
@@ -2182,11 +2182,6 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type,
 	context->flags = cpu_to_be32((to_mlx4_state(new_state) << 28) |
 				     (to_mlx4_st(dev, qp->mlx4_ib_qp_type) << 16));
 
-	if (rwq_ind_tbl) {
-		fill_qp_rss_context(context, qp);
-		context->flags |= cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET);
-	}
-
 	if (!(attr_mask & IB_QP_PATH_MIG_STATE))
 		context->flags |= cpu_to_be32(MLX4_QP_PM_MIGRATED << 11);
 	else {
@@ -2387,6 +2382,7 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type,
 	context->pd = cpu_to_be32(pd->pdn);
 
 	if (!rwq_ind_tbl) {
+		context->params1 = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28);
 		get_cqs(qp, src_type, &send_cq, &recv_cq);
 	} else { /* Set dummy CQs to be compatible with HV and PRM */
 		send_cq = to_mcq(rwq_ind_tbl->ind_tbl[0]->cq);
@@ -2394,7 +2390,6 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type,
 	}
 	context->cqn_send = cpu_to_be32(send_cq->mcq.cqn);
 	context->cqn_recv = cpu_to_be32(recv_cq->mcq.cqn);
-	context->params1  = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28);
 
 	/* Set "fast registration enabled" for all kernel QPs */
 	if (!ibuobject)
@@ -2513,7 +2508,7 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type,
 					MLX4_IB_LINK_TYPE_ETH;
 		if (dev->dev->caps.tunnel_offload_mode ==  MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
 			/* set QP to receive both tunneled & non-tunneled packets */
-			if (!(context->flags & cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET)))
+			if (!rwq_ind_tbl)
 				context->srqn = cpu_to_be32(7 << 28);
 		}
 	}
@@ -2562,6 +2557,13 @@ static int __mlx4_ib_modify_qp(void *src, enum mlx4_ib_source_type src_type,
 		}
 	}
 
+	if (rwq_ind_tbl	&&
+	    cur_state == IB_QPS_RESET &&
+	    new_state == IB_QPS_INIT) {
+		fill_qp_rss_context(context, qp);
+		context->flags |= cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET);
+	}
+
 	err = mlx4_qp_modify(dev->dev, &qp->mtt, to_mlx4_state(cur_state),
 			     to_mlx4_state(new_state), context, optpar,
 			     sqd_event, &qp->mqp);
Signature · 6 lines
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive
Quoted 16 lines · Leon Romanovsky

Hi Doug,

There are two mlx4 RSS fixes for v4.15

Thanks

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-10-25

Thanks
---------------------------------------

Guy Levi (2):
IB/mlx4: Add report for RSS capabilities by vendor channel IB/mlx4: Fix RSS's QPC attributes assignments

Quoted 8 lines
 drivers/infiniband/hw/mlx4/main.c    | 17 +++++++++++++++++
 drivers/infiniband/hw/mlx4/mlx4_ib.h | 16 +++++++++++-----
 drivers/infiniband/hw/mlx4/qp.c      | 16 +++++++++-------
 3 files changed, 37 insertions(+), 12 deletions(-)

--
2.14.2

Series applied, thanks.

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 22 lines · Doug Ledford
Quoted 21 lines · Leon Romanovsky

Hi Doug,

There are two mlx4 RSS fixes for v4.15

Thanks

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-10-25

Thanks
---------------------------------------

Guy Levi (2):
IB/mlx4: Add report for RSS capabilities by vendor channel IB/mlx4: Fix RSS's QPC attributes assignments

 drivers/infiniband/hw/mlx4/main.c    | 17 +++++++++++++++++
 drivers/infiniband/hw/mlx4/mlx4_ib.h | 16 +++++++++++-----
 drivers/infiniband/hw/mlx4/qp.c      | 16 +++++++++-------
 3 files changed, 37 insertions(+), 12 deletions(-)
Quoted 5 lines
Quoted 3 lines

--
2.14.2

Series applied, thanks.

Doug,

I can't find it in your k.o repo.
Where can I find it?

Thanks

Quoted 5 lines

--
Doug Ledford <[email protected]>

    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

A message that is not in the archive (sent off-list or not yet received): 20171113112013.GI18825-U/[email protected]

#8 lore raw
Quoted 27 lines · Leon Romanovsky
Quoted 26 lines · Doug Ledford
Quoted 24 lines · Leon Romanovsky

Hi Doug,

There are two mlx4 RSS fixes for v4.15

Thanks

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-10-25

Thanks
---------------------------------------

Guy Levi (2):
IB/mlx4: Add report for RSS capabilities by vendor channel IB/mlx4: Fix RSS's QPC attributes assignments

 drivers/infiniband/hw/mlx4/main.c    | 17 +++++++++++++++++
 drivers/infiniband/hw/mlx4/mlx4_ib.h | 16 +++++++++++-----
 drivers/infiniband/hw/mlx4/qp.c      | 16 +++++++++-------
 3 files changed, 37 insertions(+), 12 deletions(-)

--
2.14.2

Quoted 6 lines
Quoted 1 line

Series applied, thanks.

Doug,

I can't find it in your k.o repo.
Where can I find it?

Sorry, I took it, and I was waiting on 0day before I pushed to k.o, but I forgot to push it to github so 0day wasn't gonna come. It's been pushed to k.o today.

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