netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] dpaa_eth: buffer layout fixes
@ 2020-10-27 14:56 Camelia Groza
  2020-10-27 14:56 ` [PATCH net 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios Camelia Groza
  2020-10-27 14:56 ` [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
  0 siblings, 2 replies; 5+ messages in thread
From: Camelia Groza @ 2020-10-27 14:56 UTC (permalink / raw)
  To: 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.

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 | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

--
1.9.1


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

* [PATCH net 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
  2020-10-27 14:56 [PATCH net 0/2] dpaa_eth: buffer layout fixes Camelia Groza
@ 2020-10-27 14:56 ` Camelia Groza
  2020-10-27 14:56 ` [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
  1 sibling, 0 replies; 5+ messages in thread
From: Camelia Groza @ 2020-10-27 14:56 UTC (permalink / raw)
  To: 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] 5+ messages in thread

* [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment
  2020-10-27 14:56 [PATCH net 0/2] dpaa_eth: buffer layout fixes Camelia Groza
  2020-10-27 14:56 ` [PATCH net 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios Camelia Groza
@ 2020-10-27 14:56 ` Camelia Groza
  2020-10-27 21:31   ` Willem de Bruijn
  1 sibling, 1 reply; 5+ messages in thread
From: Camelia Groza @ 2020-10-27 14:56 UTC (permalink / raw)
  To: 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>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 1aac0b6..67ae561 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,9 +2857,12 @@ 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);
 
+	if (port == RX)
+		return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT);
+
 	return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
 }
 
@@ -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[0], TX);
+	priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[0], 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] 5+ messages in thread

* Re: [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment
  2020-10-27 14:56 ` [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
@ 2020-10-27 21:31   ` Willem de Bruijn
  2020-10-28 15:57     ` Camelia Alexandra Groza
  0 siblings, 1 reply; 5+ messages in thread
From: Willem de Bruijn @ 2020-10-27 21:31 UTC (permalink / raw)
  To: Camelia Groza
  Cc: madalin.bucur, David Miller, Jakub Kicinski, Network Development

On Tue, Oct 27, 2020 at 11:04 AM 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>
> ---
>  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> index 1aac0b6..67ae561 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,9 +2857,12 @@ 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);
>
> +       if (port == RX)
> +               return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT);
> +
else?

>         return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
>  }
>
> @@ -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[0], TX);
> +       priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[0], RX);

This can be just priv->buf_layout
>
>         /* All real interfaces need their ports initialized */
>         err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs,
> --
> 1.9.1
>

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

* RE: [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment
  2020-10-27 21:31   ` Willem de Bruijn
@ 2020-10-28 15:57     ` Camelia Alexandra Groza
  0 siblings, 0 replies; 5+ messages in thread
From: Camelia Alexandra Groza @ 2020-10-28 15:57 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: Madalin Bucur (OSS), David Miller, Jakub Kicinski,
	Network Development

> -----Original Message-----
> From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Sent: Tuesday, October 27, 2020 23:31
> To: Camelia Alexandra Groza <camelia.groza@nxp.com>
> Cc: Madalin Bucur (OSS) <madalin.bucur@oss.nxp.com>; David Miller
> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Network
> Development <netdev@vger.kernel.org>
> Subject: Re: [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment
> 
> On Tue, Oct 27, 2020 at 11:04 AM 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>
> > ---
> >  drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > index 1aac0b6..67ae561 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,9 +2857,12 @@ 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);
> >
> > +       if (port == RX)
> > +               return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT);
> > +
> else?

It falls through. I'll make it explicit.

> >         return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
> >  }
> >
> > @@ -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[0], TX);
> > +       priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[0],
> RX);
> 
> This can be just priv->buf_layout

I'll change it. Thanks.

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

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

end of thread, other threads:[~2020-10-28 21:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27 14:56 [PATCH net 0/2] dpaa_eth: buffer layout fixes Camelia Groza
2020-10-27 14:56 ` [PATCH net 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios Camelia Groza
2020-10-27 14:56 ` [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment Camelia Groza
2020-10-27 21:31   ` Willem de Bruijn
2020-10-28 15:57     ` Camelia Alexandra Groza

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