public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: enetc: fix build warning when PAGE_SIZE is greater than 128K
@ 2026-01-07  9:12 Wei Fang
  2026-01-07 14:33 ` Frank Li
  2026-01-08 16:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Fang @ 2026-01-07  9:12 UTC (permalink / raw)
  To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
	davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, imx

The max buffer size of ENETC RX BD is 0xFFFF bytes, so if the PAGE_SIZE
is greater than 128K, ENETC_RXB_DMA_SIZE and ENETC_RXB_DMA_SIZE_XDP will
be greater than 0xFFFF, thus causing a build warning.

This will not cause any practical issues because ENETC is currently only
used on the ARM64 platform, and the max PAGE_SIZE is 64K. So this patch
is only for fixing the build warning that occurs when compiling ENETC
drivers for other platforms.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601050637.kHEKKOG7-lkp@intel.com/
Fixes: e59bc32df2e9 ("net: enetc: correct the value of ENETC_RXB_TRUESIZE")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
index dce27bd67a7d..aecd40aeef9c 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc.h
@@ -79,9 +79,9 @@ struct enetc_lso_t {
 #define ENETC_RXB_TRUESIZE	(PAGE_SIZE >> 1)
 #define ENETC_RXB_PAD		NET_SKB_PAD /* add extra space if needed */
 #define ENETC_RXB_DMA_SIZE	\
-	(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD)
+	min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD, 0xffff)
 #define ENETC_RXB_DMA_SIZE_XDP	\
-	(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM)
+	min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM, 0xffff)
 
 struct enetc_rx_swbd {
 	dma_addr_t dma;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: enetc: fix build warning when PAGE_SIZE is greater than 128K
  2026-01-07  9:12 [PATCH net] net: enetc: fix build warning when PAGE_SIZE is greater than 128K Wei Fang
@ 2026-01-07 14:33 ` Frank Li
  2026-01-08 16:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-01-07 14:33 UTC (permalink / raw)
  To: Wei Fang
  Cc: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
	davem, edumazet, kuba, pabeni, netdev, linux-kernel, imx

On Wed, Jan 07, 2026 at 05:12:04PM +0800, Wei Fang wrote:
> The max buffer size of ENETC RX BD is 0xFFFF bytes, so if the PAGE_SIZE
> is greater than 128K, ENETC_RXB_DMA_SIZE and ENETC_RXB_DMA_SIZE_XDP will
> be greater than 0xFFFF, thus causing a build warning.
>
> This will not cause any practical issues because ENETC is currently only
> used on the ARM64 platform, and the max PAGE_SIZE is 64K. So this patch
> is only for fixing the build warning that occurs when compiling ENETC
> drivers for other platforms.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202601050637.kHEKKOG7-lkp@intel.com/
> Fixes: e59bc32df2e9 ("net: enetc: correct the value of ENETC_RXB_TRUESIZE")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/net/ethernet/freescale/enetc/enetc.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
> index dce27bd67a7d..aecd40aeef9c 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.h
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.h
> @@ -79,9 +79,9 @@ struct enetc_lso_t {
>  #define ENETC_RXB_TRUESIZE	(PAGE_SIZE >> 1)
>  #define ENETC_RXB_PAD		NET_SKB_PAD /* add extra space if needed */
>  #define ENETC_RXB_DMA_SIZE	\
> -	(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD)
> +	min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD, 0xffff)
>  #define ENETC_RXB_DMA_SIZE_XDP	\
> -	(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM)
> +	min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM, 0xffff)
>
>  struct enetc_rx_swbd {
>  	dma_addr_t dma;
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: enetc: fix build warning when PAGE_SIZE is greater than 128K
  2026-01-07  9:12 [PATCH net] net: enetc: fix build warning when PAGE_SIZE is greater than 128K Wei Fang
  2026-01-07 14:33 ` Frank Li
@ 2026-01-08 16:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-08 16:50 UTC (permalink / raw)
  To: Wei Fang
  Cc: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
	davem, edumazet, kuba, pabeni, netdev, linux-kernel, imx

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  7 Jan 2026 17:12:04 +0800 you wrote:
> The max buffer size of ENETC RX BD is 0xFFFF bytes, so if the PAGE_SIZE
> is greater than 128K, ENETC_RXB_DMA_SIZE and ENETC_RXB_DMA_SIZE_XDP will
> be greater than 0xFFFF, thus causing a build warning.
> 
> This will not cause any practical issues because ENETC is currently only
> used on the ARM64 platform, and the max PAGE_SIZE is 64K. So this patch
> is only for fixing the build warning that occurs when compiling ENETC
> drivers for other platforms.
> 
> [...]

Here is the summary with links:
  - [net] net: enetc: fix build warning when PAGE_SIZE is greater than 128K
    https://git.kernel.org/netdev/net/c/4b5bdabb5449

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-08 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07  9:12 [PATCH net] net: enetc: fix build warning when PAGE_SIZE is greater than 128K Wei Fang
2026-01-07 14:33 ` Frank Li
2026-01-08 16:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox