Blame SOURCES/0057-netdrv-net-mlx5e-kTLS-Size-of-a-Dump-WQE-is-fixed.patch

d8f823
From 4c84687ee7bae8c9bd1722d4159ed004a09d817d Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Sun, 10 May 2020 14:52:32 -0400
d8f823
Subject: [PATCH 057/312] [netdrv] net/mlx5e: kTLS, Size of a Dump WQE is fixed
d8f823
d8f823
Message-id: <20200510145245.10054-70-ahleihel@redhat.com>
d8f823
Patchwork-id: 306608
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789378 v2 69/82] net/mlx5e: kTLS, Size of a Dump WQE is fixed
d8f823
Bugzilla: 1789378
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789378
d8f823
Upstream: v5.4-rc6
d8f823
d8f823
commit 9b1fef2f23c1141c9936debe633ff16e44c6137b
d8f823
Author: Tariq Toukan <tariqt@mellanox.com>
d8f823
Date:   Sun Sep 1 13:53:26 2019 +0300
d8f823
d8f823
    net/mlx5e: kTLS, Size of a Dump WQE is fixed
d8f823
d8f823
    No Eth segment, so no dynamic inline headers.
d8f823
    The size of a Dump WQE is fixed, use constants and remove
d8f823
    unnecessary checks.
d8f823
d8f823
    Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
d8f823
    Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
d8f823
    Reviewed-by: Eran Ben Elisha <eranbe@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/txrx.h       |  2 +-
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h |  9 ++++++++-
d8f823
 .../net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c  | 17 +++--------------
d8f823
 3 files changed, 12 insertions(+), 16 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
d8f823
index 182d5c5664eb..25f9dda578ac 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
d8f823
@@ -23,7 +23,7 @@
d8f823
 #define MLX5E_SQ_TLS_ROOM  \
d8f823
 	(MLX5_SEND_WQE_MAX_WQEBBS + \
d8f823
 	 MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS + \
d8f823
-	 MAX_SKB_FRAGS * MLX5E_KTLS_MAX_DUMP_WQEBBS)
d8f823
+	 MAX_SKB_FRAGS * MLX5E_KTLS_DUMP_WQEBBS)
d8f823
 #endif
d8f823
 
d8f823
 #define INL_HDR_START_SZ (sizeof(((struct mlx5_wqe_eth_seg *)NULL)->inline_hdr.start))
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
d8f823
index c4c128908b6e..eb692feba4a6 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
d8f823
@@ -21,7 +21,14 @@
d8f823
 	 MLX5_ST_SZ_BYTES(tls_progress_params))
d8f823
 #define MLX5E_KTLS_PROGRESS_WQEBBS \
d8f823
 	(DIV_ROUND_UP(MLX5E_KTLS_PROGRESS_WQE_SZ, MLX5_SEND_WQE_BB))
d8f823
-#define MLX5E_KTLS_MAX_DUMP_WQEBBS 2
d8f823
+
d8f823
+struct mlx5e_dump_wqe {
d8f823
+	struct mlx5_wqe_ctrl_seg ctrl;
d8f823
+	struct mlx5_wqe_data_seg data;
d8f823
+};
d8f823
+
d8f823
+#define MLX5E_KTLS_DUMP_WQEBBS \
d8f823
+	(DIV_ROUND_UP(sizeof(struct mlx5e_dump_wqe), MLX5_SEND_WQE_BB))
d8f823
 
d8f823
 enum {
d8f823
 	MLX5E_TLS_PROGRESS_PARAMS_AUTH_STATE_NO_OFFLOAD     = 0,
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
d8f823
index 90c6ce530a18..ac54767b7d86 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
d8f823
@@ -250,11 +250,6 @@ tx_post_resync_params(struct mlx5e_txqsq *sq,
d8f823
 	mlx5e_ktls_tx_post_param_wqes(sq, priv_tx, skip_static_post, true);
d8f823
 }
d8f823
 
d8f823
-struct mlx5e_dump_wqe {
d8f823
-	struct mlx5_wqe_ctrl_seg ctrl;
d8f823
-	struct mlx5_wqe_data_seg data;
d8f823
-};
d8f823
-
d8f823
 static int
d8f823
 tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool first)
d8f823
 {
d8f823
@@ -262,7 +257,6 @@ tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool fir
d8f823
 	struct mlx5_wqe_data_seg *dseg;
d8f823
 	struct mlx5e_dump_wqe *wqe;
d8f823
 	dma_addr_t dma_addr = 0;
d8f823
-	u8  num_wqebbs;
d8f823
 	u16 ds_cnt;
d8f823
 	int fsz;
d8f823
 	u16 pi;
d8f823
@@ -270,7 +264,6 @@ tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool fir
d8f823
 	wqe = mlx5e_sq_fetch_wqe(sq, sizeof(*wqe), &pi);
d8f823
 
d8f823
 	ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS;
d8f823
-	num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
d8f823
 
d8f823
 	cseg = &wqe->ctrl;
d8f823
 	dseg = &wqe->data;
d8f823
@@ -291,12 +284,8 @@ tx_post_resync_dump(struct mlx5e_txqsq *sq, skb_frag_t *frag, u32 tisn, bool fir
d8f823
 	dseg->byte_count = cpu_to_be32(fsz);
d8f823
 	mlx5e_dma_push(sq, dma_addr, fsz, MLX5E_DMA_MAP_PAGE);
d8f823
 
d8f823
-	tx_fill_wi(sq, pi, num_wqebbs, frag, fsz);
d8f823
-	sq->pc += num_wqebbs;
d8f823
-
d8f823
-	WARN(num_wqebbs > MLX5E_KTLS_MAX_DUMP_WQEBBS,
d8f823
-	     "unexpected DUMP num_wqebbs, %d > %d",
d8f823
-	     num_wqebbs, MLX5E_KTLS_MAX_DUMP_WQEBBS);
d8f823
+	tx_fill_wi(sq, pi, MLX5E_KTLS_DUMP_WQEBBS, frag, fsz);
d8f823
+	sq->pc += MLX5E_KTLS_DUMP_WQEBBS;
d8f823
 
d8f823
 	return 0;
d8f823
 }
d8f823
@@ -368,7 +357,7 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
d8f823
 	stats->tls_ooo++;
d8f823
 
d8f823
 	num_wqebbs = MLX5E_KTLS_STATIC_WQEBBS + MLX5E_KTLS_PROGRESS_WQEBBS +
d8f823
-		(info.nr_frags ? info.nr_frags * MLX5E_KTLS_MAX_DUMP_WQEBBS : 1);
d8f823
+		(info.nr_frags ? info.nr_frags * MLX5E_KTLS_DUMP_WQEBBS : 1);
d8f823
 	pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
d8f823
 	contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi);
d8f823
 	if (unlikely(contig_wqebbs_room < num_wqebbs))
d8f823
-- 
d8f823
2.13.6
d8f823