All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] dpaa_eth: buffer layout fixes
@ 2020-10-28 16:40 Camelia Groza
  2020-10-28 16:40 ` [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios Camelia Groza
  2020-10-28 16:41 ` [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
  0 siblings, 2 replies; 8+ messages in thread
From: Camelia Groza @ 2020-10-28 16:40 UTC (permalink / raw)
  To: willemdebruijn.kernel, madalin.bucur, davem, kuba; +Cc: netdev, Camelia Groza

The patches are related to the software workaround for the A050385 erratum.
The first patch ensures optimal buffer usage for non-erratum scenarios. The
second patch fixes a currently inconsequential discrepancy between the
FMan and Ethernet drivers.

Changes in v2:
- make the returned value for TX ports explicit in 2/2
- simplify the buf_layout reference in 2/2

Camelia Groza (2):
  dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
  dpaa_eth: fix the RX headroom size alignment

 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

--
1.9.1


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

* [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
  2020-10-28 16:40 [PATCH net v2 0/2] dpaa_eth: buffer layout fixes Camelia Groza
@ 2020-10-28 16:40 ` Camelia Groza
  2020-10-31  1:41   ` Jakub Kicinski
  2020-10-28 16:41 ` [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
  1 sibling, 1 reply; 8+ messages in thread
From: Camelia Groza @ 2020-10-28 16:40 UTC (permalink / raw)
  To: willemdebruijn.kernel, madalin.bucur, davem, kuba; +Cc: netdev, Camelia Groza

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(-)

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)
-- 
1.9.1


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

* [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment
  2020-10-28 16:40 [PATCH net v2 0/2] dpaa_eth: buffer layout fixes Camelia Groza
  2020-10-28 16:40 ` [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios Camelia Groza
@ 2020-10-28 16:41 ` Camelia Groza
  2020-10-28 20:45   ` Willem de Bruijn
  2020-10-31  1:43   ` Jakub Kicinski
  1 sibling, 2 replies; 8+ messages in thread
From: Camelia Groza @ 2020-10-28 16:41 UTC (permalink / raw)
  To: willemdebruijn.kernel, madalin.bucur, davem, kuba; +Cc: netdev, Camelia Groza

The headroom reserved for received frames needs to be aligned to an
RX specific value. There is currently a discrepancy between the values
used in the Ethernet driver and the values passed to the FMan.
Coincidentally, the resulting aligned values are identical.

Fixes: 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
Changes in v2:
- make the returned value for TX ports explicit
- simplify the buf_layout reference

 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 1aac0b6..278a684 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2842,7 +2842,8 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv)
 	return err;
 }

-static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
+static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl,
+				    enum port_type port)
 {
 	u16 headroom;

@@ -2856,10 +2857,13 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
 	 *
 	 * Also make sure the headroom is a multiple of data_align bytes
 	 */
-	headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE +
+	headroom = (u16)(bl[port].priv_data_size + DPAA_PARSE_RESULTS_SIZE +
 		DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE);

-	return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
+	if (port == RX)
+		return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT);
+	else
+		return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
 }

 static int dpaa_eth_probe(struct platform_device *pdev)
@@ -3027,8 +3031,8 @@ static int dpaa_eth_probe(struct platform_device *pdev)
 			goto free_dpaa_fqs;
 	}

-	priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]);
-	priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[RX]);
+	priv->tx_headroom = dpaa_get_headroom(priv->buf_layout, TX);
+	priv->rx_headroom = dpaa_get_headroom(priv->buf_layout, RX);

 	/* All real interfaces need their ports initialized */
 	err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs,
--
1.9.1


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

* Re: [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment
  2020-10-28 16:41 ` [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
@ 2020-10-28 20:45   ` Willem de Bruijn
  2020-10-31  1:43   ` Jakub Kicinski
  1 sibling, 0 replies; 8+ messages in thread
From: Willem de Bruijn @ 2020-10-28 20:45 UTC (permalink / raw)
  To: Camelia Groza
  Cc: madalin.bucur, David Miller, Jakub Kicinski, Network Development

On Wed, Oct 28, 2020 at 12:41 PM Camelia Groza <camelia.groza@nxp.com> wrote:
>
> The headroom reserved for received frames needs to be aligned to an
> RX specific value. There is currently a discrepancy between the values
> used in the Ethernet driver and the values passed to the FMan.
> Coincidentally, the resulting aligned values are identical.
>
> Fixes: 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")
> Signed-off-by: Camelia Groza <camelia.groza@nxp.com>

Acked-by: Willem de Bruijn <willemb@google.com>

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

* Re: [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
  2020-10-28 16:40 ` [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios Camelia Groza
@ 2020-10-31  1:41   ` Jakub Kicinski
  2020-11-02 17:08     ` Camelia Alexandra Groza
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2020-10-31  1:41 UTC (permalink / raw)
  To: Camelia Groza; +Cc: willemdebruijn.kernel, madalin.bucur, davem, netdev

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)


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

* Re: [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment
  2020-10-28 16:41 ` [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
  2020-10-28 20:45   ` Willem de Bruijn
@ 2020-10-31  1:43   ` Jakub Kicinski
  2020-11-02 17:09     ` Camelia Alexandra Groza
  1 sibling, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2020-10-31  1:43 UTC (permalink / raw)
  To: Camelia Groza; +Cc: willemdebruijn.kernel, madalin.bucur, davem, netdev

On Wed, 28 Oct 2020 18:41:00 +0200 Camelia Groza wrote:
> @@ -2842,7 +2842,8 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv)
>  	return err;
>  }
> 
> -static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
> +static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl,
> +				    enum port_type port)

Please drop the "inline" while you're touching this definition.

The compiler will make the right inlining decision here.

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

* RE: [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
  2020-10-31  1:41   ` Jakub Kicinski
@ 2020-11-02 17:08     ` Camelia Alexandra Groza
  0 siblings, 0 replies; 8+ messages in thread
From: Camelia Alexandra Groza @ 2020-11-02 17:08 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: willemdebruijn.kernel, Madalin Bucur (OSS), davem, netdev

> -----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)


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

* RE: [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment
  2020-10-31  1:43   ` Jakub Kicinski
@ 2020-11-02 17:09     ` Camelia Alexandra Groza
  0 siblings, 0 replies; 8+ messages in thread
From: Camelia Alexandra Groza @ 2020-11-02 17:09 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: willemdebruijn.kernel, Madalin Bucur (OSS), davem, netdev

> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Saturday, October 31, 2020 03:44
> 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 2/2] dpaa_eth: fix the RX headroom size
> alignment
> 
> On Wed, 28 Oct 2020 18:41:00 +0200 Camelia Groza wrote:
> > @@ -2842,7 +2842,8 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv
> *priv)
> >  	return err;
> >  }
> >
> > -static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
> > +static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl,
> > +				    enum port_type port)
> 
> Please drop the "inline" while you're touching this definition.
> 
> The compiler will make the right inlining decision here.

Sure, I'll drop it.

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

end of thread, other threads:[~2020-11-02 17:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 16:40 [PATCH net v2 0/2] dpaa_eth: buffer layout fixes Camelia Groza
2020-10-28 16:40 ` [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios Camelia Groza
2020-10-31  1:41   ` Jakub Kicinski
2020-11-02 17:08     ` Camelia Alexandra Groza
2020-10-28 16:41 ` [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
2020-10-28 20:45   ` Willem de Bruijn
2020-10-31  1:43   ` Jakub Kicinski
2020-11-02 17:09     ` Camelia Alexandra Groza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.