* [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
@ 2025-10-10 9:26 Wei Fang
2025-10-10 12:48 ` Vladimir Oltean
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Wei Fang @ 2025-10-10 9:26 UTC (permalink / raw)
To: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
davem, edumazet, kuba, pabeni, Frank.Li
Cc: imx, netdev, linux-kernel
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-10 9:26 [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE Wei Fang
@ 2025-10-10 12:48 ` Vladimir Oltean
2025-10-10 16:23 ` Claudiu Manoil
2025-10-10 12:49 ` Vladimir Oltean
2025-10-13 23:47 ` Jakub Kicinski
2 siblings, 1 reply; 9+ messages in thread
From: Vladimir Oltean @ 2025-10-10 12:48 UTC (permalink / raw)
To: Wei Fang, claudiu.manoil
Cc: xiaoning.wang, andrew+netdev, davem, edumazet, kuba, pabeni,
Frank.Li, imx, netdev, linux-kernel
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?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-10 9:26 [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE Wei Fang
2025-10-10 12:48 ` Vladimir Oltean
@ 2025-10-10 12:49 ` Vladimir Oltean
2025-10-10 13:32 ` Wei Fang
2025-10-13 23:47 ` Jakub Kicinski
2 siblings, 1 reply; 9+ messages in thread
From: Vladimir Oltean @ 2025-10-10 12:49 UTC (permalink / raw)
To: Wei Fang
Cc: claudiu.manoil, xiaoning.wang, andrew+netdev, davem, edumazet,
kuba, pabeni, Frank.Li, imx, netdev, linux-kernel
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?
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-10 12:49 ` Vladimir Oltean
@ 2025-10-10 13:32 ` Wei Fang
0 siblings, 0 replies; 9+ messages in thread
From: Wei Fang @ 2025-10-10 13:32 UTC (permalink / raw)
To: Vladimir Oltean
Cc: Claudiu Manoil, Clark Wang, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, Frank Li, imx@lists.linux.dev,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
> 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?
The issue should be invisible to users in most cases, but if users want
to increase PAGE_SIZE to use one buffer to receive one packet, it will
not work as expected. So, it is better to be fixed in stable kernels.
From the perspective of driver implementation, a page is divided into
two half pages for use, that is, one BD uses the first half, and another
BD uses the second half. But when the PAGE_SIZE is 16K or 64K, both
BDs use the first half. This is inconsistent with description in the relevant
kernel doc and commit message.
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-10 12:48 ` Vladimir Oltean
@ 2025-10-10 16:23 ` Claudiu Manoil
2025-10-14 2:20 ` Wei Fang
0 siblings, 1 reply; 9+ messages in thread
From: Claudiu Manoil @ 2025-10-10 16:23 UTC (permalink / raw)
To: Vladimir Oltean, Wei Fang
Cc: Clark Wang, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Frank Li,
imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> Sent: Friday, October 10, 2025 3:49 PM
> To: Wei Fang <wei.fang@nxp.com>; Claudiu Manoil
> <claudiu.manoil@nxp.com>
> Cc: Clark Wang <xiaoning.wang@nxp.com>; andrew+netdev@lunn.ch;
> davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; Frank Li <frank.li@nxp.com>; imx@lists.linux.dev;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
>
> 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?
Initial driver implementation for enetcv1 was bound to 4k pages, I need to recheck why and get back to you.
Regards,
Claudiu
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-10 9:26 [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE Wei Fang
2025-10-10 12:48 ` Vladimir Oltean
2025-10-10 12:49 ` Vladimir Oltean
@ 2025-10-13 23:47 ` Jakub Kicinski
2 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2025-10-13 23:47 UTC (permalink / raw)
To: Wei Fang
Cc: claudiu.manoil, vladimir.oltean, xiaoning.wang, andrew+netdev,
davem, edumazet, pabeni, Frank.Li, imx, netdev, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-10 16:23 ` Claudiu Manoil
@ 2025-10-14 2:20 ` Wei Fang
2025-10-14 9:32 ` Claudiu Manoil
0 siblings, 1 reply; 9+ messages in thread
From: Wei Fang @ 2025-10-14 2:20 UTC (permalink / raw)
To: Claudiu Manoil, Vladimir Oltean
Cc: Clark Wang, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Frank Li,
imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Best Regards,
Wei Fang
> -----Original Message-----
> From: Claudiu Manoil <claudiu.manoil@nxp.com>
> Sent: 2025年10月11日 0:24
> To: Vladimir Oltean <vladimir.oltean@nxp.com>; Wei Fang <wei.fang@nxp.com>
> Cc: Clark Wang <xiaoning.wang@nxp.com>; andrew+netdev@lunn.ch;
> davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; Frank Li <frank.li@nxp.com>; imx@lists.linux.dev;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
>
>
>
> > -----Original Message-----
> > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> > Sent: Friday, October 10, 2025 3:49 PM
> > To: Wei Fang <wei.fang@nxp.com>; Claudiu Manoil
> > <claudiu.manoil@nxp.com>
> > Cc: Clark Wang <xiaoning.wang@nxp.com>; andrew+netdev@lunn.ch;
> > davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > pabeni@redhat.com; Frank Li <frank.li@nxp.com>; imx@lists.linux.dev;
> > netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH net] net: enetc: correct the value of
> ENETC_RXB_TRUESIZE
> >
> > 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?
>
> Initial driver implementation for enetcv1 was bound to 4k pages, I need to
> recheck why and get back to you.
>
Any updates?
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-14 2:20 ` Wei Fang
@ 2025-10-14 9:32 ` Claudiu Manoil
2025-10-14 10:00 ` Wei Fang
0 siblings, 1 reply; 9+ messages in thread
From: Claudiu Manoil @ 2025-10-14 9:32 UTC (permalink / raw)
To: Wei Fang, Vladimir Oltean
Cc: Clark Wang, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Frank Li,
imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Wei Fang <wei.fang@nxp.com>
> Sent: Tuesday, October 14, 2025 5:20 AM
[...]
> Subject: RE: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
>
>
>
> Best Regards,
> Wei Fang
>
> > -----Original Message-----
> > From: Claudiu Manoil <claudiu.manoil@nxp.com>
> > Sent: 2025年10月11日 0:24
[...]
> > Subject: RE: [PATCH net] net: enetc: correct the value of
> > ENETC_RXB_TRUESIZE
> >
> >
> >
> > > -----Original Message-----
> > > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> > > Sent: Friday, October 10, 2025 3:49 PM
[...]
> > > Subject: Re: [PATCH net] net: enetc: correct the value of
> > ENETC_RXB_TRUESIZE
> > >
> > > 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?
> >
> > Initial driver implementation for enetcv1 was bound to 4k pages, I
> > need to recheck why and get back to you.
> >
>
> Any updates?
Reviewed RXB_TRUESIZE usage, and confirmed that it's not only used for building
skbs and in the page halves flipping mechanism, but this setting is also accordingly
propagated to the hardware level Rx buffer size configuration (e.g. for Rx S/G).
The allowed h/w Rx buffer size can be up to 64KB, so we would be safe even with
128K pages.
The 'PAGE_SIZE >> 1' comment is actually a TODO item, and I crudely limited
TRUESIZE to 2K to enforce 4K pages in the initial driver (i.e. for simplification).
So, pls go ahead with the configurable RX_TRUESIZE, and note that this opens up
the driver to new usage / performance scenarios, and user configurable Rx buffer
sizes.
Thanks,
Claudiu
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE
2025-10-14 9:32 ` Claudiu Manoil
@ 2025-10-14 10:00 ` Wei Fang
0 siblings, 0 replies; 9+ messages in thread
From: Wei Fang @ 2025-10-14 10:00 UTC (permalink / raw)
To: Claudiu Manoil, Vladimir Oltean
Cc: Clark Wang, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Frank Li,
imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
> > > > 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?
> > >
> > > Initial driver implementation for enetcv1 was bound to 4k pages, I
> > > need to recheck why and get back to you.
> > >
> >
> > Any updates?
>
> Reviewed RXB_TRUESIZE usage, and confirmed that it's not only used for
> building
> skbs and in the page halves flipping mechanism, but this setting is also
> accordingly
> propagated to the hardware level Rx buffer size configuration (e.g. for Rx S/G).
> The allowed h/w Rx buffer size can be up to 64KB, so we would be safe even
> with
> 128K pages.
> The 'PAGE_SIZE >> 1' comment is actually a TODO item, and I crudely limited
> TRUESIZE to 2K to enforce 4K pages in the initial driver (i.e. for simplification).
>
> So, pls go ahead with the configurable RX_TRUESIZE, and note that this opens
> up
> the driver to new usage / performance scenarios, and user configurable Rx
> buffer
> sizes.
>
Thanks for the update, since PAGE_SIZE is configurable, so the old definition
of RXB_TRUESIZE is not consistent with the page halves flipping mechanism
if the PAGE_SIZE is not 4K, I would like to fix it in stable kernels, due to users
may change PAGE_SIZE for some use cases. Then I will add a separate patch
to support changing the RX buffer size at runtime.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-10-14 10:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-10 9:26 [PATCH net] net: enetc: correct the value of ENETC_RXB_TRUESIZE Wei Fang
2025-10-10 12:48 ` Vladimir Oltean
2025-10-10 16:23 ` Claudiu Manoil
2025-10-14 2:20 ` Wei Fang
2025-10-14 9:32 ` Claudiu Manoil
2025-10-14 10:00 ` Wei Fang
2025-10-10 12:49 ` Vladimir Oltean
2025-10-10 13:32 ` Wei Fang
2025-10-13 23:47 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).