[PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE

Wei Fang posted 1 patch 4 months ago
There is a newer version of this series
drivers/net/ethernet/freescale/enetc/enetc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
Posted by Wei Fang 4 months ago
ENETC_RXB_TRUESIZE indicates the size of half a page, but the page size
is adjustable, for ARM64 platform, the PAGE_SIZE can be 4K, 16K and 64K,
so a fixed value '2048' is not correct when the PAGE_SIZE is 16K or 64K.

Fixes: d4fd0404c1c9 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
index 0ec010a7d640..f279fa597991 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc.h
@@ -76,7 +76,7 @@ struct enetc_lso_t {
 #define ENETC_LSO_MAX_DATA_LEN		SZ_256K
 
 #define ENETC_RX_MAXFRM_SIZE	ENETC_MAC_MAXFRM_SIZE
-#define ENETC_RXB_TRUESIZE	2048 /* PAGE_SIZE >> 1 */
+#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)
-- 
2.34.1
Re: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
Posted by Jakub Kicinski 3 months, 3 weeks ago
On Fri, 10 Oct 2025 17:26:08 +0800 Wei Fang wrote:
> ENETC_RXB_TRUESIZE indicates the size of half a page, but the page size
> is adjustable, for ARM64 platform, the PAGE_SIZE can be 4K, 16K and 64K,
> so a fixed value '2048' is not correct when the PAGE_SIZE is 16K or 64K.

I'm expecting an updated commit msg here, so dropping v1 from pw
Re: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
Posted by Vladimir Oltean 4 months ago
On Fri, Oct 10, 2025 at 05:26:08PM +0800, Wei Fang wrote:
> ENETC_RXB_TRUESIZE indicates the size of half a page, but the page size
> is adjustable, for ARM64 platform, the PAGE_SIZE can be 4K, 16K and 64K,
> so a fixed value '2048' is not correct when the PAGE_SIZE is 16K or 64K.
> 
> Fixes: d4fd0404c1c9 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
>  drivers/net/ethernet/freescale/enetc/enetc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
> index 0ec010a7d640..f279fa597991 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.h
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.h
> @@ -76,7 +76,7 @@ struct enetc_lso_t {
>  #define ENETC_LSO_MAX_DATA_LEN		SZ_256K
>  
>  #define ENETC_RX_MAXFRM_SIZE	ENETC_MAC_MAXFRM_SIZE
> -#define ENETC_RXB_TRUESIZE	2048 /* PAGE_SIZE >> 1 */
> +#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)
> -- 
> 2.34.1
>

Is this a problem that needs to be fixed on stable kernels? What
behaviour is observed by the end user?
Re: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
Posted by Vladimir Oltean 4 months ago
On Fri, Oct 10, 2025 at 05:26:08PM +0800, Wei Fang wrote:
> ENETC_RXB_TRUESIZE indicates the size of half a page, but the page size
> is adjustable, for ARM64 platform, the PAGE_SIZE can be 4K, 16K and 64K,
> so a fixed value '2048' is not correct when the PAGE_SIZE is 16K or 64K.
> 
> Fixes: d4fd0404c1c9 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> ---
>  drivers/net/ethernet/freescale/enetc/enetc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
> index 0ec010a7d640..f279fa597991 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.h
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.h
> @@ -76,7 +76,7 @@ struct enetc_lso_t {
>  #define ENETC_LSO_MAX_DATA_LEN		SZ_256K
>  
>  #define ENETC_RX_MAXFRM_SIZE	ENETC_MAC_MAXFRM_SIZE
> -#define ENETC_RXB_TRUESIZE	2048 /* PAGE_SIZE >> 1 */
> +#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)
> -- 
> 2.34.1
>

I wonder why 2048 was preferred, even though PAGE_SIZE >> 1 was in a comment.
Claudiu, do you remember?