Blame SOURCES/0058-netdrv-net-mlx5e-kTLS-Save-only-the-frag-page-to-rel.patch

d8f823
From 48b3c320e5d5e9ca3cef28dbcef96f5a8dca4e7b Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Sun, 10 May 2020 14:52:33 -0400
d8f823
Subject: [PATCH 058/312] [netdrv] net/mlx5e: kTLS, Save only the frag page to
d8f823
 release at completion
d8f823
d8f823
Message-id: <20200510145245.10054-71-ahleihel@redhat.com>
d8f823
Patchwork-id: 306609
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789378 v2 70/82] net/mlx5e: kTLS, Save only the frag page to release at completion
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 f45da3716fb2fb09e301a1b6edf200ff343dc06e
d8f823
Author: Tariq Toukan <tariqt@mellanox.com>
d8f823
Date:   Wed Sep 18 13:50:32 2019 +0300
d8f823
d8f823
    net/mlx5e: kTLS, Save only the frag page to release at completion
d8f823
d8f823
    In TX resync flow where DUMP WQEs are posted, keep a pointer to
d8f823
    the fragment page to unref it upon completion, instead of saving
d8f823
    the whole fragment.
d8f823
d8f823
    In addition, move it the end of the arguments list in tx_fill_wi().
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.h       |  2 +-
d8f823
 .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 27 +++++++++++-----------
d8f823
 2 files changed, 14 insertions(+), 15 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 35cf78134737..25bf9f026641 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
@@ -344,7 +344,7 @@ struct mlx5e_tx_wqe_info {
d8f823
 	u8  num_wqebbs;
d8f823
 	u8  num_dma;
d8f823
 #ifdef CONFIG_MLX5_EN_TLS
d8f823
-	skb_frag_t *resync_dump_frag;
d8f823
+	struct page *resync_dump_frag_page;
d8f823
 #endif
d8f823
 };
d8f823
 
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 ac54767b7d86..6dfb22d705b2 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
@@ -108,16 +108,15 @@ build_progress_params(struct mlx5e_tx_wqe *wqe, u16 pc, u32 sqn,
d8f823
 }
d8f823
 
d8f823
 static void tx_fill_wi(struct mlx5e_txqsq *sq,
d8f823
-		       u16 pi, u8 num_wqebbs,
d8f823
-		       skb_frag_t *resync_dump_frag,
d8f823
-		       u32 num_bytes)
d8f823
+		       u16 pi, u8 num_wqebbs, u32 num_bytes,
d8f823
+		       struct page *page)
d8f823
 {
d8f823
 	struct mlx5e_tx_wqe_info *wi = &sq->db.wqe_info[pi];
d8f823
 
d8f823
-	wi->skb              = NULL;
d8f823
-	wi->num_wqebbs       = num_wqebbs;
d8f823
-	wi->resync_dump_frag = resync_dump_frag;
d8f823
-	wi->num_bytes        = num_bytes;
d8f823
+	memset(wi, 0, sizeof(*wi));
d8f823
+	wi->num_wqebbs = num_wqebbs;
d8f823
+	wi->num_bytes  = num_bytes;
d8f823
+	wi->resync_dump_frag_page = page;
d8f823
 }
d8f823
 
d8f823
 void mlx5e_ktls_tx_offload_set_pending(struct mlx5e_ktls_offload_context_tx *priv_tx)
d8f823
@@ -145,7 +144,7 @@ post_static_params(struct mlx5e_txqsq *sq,
d8f823
 
d8f823
 	umr_wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_STATIC_UMR_WQE_SZ, &pi);
d8f823
 	build_static_params(umr_wqe, sq->pc, sq->sqn, priv_tx, fence);
d8f823
-	tx_fill_wi(sq, pi, MLX5E_KTLS_STATIC_WQEBBS, NULL, 0);
d8f823
+	tx_fill_wi(sq, pi, MLX5E_KTLS_STATIC_WQEBBS, 0, NULL);
d8f823
 	sq->pc += MLX5E_KTLS_STATIC_WQEBBS;
d8f823
 }
d8f823
 
d8f823
@@ -159,7 +158,7 @@ post_progress_params(struct mlx5e_txqsq *sq,
d8f823
 
d8f823
 	wqe = mlx5e_sq_fetch_wqe(sq, MLX5E_KTLS_PROGRESS_WQE_SZ, &pi);
d8f823
 	build_progress_params(wqe, sq->pc, sq->sqn, priv_tx, fence);
d8f823
-	tx_fill_wi(sq, pi, MLX5E_KTLS_PROGRESS_WQEBBS, NULL, 0);
d8f823
+	tx_fill_wi(sq, pi, MLX5E_KTLS_PROGRESS_WQEBBS, 0, NULL);
d8f823
 	sq->pc += MLX5E_KTLS_PROGRESS_WQEBBS;
d8f823
 }
d8f823
 
d8f823
@@ -211,7 +210,7 @@ static bool tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
d8f823
 	while (remaining > 0) {
d8f823
 		skb_frag_t *frag = &record->frags[i];
d8f823
 
d8f823
-		__skb_frag_ref(frag);
d8f823
+		get_page(skb_frag_page(frag));
d8f823
 		remaining -= skb_frag_size(frag);
d8f823
 		info->frags[i++] = frag;
d8f823
 	}
d8f823
@@ -284,7 +283,7 @@ 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, MLX5E_KTLS_DUMP_WQEBBS, frag, fsz);
d8f823
+	tx_fill_wi(sq, pi, MLX5E_KTLS_DUMP_WQEBBS, fsz, skb_frag_page(frag));
d8f823
 	sq->pc += MLX5E_KTLS_DUMP_WQEBBS;
d8f823
 
d8f823
 	return 0;
d8f823
@@ -297,14 +296,14 @@ void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
d8f823
 	struct mlx5e_sq_stats *stats;
d8f823
 	struct mlx5e_sq_dma *dma;
d8f823
 
d8f823
-	if (!wi->resync_dump_frag)
d8f823
+	if (!wi->resync_dump_frag_page)
d8f823
 		return;
d8f823
 
d8f823
 	dma = mlx5e_dma_get(sq, (*dma_fifo_cc)++);
d8f823
 	stats = sq->stats;
d8f823
 
d8f823
 	mlx5e_tx_dma_unmap(sq->pdev, dma);
d8f823
-	__skb_frag_unref(wi->resync_dump_frag);
d8f823
+	put_page(wi->resync_dump_frag_page);
d8f823
 	stats->tls_dump_packets++;
d8f823
 	stats->tls_dump_bytes += wi->num_bytes;
d8f823
 }
d8f823
@@ -314,7 +313,7 @@ static void tx_post_fence_nop(struct mlx5e_txqsq *sq)
d8f823
 	struct mlx5_wq_cyc *wq = &sq->wq;
d8f823
 	u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
d8f823
 
d8f823
-	tx_fill_wi(sq, pi, 1, NULL, 0);
d8f823
+	tx_fill_wi(sq, pi, 1, 0, NULL);
d8f823
 
d8f823
 	mlx5e_post_nop_fence(wq, sq->sqn, &sq->pc);
d8f823
 }
d8f823
-- 
d8f823
2.13.6
d8f823