Skip to content

Commit 4b5bdab

Browse files
WeiFang-NXPkuba-moo
authored andcommitted
net: enetc: fix build warning when PAGE_SIZE is greater than 128K
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 <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: e59bc32 ("net: enetc: correct the value of ENETC_RXB_TRUESIZE") Signed-off-by: Wei Fang <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 804809a commit 4b5bdab

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • drivers/net/ethernet/freescale/enetc

drivers/net/ethernet/freescale/enetc/enetc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ struct enetc_lso_t {
7979
#define ENETC_RXB_TRUESIZE (PAGE_SIZE >> 1)
8080
#define ENETC_RXB_PAD NET_SKB_PAD /* add extra space if needed */
8181
#define ENETC_RXB_DMA_SIZE \
82-
(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD)
82+
min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD, 0xffff)
8383
#define ENETC_RXB_DMA_SIZE_XDP \
84-
(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM)
84+
min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM, 0xffff)
8585

8686
struct enetc_rx_swbd {
8787
dma_addr_t dma;

0 commit comments

Comments
 (0)