Skip to contentSkip to conversation

dpaa_eth: buffer layout fixes

PATCH In review Camelia Groza 3 participants 6 messages Nov 2, 2020 – Nov 3, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

Changes in v3:
- refactor defines for clarity in 1/2
- add more details on the user impact in 1/2
- remove unnecessary inline identifier in 2/2

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

--
1.9.1

#1 lore raw

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

Impose a larger 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 Jumbo frame sizes in non-erratum scenarios, instead of turning to multi buffer Scatter/Gather frames. The maximum linear frame size is increased by 128 bytes for non-erratum arm64 platforms.

Cleanup the hardware annotations header defines in the process.

Fixes 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")

---
Changes in v3:
- refactor defines for clarity
- add more details on the user impact

 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +10 -6
index 06cc863..3eaa5f2 100644
@@ -174,12 +174,17 @@
 #define DPAA_PARSE_RESULTS_SIZE sizeof(struct fman_prs_result)
 #define DPAA_TIME_STAMP_SIZE 8
 #define DPAA_HASH_RESULTS_SIZE 8
+#define DPAA_HWA_SIZE (DPAA_PARSE_RESULTS_SIZE + DPAA_TIME_STAMP_SIZE \
+		       + DPAA_HASH_RESULTS_SIZE)
+#define DPAA_RX_PRIV_DATA_DEFAULT_SIZE (DPAA_TX_PRIV_DATA_SIZE + \
+					dpaa_rx_extra_headroom)
 #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_A050385_SIZE (DPAA_A050385_ALIGN - DPAA_HWA_SIZE)
+#define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \
+				DPAA_RX_PRIV_DATA_A050385_SIZE : \
+				DPAA_RX_PRIV_DATA_DEFAULT_SIZE)
 #else
-#define DPAA_RX_PRIV_DATA_SIZE	(u16)(DPAA_TX_PRIV_DATA_SIZE + \
-					dpaa_rx_extra_headroom)
+#define DPAA_RX_PRIV_DATA_SIZE DPAA_RX_PRIV_DATA_DEFAULT_SIZE
 #endif
 
 #define DPAA_ETH_PCD_RXQ_NUM	128
@@ -2854,8 +2859,7 @@ 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 +
-		DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE);
+	headroom = (u16)(bl->priv_data_size + DPAA_HWA_SIZE);
 
 	return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
 }

--
1.9.1

#2 lore raw

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

In reply to 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")

---
Changes in v3:
- remove the unnecessary inline identifier

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(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +9 -5
index 3eaa5f2..d9c2859 100644
@@ -2845,7 +2845,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 u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl,
+			     enum port_type port)
 {
 	u16 headroom;
 
@@ -2859,9 +2860,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_HWA_SIZE);
+	headroom = (u16)(bl[port].priv_data_size + DPAA_HWA_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)
@@ -3029,8 +3033,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

Acked-by on the v3 series
#3 lore raw
In reply to Camelia Groza
Quoted 27 lines

-----Original Message-----
From: Camelia Groza <[email protected]>
Sent: 02 November 2020 20:35
To: [email protected]; Madalin Bucur (OSS) <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Camelia Alexandra Groza <[email protected]>
Subject: [PATCH net v3 0/2] 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.

Changes in v3:
- refactor defines for clarity in 1/2
- add more details on the user impact in 1/2
- remove unnecessary inline identifier in 2/2

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

Quoted 6 lines
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 28 +++++++++++++++++----
-----
 1 file changed, 18 insertions(+), 10 deletions(-)

--
1.9.1

For the series,

#4 lore raw
In reply to Camelia Groza
Quoted 9 lines

-----Original Message-----
From: Camelia Groza <[email protected]>
Sent: Monday, November 2, 2020 20:35
To: [email protected]; Madalin Bucur (OSS) <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; Camelia Alexandra Groza <[email protected]>
Subject: [PATCH net v3 0/2] dpaa_eth: buffer layout fixes

Quoted 6 lines

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.

Jakub, when are you planning the next merger of net into net-next? I have a patch set for net-next depending on this one.

Thanks!
Camelia

maintainer
#5 lore raw
Quoted 7 lines · On Tue, 3 Nov 2020 16:37:26 +0000 Camelia Alexandra Groza wrote:
Quoted 7 lines

Subject: [PATCH net v3 0/2] 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.

Hm, looks like the bot didn't reply, these are applied to net, as you probably noticed.

Quoted 2 lines

Jakub, when are you planning the next merger of net into net-next? I have a patch set for net-next depending on this one.

Thursday afternoon PST, or Friday. Depends on when Linus pulls from net.