diff mbox series

[net,v2,1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios

Message ID 505ebfdd659456e04eba067839eccf14e485005d.1603899392.git.camelia.groza@nxp.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series dpaa_eth: buffer layout fixes | expand

Commit Message

Camelia Alexandra Groza Oct. 28, 2020, 4:40 p.m. UTC
Impose a large RX private data area only when the A050385 erratum is
present on the hardware. A smaller buffer size is sufficient in all
other scenarios. This enables a wider range of linear frame sizes
in non-erratum scenarios

Fixes: 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski Oct. 31, 2020, 1:41 a.m. UTC | #1
On Wed, 28 Oct 2020 18:40:59 +0200 Camelia Groza wrote:
> Impose a large RX private data area only when the A050385 erratum is
> present on the hardware. A smaller buffer size is sufficient in all
> other scenarios. This enables a wider range of linear frame sizes
> in non-erratum scenarios

Any word on user impact? Measurable memory waste?

> Fixes: 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")
> Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
> ---
>  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> index 06cc863..1aac0b6 100644
> --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> @@ -175,8 +175,10 @@
>  #define DPAA_TIME_STAMP_SIZE 8
>  #define DPAA_HASH_RESULTS_SIZE 8
>  #ifdef CONFIG_DPAA_ERRATUM_A050385
> -#define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
> -	 + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE))
> +#define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \
> +			(DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
> +			 + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE)) : \
> +			(DPAA_TX_PRIV_DATA_SIZE + dpaa_rx_extra_headroom))

This expressions is highly unreadable, please refactor. Maybe separate
defines for errata and non-errata, and one for the ternary operator?

>  #else
>  #define DPAA_RX_PRIV_DATA_SIZE	(u16)(DPAA_TX_PRIV_DATA_SIZE + \
>  					dpaa_rx_extra_headroom)
Camelia Alexandra Groza Nov. 2, 2020, 5:08 p.m. UTC | #2
> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Saturday, October 31, 2020 03:41
> To: Camelia Alexandra Groza <camelia.groza@nxp.com>
> Cc: willemdebruijn.kernel@gmail.com; Madalin Bucur (OSS)
> <madalin.bucur@oss.nxp.com>; davem@davemloft.net;
> netdev@vger.kernel.org
> Subject: Re: [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-
> A050385 erratum scenarios
> 
> On Wed, 28 Oct 2020 18:40:59 +0200 Camelia Groza wrote:
> > Impose a large RX private data area only when the A050385 erratum is
> > present on the hardware. A smaller buffer size is sufficient in all
> > other scenarios. This enables a wider range of linear frame sizes
> > in non-erratum scenarios
> 
> Any word on user impact? Measurable memory waste?

I'll add more details.

> > Fixes: 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")
> > Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
> > ---
> >  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > index 06cc863..1aac0b6 100644
> > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > @@ -175,8 +175,10 @@
> >  #define DPAA_TIME_STAMP_SIZE 8
> >  #define DPAA_HASH_RESULTS_SIZE 8
> >  #ifdef CONFIG_DPAA_ERRATUM_A050385
> > -#define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN -
> (DPAA_PARSE_RESULTS_SIZE\
> > -	 + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE))
> > +#define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \
> > +			(DPAA_A050385_ALIGN -
> (DPAA_PARSE_RESULTS_SIZE\
> > +			 + DPAA_TIME_STAMP_SIZE +
> DPAA_HASH_RESULTS_SIZE)) : \
> > +			(DPAA_TX_PRIV_DATA_SIZE +
> dpaa_rx_extra_headroom))
> 
> This expressions is highly unreadable, please refactor. Maybe separate
> defines for errata and non-errata, and one for the ternary operator?

Will clean it up. Thanks.

> >  #else
> >  #define DPAA_RX_PRIV_DATA_SIZE	(u16)(DPAA_TX_PRIV_DATA_SIZE + \
> >  					dpaa_rx_extra_headroom)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 06cc863..1aac0b6 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -175,8 +175,10 @@ 
 #define DPAA_TIME_STAMP_SIZE 8
 #define DPAA_HASH_RESULTS_SIZE 8
 #ifdef CONFIG_DPAA_ERRATUM_A050385
-#define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
-	 + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE))
+#define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \
+			(DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
+			 + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE)) : \
+			(DPAA_TX_PRIV_DATA_SIZE + dpaa_rx_extra_headroom))
 #else
 #define DPAA_RX_PRIV_DATA_SIZE	(u16)(DPAA_TX_PRIV_DATA_SIZE + \
 					dpaa_rx_extra_headroom)