Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp479226lqh; Thu, 28 Mar 2024 07:34:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmg5OFYGRe+A6mtCl1RVreN2pYIzcY1VYniT0dFR6k2+lQf8fqqCLhGu6FhIhe6ZPdTsikOSp8geydU5/FG8D9wSaJazz2RctKJl6pBA== X-Google-Smtp-Source: AGHT+IGZDVocpjmGwJN36mTa9cdn8IBrCOVGMiXMrgS4LSv64UAKn3VT0ueVgmxkyk4aKpVD3Fol X-Received: by 2002:ae9:f30a:0:b0:78a:3348:fdb7 with SMTP id p10-20020ae9f30a000000b0078a3348fdb7mr2502338qkg.78.1711636467058; Thu, 28 Mar 2024 07:34:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711636467; cv=pass; d=google.com; s=arc-20160816; b=HfUa6TmCXZIiz/Cfl1jo+jwrfKdg+eBe+KQfqlj4+xTDPq/cvnvE+mpBYx7gJl/tbW +9PQM78tpHS2iJ4rOcS5B1/3AyB5nS55KQ59t7EUdh6+aTflSehIsU177FMDEO3dHEBZ 8KIQCZoD+NDbFblnrHjQ2O+ZCoBzR6crTV0PqPIvVl97T1YE5EUiG7VgRTHrcLNgDNxQ SVZtC5A5mHwqzd0xfCeN7n/g25RtudCFmIvwwAq5Xgcmz/i+ZriMCvOD+jcxlW6yzw4M eLvOU10D61eb2Gkh3q/FqrCyagmONuLxoRSvCbvnk35vjz7hBsc9lTxcSnURtR9vvsSQ A+fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=adibW7wv4vbgdHga3BvSsK+6QAIwincVai1Z22rl+90=; fh=DaBLV5ZYKWEbjp2XTD+f8k3m2hZiW0sxJ2hIwquYCmA=; b=kUfQhBgSgcjvUIAmMv0yBSQuYUGeJAUZ1nGjNOOrtTG/Ja8nbq58l+2zyuoiYjZO4P D9wI3/IPu5yua/r/7BiXLs7t82JxPgxuV05dOnhX3kbARlQhqSk9OFqVSqEkTvCYApRR SzedzdemnWCt1HcNLvV/rpUvoaVMU0thh/eo4rTD56dA7dd9nyD5N1qF3ru+PbqljqYC 4V2MD+cvhEvnkzsft5AtJXcYJDFeyLumAiRuoKYMvPmDAMDKRLEEynYUovB7WZIfZS2+ nHIvSdKZLNkgXkjieJOt1ognNZLai5pEUs2Eo2DXlop0GRzBfEYG2uOj7Pnv1xfcLc27 kdnA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rwlsvkhH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123082-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b16-20020a05620a04f000b0078a5e326d61si1560567qkh.681.2024.03.28.07.34.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 07:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rwlsvkhH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123082-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123082-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C12241C2CC99 for ; Thu, 28 Mar 2024 14:34:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E65D131721; Thu, 28 Mar 2024 14:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rwlsvkhH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F9B712BEA0; Thu, 28 Mar 2024 14:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636336; cv=none; b=r6jlSDlIp2kjm3+3yyYrk5/Kfj30PKkooy1wya/QS20+16jt8vfjedyH7VWaJpfQoVv3g7COtmnvmTfDX0qMYUakvL5LbiZUdaykOdPWrNdWxOwlM6C89qrBwTAXSixSWTbCXZM9Pe35DsBeItRa91KyIz6l8ZSuar3xvCfKVCo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636336; c=relaxed/simple; bh=oOMLQx+gPaXHH5Tk6o+DNZIrvqEEtpFNuWMdgsGdvoY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R2V28Mqe7RAhA0iJzGNNSU4GZEsZRo0w7C0YVELohycv94O7Scvj5KAXj9p0VoatgeNpat9PDsJdAEQABWRonMJUTgl0j6KGbsO3iazTruqC1wwTXAI8Jtv0nV6ZQTUd7/uvWQ8sfGAvTaYTuNoIcJa1kAcs7XFy6Kps1Cy/MNA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rwlsvkhH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CBF9C433C7; Thu, 28 Mar 2024 14:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636336; bh=oOMLQx+gPaXHH5Tk6o+DNZIrvqEEtpFNuWMdgsGdvoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwlsvkhHCsWSQWHVw/27w1M7pS1Z3C3fvOkjQZto5XbtiZvBzheadtKt4qSt9CO53 BRkZ1E9up6qBgTfor+rcxdIc0tpi08tqJfhHIhvDMK2F9Uzd/A44Xm5N1CZ4AtzNOw M31LEk8eYkBTzX6NzeKe8UsHOGHu8oSP48s0psUqL7RdUe32N+QrfOvA+wzOxn/z6x bGGtaUBNb3NdDlOlch3dTNKM8l8KiK4VVMjjnnVnLeXTYPetOdxgDP5WwxSLNecWsh TLngdvzP4KMTHREfE0HPuRvpbwwU8jiF0Jk67qcQrAliZbIH+7w3RMZduND8EqkBUz V3dj+E+ST0j6w== From: Arnd Bergmann To: 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 Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Tariq Toukan , Gal Pressman , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 8/9] mlx5: stop warning for 64KB pages Date: Thu, 28 Mar 2024 15:30:46 +0100 Message-Id: <20240328143051.1069575-9-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann 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 || ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~ 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@app.fastmail.com/ Signed-off-by: Arnd Bergmann --- 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/drivers/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 *params, 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_XSK_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 < MLX5E_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