Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp744624lqh; Thu, 28 Mar 2024 15:20:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3Ur6UdUgaGKjnVanezVy3i24/+nYAEh7hpJGaTiEtXpBCaXELixVzG5YGzhdbKtvR5c8FlIPuugSqFKISk81fc0Jfh6oMOIy+bb2lww== X-Google-Smtp-Source: AGHT+IEv4hoI6fomArHa9obBfFrteL8t2U+bNdm3TUinCRH0BoYE9sjUvdONlf8y43JDDnhdFsK/ X-Received: by 2002:a17:906:1d45:b0:a4e:95d:6551 with SMTP id o5-20020a1709061d4500b00a4e095d6551mr339844ejh.1.1711664442627; Thu, 28 Mar 2024 15:20:42 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dk25-20020a170906f0d900b00a474896c2afsi1095351ejb.629.2024.03.28.15.20.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 15:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123760-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20230601 header.b=ZDZEVmNh; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-123760-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123760-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=REJECT dis=REJECT) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 365DB1F26CC2 for ; Thu, 28 Mar 2024 22:20:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BC3E13D61A; Thu, 28 Mar 2024 22:09:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="ZDZEVmNh" Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EF8F13A875 for ; Thu, 28 Mar 2024 22:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711663787; cv=none; b=daq8p6WeSnv2lDprdzKeYY6ovlCavHublmNURVo2lupWltnJ+AYFdRkd57S9aHXvrWbp9IUn4vg+UGLjMsx3pRhWex2PtdsD9snisEsa2ksTSAVsYRuGJXfggu1HmizxRvB/9VbkRAimbrzDQrMjnlSThRYfbdKyMxy88HoXvw4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711663787; c=relaxed/simple; bh=BOXlsNwnprUececioCWqQEsiqvtUYISmlVnkC/Wl+j8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=FYG7qkAXIasglCyWzUs+0yyvT5lFp7+MNYOXvD7SDzSwsHgPfGyd2np2jsM8afx4JW2Cdf2sCSASi2eRZxgEF/NFS0PkW9OrydOUc7p/bVBWOEYNrHeYnOfK/JJxPjeWsSrObXs482Y1iaxTKEt5k1AwtNx/YZRCQZRr3tlgjnA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZDZEVmNh; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-56bb22ff7baso1642899a12.3 for ; Thu, 28 Mar 2024 15:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711663784; x=1712268584; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=D+7Drz3KCpZvZH2UsNch2VNXZc69VVimkJhVMnXEUEw=; b=ZDZEVmNhwPHhD5UzejDM3aaPGVPKxmhcexqbZUzE/vP+5zSqALHbf1/vqt+Et4n3ED H5fwD6Le23S9LvTh4QCtvP8gV1mAVHYP7fcsYmCSGHZt3JYqsjQV3I4gxcrSzZcVxsUi i7I41x1BGWD4I3JAUmiZAhbWv2ZfNRiOXjDfs1Yvl+Zi72gfs4yqF8T3IohNOg6QzVsc MMwAeBCU+JBM+qVP9WOV+HAcqiDE4v7KB4hlnZ0IIM18u0wEmSP3eHZpL6wzvsY1Es6X mpkuwr8nUpm0vPtIEfKTEur4gkovWgsQbpqvqS2Yzs2viDAp1RFUAKsCXhWr0Zaw1oX/ 3NSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711663784; x=1712268584; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D+7Drz3KCpZvZH2UsNch2VNXZc69VVimkJhVMnXEUEw=; b=jmxxfKUYo/wJhuH6RpQSyLkl7BeeHkFOF3CyfYd8SbZFIbnCnPgzMsZU1xYNU5JmUf D8zdfpNnH4SkGAazttL8dRV8U5xeQFIRKd0o4aT19vDDAAvDLl3v9hsfmfIllyIgHyK0 JMXMHHhXsR1WAeKwAr3j/XhIWn2hxRWIWA07mEEcrqxj5ipuSi6eVl2HVqFJgAJBRjK1 daPlEb/OxVXIdPVlvZwn882usdPilk3I7uLzkclJzBgu3jA35CRSE6SXbNzU7K8luiT5 mkIX1BiWoMEl3BOoeI166j7dAdUyXdTl78K0vtafJtF/Adzrw8/RRwaUputW5Ey/HVs8 HX2w== X-Gm-Message-State: AOJu0YxqaZToaQEk9sXdb/PQewZi9bkeAK7XeG6sLkjH/NmSCVAmNhUz FBG8IFmGiSwePWOrdwtzFfo5cS455MaFy24fuuCK0B5YsxpW1srCO98A61oq2uFk7454oNcxwTW zcIXoniujq/xvhaJCpvmUrkH3LlkjbsgaLzLt X-Received: by 2002:a50:931d:0:b0:564:f6d5:f291 with SMTP id m29-20020a50931d000000b00564f6d5f291mr308024eda.34.1711663783904; Thu, 28 Mar 2024 15:09:43 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240328143051.1069575-1-arnd@kernel.org> <20240328143051.1069575-9-arnd@kernel.org> In-Reply-To: <20240328143051.1069575-9-arnd@kernel.org> From: Justin Stitt Date: Thu, 28 Mar 2024 15:09:30 -0700 Message-ID: Subject: Re: [PATCH 8/9] mlx5: stop warning for 64KB pages To: Arnd Bergmann Cc: linux-kernel@vger.kernel.org, Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor , Jonathan Lemon , Maxim Mikityanskiy , Daniel Borkmann , Arnd Bergmann , Nick Desaulniers , Bill Wendling , Tariq Toukan , Gal Pressman , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 28, 2024 at 7:32=E2=80=AFAM Arnd Bergmann wro= te: > > From: Arnd Bergmann > > When building with 64KB pages, clang points out that xsk->chunk_size > can never be PAGE_SIZE: This is under W=3D1 right? Otherwise this is a mighty annoying warning. > > drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:19:22: error: resu= lt of comparison of constant 65536 with expression of type 'u16' (aka 'unsi= gned short') is always false [-Werror,-Wtautological-constant-out-of-range-= compare] > if (xsk->chunk_size > PAGE_SIZE || > ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~ > > 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. > > As Maxim Mikityanskiy suggested, 64KB chunks are really not all that > useful, so just shut up the warning by adding a cast. > > Fixes: 282c0c798f8e ("net/mlx5e: Allow XSK frames smaller than a page") > Link: https://lore.kernel.org/netdev/20211013150232.2942146-1-arnd@kernel= org/ > Link: https://lore.kernel.org/lkml/a7b27541-0ebb-4f2d-bd06-270a4d404613@a= pp.fastmail.com/ > Signed-off-by: Arnd Bergmann Reviewed-by: Justin Stitt > --- > drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/dri= vers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c > index 06592b9f0424..9240cfe25d10 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c > @@ -28,8 +28,10 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *par= ams, > struct mlx5e_xsk_param *xsk, > struct mlx5_core_dev *mdev) > { > - /* AF_XDP doesn't support frames larger than PAGE_SIZE. */ > - if (xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XS= K_CHUNK_SIZE) { > + /* AF_XDP doesn't support frames larger than PAGE_SIZE, > + * and xsk->chunk_size is limited to 65535 bytes. > + */ > + if ((size_t)xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5= E_MIN_XSK_CHUNK_SIZE) { > mlx5_core_err(mdev, "XSK chunk size %u out of bounds [%u,= %lu]\n", xsk->chunk_size, > MLX5E_MIN_XSK_CHUNK_SIZE, PAGE_SIZE); > return false; > -- > 2.39.2 >