dpaa_eth: buffer layout fixes
Subsystems (3)
Re: [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment
In reply to Camelia GrozaQuoted 8 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")Signed-off-by Camelia Groza <[email protected]>
PATCH v2 1/2 dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
In reply to Camelia GrozaImpose 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
--- 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
@@ -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
PATCH v2 2/2 dpaa_eth: fix the RX headroom size alignment
In reply to Camelia GrozaThe 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.
---
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
@@ -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
v2 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 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
Jakub Kicinski
maintainerRe: [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
In reply to Camelia GrozaQuoted 4 lines · 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?
Quoted 11 lines
Fixes 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")Signed-off-by Camelia Groza <[email protected]>--- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0
-0
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c line 181
Quoted 9 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +4
-2@@ -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?
Quoted 3 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0
-0#else #define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \ dpaa_rx_extra_headroom)
Jakub Kicinski
maintainerRe: [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment
In reply to Camelia Grozadrivers/net/ethernet/freescale/dpaa/dpaa_eth.c static int dpaa_ingress_cgr_init(struct dpaa_priv *priv) · line 2846
Quoted 7 lines · On Wed, 28 Oct 2020 18:41:00 +0200 Camelia Groza wrote:
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2
-1@@ -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.
RE: [PATCH net v2 1/2] dpaa_eth: update the buffer layout for non-A050385 erratum scenarios
In reply to Jakub KicinskiQuoted 10 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Saturday, October 31, 2020 03:41
To: Camelia Alexandra Groza <[email protected]>
Cc: [email protected]; Madalin Bucur (OSS) <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net v2 1/2]dpaa_eth: update the buffer layout for non- A050385 erratum scenarios
Quoted 7 lines
Quoted 4 lines · 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.
Quoted 21 lines
Review
Quoted 7 lines
Fixes 3c68b8fffb48 ("dpaa_eth: FMan erratum A050385 workaround")Signed-off-by Camelia Groza <[email protected]>--- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.cdrivers/net/ethernet/freescale/dpaa/dpaa_eth.c line 178
Quoted 8 lines
index 06cc863..1aac0b6 100644
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0
-1@@ -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\
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
Quoted 3 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2
-1- + 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\
Quoted 7 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c line 180
Quoted 1 line
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1
-0+ + DPAA_TIME_STAMP_SIZE +
DPAA_HASH_RESULTS_SIZE)) : \drivers/net/ethernet/freescale/dpaa/dpaa_eth.c line 181
Quoted 1 line
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1
-0+ (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.
Quoted 3 lines
Quoted 3 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0
-0#else #define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \ dpaa_rx_extra_headroom)
RE: [PATCH net v2 2/2] dpaa_eth: fix the RX headroom size alignment
In reply to Jakub KicinskiQuoted 16 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Saturday, October 31, 2020 03:44
To: Camelia Alexandra Groza <[email protected]>
Cc: [email protected]; Madalin Bucur (OSS) <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net v2 2/2]dpaa_eth: fix the RX headroom size alignmentReview static int dpaa_ingress_cgr_init(struct dpaa_priv
Quoted 1 line · On Wed, 28 Oct 2020 18:41:00 +0200 Camelia Groza wrote:
(quoted diff) +0
-0@@ -2842,7 +2842,8 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv*priv)
Quoted 3 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +0
-0return err; }
Quoted 7 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c static int dpaa_ingress_cgr_init(struct dpaa_priv *priv) · line 2846
Quoted 3 lines
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2
-1-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.