linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Maxim Mikityanskiy <maximmi@nvidia.com>,
	Aya Levin <ayal@nvidia.com>, Eran Ben Elisha <eranbe@nvidia.com>,
	Vladyslav Tarasiuk <vladyslavt@nvidia.com>,
	Jonathan Lemon <jonathan.lemon@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] mlx5: allow larger xsk chunk_size
Date: Thu, 14 Oct 2021 10:32:36 +0300	[thread overview]
Message-ID: <328f581e-7f1d-efc3-036c-66e729297e9c@gmail.com> (raw)
In-Reply-To: <20211013150232.2942146-1-arnd@kernel.org>



On 10/13/2021 6:02 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When building with 64KB pages, clang points out that xsk->chunk_size
> can never be PAGE_SIZE:
> 
> drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:19:22: error: result of comparison of constant 65536 with expression of type 'u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>          if (xsk->chunk_size > PAGE_SIZE ||
>              ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
> 
> I'm not familiar with the details of this code, but from a quick look
> I found that it gets assigned from a 32-bit variable that can be
> PAGE_SIZE, and that the layout of 'xsk' is not part of an ABI or
> a hardware structure, so extending the members to 32 bits as well
> should address both the behavior on 64KB page kernels, and the
> warning I saw.
> 
> In older versions of this code, using PAGE_SIZE was the only
> possibility, so this would have never worked on 64KB page kernels,
> but the patch apparently did not address this case completely.
> 
> Fixes: 282c0c798f8e ("net/mlx5e: Allow XSK frames smaller than a page")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en/params.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.h b/drivers/net/ethernet/mellanox/mlx5/core/en/params.h
> index 879ad46d754e..b4167350b6df 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.h
> @@ -7,8 +7,8 @@
>   #include "en.h"
>   
>   struct mlx5e_xsk_param {
> -	u16 headroom;
> -	u16 chunk_size;
> +	u32 headroom;
> +	u32 chunk_size;

Hi Arnd,

I agree with your arguments about chunk_size.
Yet I have mixed feelings about extending the headroom. Predating 
in-driver code uses u16 for headroom (i.e. [1]), while 
xsk_pool_get_headroom returns u32.

[1] drivers/net/ethernet/mellanox/mlx5/core/en/params.c :: 
mlx5e_get_linear_rq_headroom

As this patch is a fix, let's keep it minimal, only addressing the issue 
described in title and description.
We might want to move headroom to u32 all around the driver in a 
separate patch to -next.

>   };
>   
>   struct mlx5e_lro_param {
> 

  reply	other threads:[~2021-10-14  7:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 15:02 [PATCH] mlx5: allow larger xsk chunk_size Arnd Bergmann
2021-10-14  7:32 ` Tariq Toukan [this message]
2021-10-15 13:27   ` Maxim Mikityanskiy
2021-10-15 15:16     ` Arnd Bergmann

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=328f581e-7f1d-efc3-036c-66e729297e9c@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=ayal@nvidia.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eranbe@nvidia.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=maximmi@nvidia.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=vladyslavt@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).