[dpdk-stable] patch 'net/mlx5: fix Rx queue completion index consistency' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue Nov 17 12:13:50 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/19/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/c8b25df21ec9ed4c79ca43a85a851a15184cc989

Thanks.

Luca Boccassi

---
>From c8b25df21ec9ed4c79ca43a85a851a15184cc989 Mon Sep 17 00:00:00 2001
From: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
Date: Fri, 6 Nov 2020 17:16:10 +0000
Subject: [PATCH] net/mlx5: fix Rx queue completion index consistency

[ upstream commit 70d83ebbbb2554bcab78bfe7f5b102635278bc76 ]

The Rx queue completion consumer index got temporary
wrong value pointing to the midst of the compressed CQE
session. If application crashed at the moment the next
queue restart caused handling wrong CQEs pointed by index
and losing consuming index synchronization, that made
reliable queue restart impossible.

Fixes: 88c0733535d6 ("net/mlx5: extend Rx completion with error handling")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index fb4fe94235..9f4a04122c 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1125,6 +1125,7 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
 		} else {
 			int ret;
 			int8_t op_own;
+			uint32_t cq_ci;
 
 			ret = check_cqe(cqe, cqe_n, rxq->cq_ci);
 			if (unlikely(ret != MLX5_CQE_STATUS_SW_OWN)) {
@@ -1138,14 +1139,19 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
 					return 0;
 				}
 			}
-			++rxq->cq_ci;
+			/*
+			 * Introduce the local variable to have queue cq_ci
+			 * index in queue structure always consistent with
+			 * actual CQE boundary (not pointing to the middle
+			 * of compressed CQE session).
+			 */
+			cq_ci = rxq->cq_ci + 1;
 			op_own = cqe->op_own;
 			if (MLX5_CQE_FORMAT(op_own) == MLX5_COMPRESSED) {
 				volatile struct mlx5_mini_cqe8 (*mc)[8] =
 					(volatile struct mlx5_mini_cqe8 (*)[8])
 					(uintptr_t)(&(*rxq->cqes)
-						[rxq->cq_ci &
-						 cqe_cnt].pkt_info);
+						[cq_ci & cqe_cnt].pkt_info);
 
 				/* Fix endianness. */
 				zip->cqe_cnt = rte_be_to_cpu_32(cqe->byte_cnt);
@@ -1158,10 +1164,9 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
 				 * 7 CQEs after the initial CQE instead of 8
 				 * for subsequent ones.
 				 */
-				zip->ca = rxq->cq_ci;
+				zip->ca = cq_ci;
 				zip->na = zip->ca + 7;
 				/* Compute the next non compressed CQE. */
-				--rxq->cq_ci;
 				zip->cq_ci = rxq->cq_ci + zip->cqe_cnt;
 				/* Get packet size to return. */
 				len = rte_be_to_cpu_32((*mc)[0].byte_cnt);
@@ -1176,6 +1181,7 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
 					++idx;
 				}
 			} else {
+				rxq->cq_ci = cq_ci;
 				len = rte_be_to_cpu_32(cqe->byte_cnt);
 			}
 		}
-- 
2.27.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-11-17 11:13:13.651445451 +0000
+++ 0016-net-mlx5-fix-Rx-queue-completion-index-consistency.patch	2020-11-17 11:13:12.893116045 +0000
@@ -1 +1 @@
-From 70d83ebbbb2554bcab78bfe7f5b102635278bc76 Mon Sep 17 00:00:00 2001
+From c8b25df21ec9ed4c79ca43a85a851a15184cc989 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 70d83ebbbb2554bcab78bfe7f5b102635278bc76 ]
+
@@ -14 +15,0 @@
-Cc: stable at dpdk.org
@@ -19 +19,0 @@
- drivers/net/mlx5/mlx5_rxq.c  |  2 +-
@@ -21 +21 @@
- 2 files changed, 12 insertions(+), 6 deletions(-)
+ 1 file changed, 11 insertions(+), 5 deletions(-)
@@ -23,13 +22,0 @@
-diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
-index c04746afb1..f299fbc8a5 100644
---- a/drivers/net/mlx5/mlx5_rxq.c
-+++ b/drivers/net/mlx5/mlx5_rxq.c
-@@ -622,7 +622,7 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx)
- 	rte_io_wmb();
- 	*rxq->cq_db = rte_cpu_to_be_32(rxq->cq_ci);
- 	rte_io_wmb();
--	/* Reset RQ consumer before moving queue ro READY state. */
-+	/* Reset RQ consumer before moving queue to READY state. */
- 	*rxq->rq_db = rte_cpu_to_be_32(0);
- 	rte_io_wmb();
- 	ret = priv->obj_ops.rxq_obj_modify(rxq_ctrl->obj, MLX5_RXQ_MOD_RST2RDY);
@@ -37 +24 @@
-index 402e7d1c3f..a5829f00de 100644
+index fb4fe94235..9f4a04122c 100644
@@ -40 +27 @@
-@@ -1181,6 +1181,7 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
+@@ -1125,6 +1125,7 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
@@ -48 +35 @@
-@@ -1194,14 +1195,19 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
+@@ -1138,14 +1139,19 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
@@ -71 +58 @@
-@@ -1214,10 +1220,9 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
+@@ -1158,10 +1164,9 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
@@ -82,2 +69,2 @@
- 				len = rte_be_to_cpu_32((*mc)[0].byte_cnt &
-@@ -1233,6 +1238,7 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,
+ 				len = rte_be_to_cpu_32((*mc)[0].byte_cnt);
+@@ -1176,6 +1181,7 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe,


More information about the stable mailing list