Skip to contentSkip to conversation

dpaa_eth: buffer layout fixes

PATCH Superseded Camelia Groza 2 participants 5 messages Oct 27, 2020 – Oct 28, 2020

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover dpaa_eth: buffer layout fixes

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

#2 lore raw

PATCH 2/2 dpaa_eth: fix the RX headroom size alignment

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")
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +8 -4
index 1aac0b6..67ae561 100644
@@ -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,
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 dpaa_eth: update the buffer layout for non-A050385 erratum scenarios

In reply to 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")
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +4 -2
index 06cc863..1aac0b6 100644
@@ -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)
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment

In reply to Camelia Groza
Quoted 27 lines · 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")
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2 -1
index 1aac0b6..67ae561 100644
@@ -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;
 

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) · line 2865

Quoted 10 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +4 -1
@@ -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?

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static int dpaa_eth_probe(struct platform_device *pdev) · line 3035

Quoted 11 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2 -2
        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

Quoted 6 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0 -1
        /* All real interfaces need their ports initialized */
        err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs,
--

1.9.1

#4 lore raw

RE: [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment

Quoted 46 lines

-----Original Message-----
From: Willem de Bruijn <[email protected]>
Sent: Tuesday, October 27, 2020 23:31
To: Camelia Alexandra Groza <[email protected]>
Cc: Madalin Bucur (OSS) <[email protected]>; David Miller <[email protected]>; Jakub Kicinski <[email protected]>; Network Development <[email protected]>
Subject: Re: [PATCH net 2/2] dpaa_eth: fix the RX headroom size alignment

Quoted 6 lines · 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.

Review

Quoted 7 lines
Fixes 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static int dpaa_ingress_cgr_init(struct dpaa_priv

Quoted 4 lines

index 1aac0b6..67ae561 100644

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0 -0
@@ -2842,7 +2842,8 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv

*priv)

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static inline u16 dpaa_get_headroom(struct

Quoted 10 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2 -1
        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)

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)

Quoted 5 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -1
         *
         * 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 +
Quoted 7 lines

DPAA_PARSE_RESULTS_SIZE +

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) · line 2865

Quoted 5 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +3 -0
                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.

Quoted 8 lines

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static int dpaa_eth_probe(struct platform_device

Quoted 4 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0 -0
        return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
 }
 
@@ -3027,8 +3031,8 @@ static int dpaa_eth_probe(struct platform_device

*pdev)

Quoted 3 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0 -0
                        goto free_dpaa_fqs;
        }
 
Quoted 7 lines

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static int dpaa_eth_probe(struct platform_device *pdev)

Quoted 4 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2 -2
-       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.

Quoted 5 lines
Quoted 5 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0 -1
        /* All real interfaces need their ports initialized */
        err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs,
--

1.9.1