Blame SOURCES/0203-netdrv-net-mlx5-DR-On-creation-set-CQ-s-arm_db-membe.patch

d8f823
From c3ca971b1394fda6a35b50ea0af68cd66cd1e761 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 12 May 2020 10:55:20 -0400
d8f823
Subject: [PATCH 203/312] [netdrv] net/mlx5: DR, On creation set CQ's arm_db
d8f823
 member to right value
d8f823
d8f823
Message-id: <20200512105530.4207-115-ahleihel@redhat.com>
d8f823
Patchwork-id: 306988
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789382 114/124] net/mlx5: DR, On creation set CQ's arm_db member to right value
d8f823
Bugzilla: 1789384 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
Bugzilla: http://bugzilla.redhat.com/1789384
d8f823
Upstream: v5.7-rc5
d8f823
d8f823
commit 8075411d93b6efe143d9f606f6531077795b7fbf
d8f823
Author: Erez Shitrit <erezsh@mellanox.com>
d8f823
Date:   Wed Mar 25 17:19:43 2020 +0200
d8f823
d8f823
    net/mlx5: DR, On creation set CQ's arm_db member to right value
d8f823
d8f823
    In polling mode, set arm_db member to a value that will avoid CQ
d8f823
    event recovery by the HW.
d8f823
    Otherwise we might get event without completion function.
d8f823
    In addition,empty completion function to was added to protect from
d8f823
    unexpected events.
d8f823
d8f823
    Fixes: 297cccebdc5a ("net/mlx5: DR, Expose an internal API to issue RDMA operations")
d8f823
    Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
d8f823
    Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
d8f823
    Reviewed-by: Alex Vesker <valex@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/steering/dr_send.c | 14 +++++++++++++-
d8f823
 1 file changed, 13 insertions(+), 1 deletion(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
d8f823
index c0ab9cf74929..18719acb7e54 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
d8f823
@@ -695,6 +695,12 @@ static void dr_cq_event(struct mlx5_core_cq *mcq,
d8f823
 	pr_info("CQ event %u on CQ #%u\n", event, mcq->cqn);
d8f823
 }
d8f823
 
d8f823
+static void dr_cq_complete(struct mlx5_core_cq *mcq,
d8f823
+			   struct mlx5_eqe *eqe)
d8f823
+{
d8f823
+	pr_err("CQ completion CQ: #%u\n", mcq->cqn);
d8f823
+}
d8f823
+
d8f823
 static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
d8f823
 				      struct mlx5_uars_page *uar,
d8f823
 				      size_t ncqe)
d8f823
@@ -756,6 +762,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
d8f823
 	mlx5_fill_page_frag_array(&cq->wq_ctrl.buf, pas);
d8f823
 
d8f823
 	cq->mcq.event = dr_cq_event;
d8f823
+	cq->mcq.comp  = dr_cq_complete;
d8f823
 
d8f823
 	err = mlx5_core_create_cq(mdev, &cq->mcq, in, inlen, out, sizeof(out));
d8f823
 	kvfree(in);
d8f823
@@ -767,7 +774,12 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
d8f823
 	cq->mcq.set_ci_db = cq->wq_ctrl.db.db;
d8f823
 	cq->mcq.arm_db = cq->wq_ctrl.db.db + 1;
d8f823
 	*cq->mcq.set_ci_db = 0;
d8f823
-	*cq->mcq.arm_db = 0;
d8f823
+
d8f823
+	/* set no-zero value, in order to avoid the HW to run db-recovery on
d8f823
+	 * CQ that used in polling mode.
d8f823
+	 */
d8f823
+	*cq->mcq.arm_db = cpu_to_be32(2 << 28);
d8f823
+
d8f823
 	cq->mcq.vector = 0;
d8f823
 	cq->mcq.irqn = irqn;
d8f823
 	cq->mcq.uar = uar;
d8f823
-- 
d8f823
2.13.6
d8f823