Blame SOURCES/0165-netdrv-net-mlx5e-Fix-ICOSQ-recovery-flow-with-Stridi.patch

d8f823
From 61d364158c814d57a209665b8dcabf3e0babee89 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 12 May 2020 10:54:35 -0400
d8f823
Subject: [PATCH 165/312] [netdrv] net/mlx5e: Fix ICOSQ recovery flow with
d8f823
 Striding RQ
d8f823
d8f823
Message-id: <20200512105530.4207-70-ahleihel@redhat.com>
d8f823
Patchwork-id: 306941
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789382 069/124] net/mlx5e: Fix ICOSQ recovery flow with Striding RQ
d8f823
Bugzilla: 1789382
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789382
d8f823
Upstream: v5.6
d8f823
d8f823
commit e239c6d686e1c37fb2ab143162dfb57471a8643f
d8f823
Author: Aya Levin <ayal@mellanox.com>
d8f823
Date:   Mon Mar 16 16:53:10 2020 +0200
d8f823
d8f823
    net/mlx5e: Fix ICOSQ recovery flow with Striding RQ
d8f823
d8f823
    In striding RQ mode, the buffers of an RX WQE are first
d8f823
    prepared and posted to the HW using a UMR WQEs via the ICOSQ.
d8f823
    We maintain the state of these in-progress WQEs in the RQ
d8f823
    SW struct.
d8f823
d8f823
    In the flow of ICOSQ recovery, the corresponding RQ is not
d8f823
    in error state, hence:
d8f823
d8f823
    - The buffers of the in-progress WQEs must be released
d8f823
      and the RQ metadata should reflect it.
d8f823
    - Existing RX WQEs in the RQ should not be affected.
d8f823
d8f823
    For this, wrap the dealloc of the in-progress WQEs in
d8f823
    a function, and use it in the ICOSQ recovery flow
d8f823
    instead of mlx5e_free_rx_descs().
d8f823
d8f823
    Fixes: be5323c8379f ("net/mlx5e: Report and recover from CQE error on ICOSQ")
d8f823
    Signed-off-by: Aya Levin <ayal@mellanox.com>
d8f823
    Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en.h       |  1 +
d8f823
 .../ethernet/mellanox/mlx5/core/en/reporter_rx.c   |  2 +-
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 31 +++++++++++++++++-----
d8f823
 3 files changed, 26 insertions(+), 8 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
index 44f35adbf775..f0f33971be6c 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
@@ -1048,6 +1048,7 @@ int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state);
d8f823
 void mlx5e_activate_rq(struct mlx5e_rq *rq);
d8f823
 void mlx5e_deactivate_rq(struct mlx5e_rq *rq);
d8f823
 void mlx5e_free_rx_descs(struct mlx5e_rq *rq);
d8f823
+void mlx5e_free_rx_in_progress_descs(struct mlx5e_rq *rq);
d8f823
 void mlx5e_activate_icosq(struct mlx5e_icosq *icosq);
d8f823
 void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq);
d8f823
 
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
d8f823
index 6c72b592315b..a01e2de2488f 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
d8f823
@@ -90,7 +90,7 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx)
d8f823
 		goto out;
d8f823
 
d8f823
 	mlx5e_reset_icosq_cc_pc(icosq);
d8f823
-	mlx5e_free_rx_descs(rq);
d8f823
+	mlx5e_free_rx_in_progress_descs(rq);
d8f823
 	clear_bit(MLX5E_SQ_STATE_RECOVERING, &icosq->state);
d8f823
 	mlx5e_activate_icosq(icosq);
d8f823
 	mlx5e_activate_rq(rq);
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
index c9b9c6cb1677..2f87b0b4660f 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
@@ -814,6 +814,29 @@ int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq, int wait_time)
d8f823
 	return -ETIMEDOUT;
d8f823
 }
d8f823
 
d8f823
+void mlx5e_free_rx_in_progress_descs(struct mlx5e_rq *rq)
d8f823
+{
d8f823
+	struct mlx5_wq_ll *wq;
d8f823
+	u16 head;
d8f823
+	int i;
d8f823
+
d8f823
+	if (rq->wq_type != MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
d8f823
+		return;
d8f823
+
d8f823
+	wq = &rq->mpwqe.wq;
d8f823
+	head = wq->head;
d8f823
+
d8f823
+	/* Outstanding UMR WQEs (in progress) start at wq->head */
d8f823
+	for (i = 0; i < rq->mpwqe.umr_in_progress; i++) {
d8f823
+		rq->dealloc_wqe(rq, head);
d8f823
+		head = mlx5_wq_ll_get_wqe_next_ix(wq, head);
d8f823
+	}
d8f823
+
d8f823
+	rq->mpwqe.actual_wq_head = wq->head;
d8f823
+	rq->mpwqe.umr_in_progress = 0;
d8f823
+	rq->mpwqe.umr_completed = 0;
d8f823
+}
d8f823
+
d8f823
 void mlx5e_free_rx_descs(struct mlx5e_rq *rq)
d8f823
 {
d8f823
 	__be16 wqe_ix_be;
d8f823
@@ -821,14 +844,8 @@ void mlx5e_free_rx_descs(struct mlx5e_rq *rq)
d8f823
 
d8f823
 	if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) {
d8f823
 		struct mlx5_wq_ll *wq = &rq->mpwqe.wq;
d8f823
-		u16 head = wq->head;
d8f823
-		int i;
d8f823
 
d8f823
-		/* Outstanding UMR WQEs (in progress) start at wq->head */
d8f823
-		for (i = 0; i < rq->mpwqe.umr_in_progress; i++) {
d8f823
-			rq->dealloc_wqe(rq, head);
d8f823
-			head = mlx5_wq_ll_get_wqe_next_ix(wq, head);
d8f823
-		}
d8f823
+		mlx5e_free_rx_in_progress_descs(rq);
d8f823
 
d8f823
 		while (!mlx5_wq_ll_is_empty(wq)) {
d8f823
 			struct mlx5e_rx_wqe_ll *wqe;
d8f823
-- 
d8f823
2.13.6
d8f823