netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Maxim Mikityanskiy <maxtram95@gmail.com>,
	netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Gal Pressman <gal@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>
Subject: Re: [PATCH net 1/2] net/mlx5e: XDP, Allow growing tail for XDP multi buffer
Date: Thu, 26 Jan 2023 22:41:30 +0200	[thread overview]
Message-ID: <25a72690-6cae-bc7b-b30c-a0ece4fa0393@gmail.com> (raw)
In-Reply-To: <20230126191050.220610-2-maxtram95@gmail.com>



On 26/01/2023 21:10, Maxim Mikityanskiy wrote:
> The cited commits missed passing frag_size to __xdp_rxq_info_reg, which
> is required by bpf_xdp_adjust_tail to support growing the tail pointer
> in fragmented packets. Pass the missing parameter when the current RQ
> mode allows XDP multi buffer.
> 
> Fixes: ea5d49bdae8b ("net/mlx5e: Add XDP multi buffer support to the non-linear legacy RQ")
> Fixes: 9cb9482ef10e ("net/mlx5e: Use fragments of the same size in non-linear legacy RQ with XDP")
> Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
> Cc: Tariq Toukan <tariqt@nvidia.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index abcc614b6191..cdd1e47e18f9 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -576,9 +576,10 @@ static void mlx5e_free_mpwqe_rq_drop_page(struct mlx5e_rq *rq)
>   }
>   
>   static int mlx5e_init_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *params,
> -			     struct mlx5e_rq *rq)
> +			     struct mlx5e_rq_param *rq_params, struct mlx5e_rq *rq)
>   {
>   	struct mlx5_core_dev *mdev = c->mdev;
> +	u32 xdp_frag_size = 0;
>   	int err;
>   
>   	rq->wq_type      = params->rq_wq_type;
> @@ -599,7 +600,11 @@ static int mlx5e_init_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *param
>   	if (err)
>   		return err;
>   
> -	return xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq->ix, c->napi.napi_id);
> +	if (rq->wq_type == MLX5_WQ_TYPE_CYCLIC && rq_params->frags_info.num_frags > 1)

How about a more generic check? like:
if (params->xdp_prog && params->xdp_prog->aux->xdp_has_frags)

So we won't have to maintain this when Stridng RQ support is added.

> +		xdp_frag_size = rq_params->frags_info.arr[1].frag_stride;

Again, in order to not maintain this (frags_info.arr[1].frag_stride not 
relevant for Striding RQ), isn't the value always PAGE_SIZE?

Another idea is to introduce something like
#define XDP_MB_FRAG_SZ (PAGE_SIZE)
use it here and in mlx5e_build_rq_frags_info ::
if (byte_count > max_mtu || params->xdp_prog) {
	frag_size_max = XDP_MB_FRAG_SZ;
Not sure it's worth it...

Both ways we save passing rq_params in the callstack.

> +
> +	return __xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq->ix, c->napi.napi_id,
> +				  xdp_frag_size);
>   }
>   
>   static int mlx5_rq_shampo_alloc(struct mlx5_core_dev *mdev,
> @@ -2214,7 +2219,7 @@ static int mlx5e_open_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *param
>   {
>   	int err;
>   
> -	err = mlx5e_init_rxq_rq(c, params, &c->rq);
> +	err = mlx5e_init_rxq_rq(c, params, rq_params, &c->rq);
>   	if (err)
>   		return err;
>   

  reply	other threads:[~2023-01-26 20:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 19:10 [PATCH net 0/2] xdp_rxq_info_reg fixes for mlx5e Maxim Mikityanskiy
2023-01-26 19:10 ` [PATCH net 1/2] net/mlx5e: XDP, Allow growing tail for XDP multi buffer Maxim Mikityanskiy
2023-01-26 20:41   ` Tariq Toukan [this message]
2023-01-26 22:43     ` Maxim Mikityanskiy
2023-01-29 10:04       ` Tariq Toukan
2023-01-26 19:10 ` [PATCH net 2/2] net/mlx5e: xsk: Set napi_id to support busy polling on XSK RQ Maxim Mikityanskiy
2023-01-26 20:43   ` 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=25a72690-6cae-bc7b-b30c-a0ece4fa0393@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=maxtram95@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).