Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: "Daniel Zahka" <daniel.zahka@gmail.com>
To: "Tariq Toukan" <tariqt@nvidia.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>, <netdev@vger.kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>
Cc: "Boris Pismenny" <borisp@nvidia.com>,
	"Cosmin Ratiu" <cratiu@nvidia.com>,
	"Daniel Zahka" <daniel.zahka@gmail.com>,
	"Dragos Tatulea" <dtatulea@nvidia.com>,
	"Gal Pressman" <gal@nvidia.com>,
	"Leon Romanovsky" <leon@kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	<linux-rdma@vger.kernel.org>, "Mark Bloch" <mbloch@nvidia.com>,
	"Raed Salem" <raeds@nvidia.com>,
	"Rahul Rameshbabu" <rrameshbabu@nvidia.com>,
	"Saeed Mahameed" <saeedm@nvidia.com>
Subject: Re: [PATCH net V2] net/mlx5e: SHAMPO: Do not merge PSP packets
Date: Wed, 21 Oct 2026 06:30:42 -0400	[thread overview]
Message-ID: <DMAG3G194BUB.JJKBBQWZCU5C@gmail.com> (raw)
In-Reply-To: <20261021062805.3466208-1-tariqt@nvidia.com>

On Wed Oct 21, 2026 at 2:28 AM EDT, Tariq Toukan wrote:
> From: Cosmin Ratiu <cratiu@nvidia.com>
>
> PSP packets are UDP-encapsulated, and enabling HW GRO (SHAMPO in mlx5)
> makes it possible to merge those packets in a silly way:
> IP|UDP|PSP1|payload1|PSP2|payload2|...
>
> That happens because the HW GRO machinery doesn't know about PSP and
> considers it part of the UDP payload.
>
> Reject merging when the incoming CQE has PSP marker or the pending skb
> has the PSP extension.
>
> Fixes: 29d7f433fcec ("net/mlx5e: Add Rx data path offload")
> Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
>  .../ethernet/mellanox/mlx5/core/en_accel/en_accel.h |  6 ++++++
>  .../ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h | 13 +++++++++++++
>  drivers/net/ethernet/mellanox/mlx5/core/en_rx.c     |  6 ++++--
>  3 files changed, 23 insertions(+), 2 deletions(-)
>
> V2:
> - Separated from the patchset.
> - Moved the PSP merge check into a helper in psp_rxtx.h, with a stub
>   returning true when CONFIG_MLX5_EN_PSP is off, and an en_accel.h
>   wrapper, replacing the #ifdef in en_rx.c.
> - Also reject merging when the pending skb already has the PSP
>   extension, not only when the incoming CQE has the PSP marker.
> - Fixed the commit message diagram and capitalized SHAMPO in the
>   subject.
>
> V1:
> https://lore.kernel.org/all/20260917175433.4090878-8-tariqt@nvidia.com/
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
> index 3f212e46fc2f..5a340f1435e6 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
> @@ -218,6 +218,12 @@ static inline void mlx5e_accel_tx_finish(struct mlx5e_txqsq *sq,
>  #endif
>  }
>  
> +static inline bool
> +mlx5e_accel_shampo_can_merge(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
> +{
> +	return mlx5e_psp_shampo_can_merge(rq->hw_gro_data->skb, cqe);
> +}
> +
>  static inline int mlx5e_accel_init_rx(struct mlx5e_priv *priv)
>  {
>  	return mlx5e_ktls_init_rx(priv);
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h
> index 2b080c39cc37..9fd1ee789de0 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h
> @@ -85,6 +85,13 @@ static inline bool mlx5e_psp_is_rx_flow(struct mlx5_cqe64 *cqe)
>  	return MLX5_PSP_METADATA_MARKER(be32_to_cpu(cqe->ft_metadata));
>  }
>  
> +static inline bool
> +mlx5e_psp_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
> +{
> +	/* PSP packets cannot be merged. */
> +	return !skb_ext_exist(skb, SKB_EXT_PSP) && !mlx5e_psp_is_rx_flow(cqe);
> +}
> +
>  bool mlx5e_psp_offload_handle_rx_skb(struct net_device *netdev, struct sk_buff *skb,
>  				     struct mlx5_cqe64 *cqe);
>  #else
> @@ -110,6 +117,12 @@ static inline bool mlx5e_psp_is_rx_flow(struct mlx5_cqe64 *cqe)
>  	return false;
>  }
>  
> +static inline bool
> +mlx5e_psp_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
> +{
> +	return true;
> +}
> +
>  static inline bool mlx5e_psp_offload_handle_rx_skb(struct net_device *netdev,
>  						   struct sk_buff *skb,
>  						   struct mlx5_cqe64 *cqe)
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> index 903af3b3e779..d49f26323b1e 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> @@ -49,6 +49,7 @@
>  #include "en_rep.h"
>  #include "en/rep/tc.h"
>  #include "ipoib/ipoib.h"
> +#include "en_accel/en_accel.h"
>  #include "en_accel/ipsec.h"
>  #include "en_accel/macsec.h"
>  #include "en_accel/psp_rxtx.h"
> @@ -2268,8 +2269,9 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq
>  	}
>  
>  	if (*skb &&
> -	    !(match && mlx5e_hw_gro_skb_has_enough_space(*skb, data_bcnt,
> -							 page_size))) {
> +	    !(match &&
> +	      mlx5e_hw_gro_skb_has_enough_space(*skb, data_bcnt, page_size) &&
> +	      mlx5e_accel_shampo_can_merge(rq, cqe))) {

nit: we already have the skb from the line above, why go back to the rq
just to find the same skb again?

>  		match = false;
>  		mlx5e_shampo_flush_skb(rq, cqe, match);
>  	}
>
> base-commit: b6ef0d965fe8ce0ee4b4dcb58b3511f83003e42d

Makes sense to me:

Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com>

  parent reply	other threads:[~2026-10-21 10:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  6:28 [PATCH net V2] net/mlx5e: SHAMPO: Do not merge PSP packets Tariq Toukan
2026-10-21  6:33 ` netdev-bot+sinfo
2026-10-21  6:44 ` sashiko-bot
2026-10-21 10:30 ` Daniel Zahka [this message]
2026-10-22 17:36   ` Tariq Toukan

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=DMAG3G194BUB.JJKBBQWZCU5C@gmail.com \
    --to=daniel.zahka@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=borisp@nvidia.com \
    --cc=cratiu@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@kernel.org \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=raeds@nvidia.com \
    --cc=rrameshbabu@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@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