netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: <netdev@vger.kernel.org>, Saeed Mahameed <saeedm@nvidia.com>,
	Gal Pressman <gal@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Dragos Tatulea <dtatulea@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>
Subject: [PATCH net-next V2 02/14] net/mlx5e: SHAMPO, Fix incorrect page release
Date: Tue, 4 Jun 2024 00:22:07 +0300	[thread overview]
Message-ID: <20240603212219.1037656-3-tariqt@nvidia.com> (raw)
In-Reply-To: <20240603212219.1037656-1-tariqt@nvidia.com>

From: Dragos Tatulea <dtatulea@nvidia.com>

Under the following conditions:
1) No skb created yet
2) header_size == 0 (no SHAMPO header)
3) header_index + 1 % MLX5E_SHAMPO_WQ_HEADER_PER_PAGE == 0 (this is the
   last page fragment of a SHAMPO header page)

a new skb is formed with a page that is NOT a SHAMPO header page (it
is a regular data page). Further down in the same function
(mlx5e_handle_rx_cqe_mpwrq_shampo()), a SHAMPO header page from
header_index is released. This is wrong and it leads to SHAMPO header
pages being released more than once.

Fixes: 6f5742846053 ("net/mlx5e: RX, Enable skb page recycling through the page_pool")
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 369d101bf03c..1ddfa00f923f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -2369,7 +2369,8 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq
 	if (flush)
 		mlx5e_shampo_flush_skb(rq, cqe, match);
 free_hd_entry:
-	mlx5e_free_rx_shampo_hd_entry(rq, header_index);
+	if (likely(head_size))
+		mlx5e_free_rx_shampo_hd_entry(rq, header_index);
 mpwrq_cqe_out:
 	if (likely(wi->consumed_strides < rq->mpwqe.num_strides))
 		return;
-- 
2.44.0


  parent reply	other threads:[~2024-06-03 21:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 21:22 [PATCH net-next V2 00/14] net/mlx5e: SHAMPO, Enable HW GRO once more Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 01/14] net/mlx5e: SHAMPO, Use net_prefetch API Tariq Toukan
2024-06-03 21:22 ` Tariq Toukan [this message]
2024-06-06  3:20   ` [PATCH net-next V2 02/14] net/mlx5e: SHAMPO, Fix incorrect page release Jakub Kicinski
2024-06-06  5:32     ` Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 03/14] net/mlx5e: SHAMPO, Fix invalid WQ linked list unlink Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 04/14] net/mlx5e: SHAMPO, Fix FCS config when HW GRO on Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 05/14] net/mlx5e: SHAMPO, Disable gso_size for non GRO packets Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 06/14] net/mlx5e: SHAMPO, Simplify header page release in teardown Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 07/14] net/mlx5e: SHAMPO, Specialize mlx5e_fill_skb_data() Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 08/14] net/mlx5e: SHAMPO, Skipping on duplicate flush of the same SHAMPO SKB Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 09/14] net/mlx5e: SHAMPO, Make GRO counters more precise Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 10/14] net/mlx5e: SHAMPO, Drop rx_gro_match_packets counter Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 11/14] net/mlx5e: SHAMPO, Add header-only ethtool counters for header data split Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 12/14] net/mlx5e: SHAMPO, Use KSMs instead of KLMs Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 13/14] net/mlx5e: SHAMPO, Re-enable HW-GRO Tariq Toukan
2024-06-03 21:22 ` [PATCH net-next V2 14/14] net/mlx5e: SHAMPO, Coalesce skb fragments to page size Tariq Toukan
2024-06-06  3:30 ` [PATCH net-next V2 00/14] net/mlx5e: SHAMPO, Enable HW GRO once more patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240603212219.1037656-3-tariqt@nvidia.com \
    --to=tariqt@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).