* [PATCH v4 0/1] Adjust macb max_tx_len for mpfs @ 2023-05-12 12:20 daire.mcnamara 2023-05-12 12:20 ` [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs daire.mcnamara 2023-05-13 19:50 ` [PATCH v4 0/1] Adjust macb max_tx_len for mpfs patchwork-bot+netdevbpf 0 siblings, 2 replies; 6+ messages in thread From: daire.mcnamara @ 2023-05-12 12:20 UTC (permalink / raw) To: nicolas.ferre, claudiu.beznea, davem, edumazet, kuba, pabeni, netdev, conor.dooley Cc: Daire McNamara From: Daire McNamara <daire.mcnamara@microchip•com> Several customers have reported unexpected ethernet issues whereby the GEM stops transmitting and receiving. Performing an action such as ifconfig <ethX> down; ifconfig <ethX> up clears this particular condition. The origin of the issue is a stream of AMBA_ERRORS (bit 6) from the tx queues. This patch sets the max_tx_length to SRAM size (16 KiB in the case of mpfs) divided by num_queues (4 in the case of mpfs) and then subtracts 56 bytes from that figure - resulting in max_tx_len of 4040. The max jumbo length is also set to 4040. These figures are derived from Cadence erratum 1686. Change from v3 - Simplified the if/else ladder Change from v2 - Remove pointless check for existence of macb_config. Change from v1 - Switched from using macb_is_gem() to hw_is_gem() as macb_is_gem() relies on capabilities being read and these have not been ascertained at this point of the probe routine. Daire McNamara (1): net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) base-commit: 09a9639e56c01c7a00d6c0ca63f4c7c41abe075d -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs 2023-05-12 12:20 [PATCH v4 0/1] Adjust macb max_tx_len for mpfs daire.mcnamara @ 2023-05-12 12:20 ` daire.mcnamara 2023-05-12 12:23 ` Conor Dooley ` (2 more replies) 2023-05-13 19:50 ` [PATCH v4 0/1] Adjust macb max_tx_len for mpfs patchwork-bot+netdevbpf 1 sibling, 3 replies; 6+ messages in thread From: daire.mcnamara @ 2023-05-12 12:20 UTC (permalink / raw) To: nicolas.ferre, claudiu.beznea, davem, edumazet, kuba, pabeni, netdev, conor.dooley Cc: Daire McNamara From: Daire McNamara <daire.mcnamara@microchip•com> On mpfs, with SRAM configured for 4 queues, setting max_tx_len to GEM_TX_MAX_LEN=0x3f0 results multiple AMBA errors. Setting max_tx_len to (4KiB - 56) removes those errors. The details are described in erratum 1686 by Cadence The max jumbo frame size is also reduced for mpfs to (4KiB - 56). Signed-off-by: Daire McNamara <daire.mcnamara@microchip•com> --- drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 14dfec4db8f9..989e7c5db9b9 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -1175,6 +1175,7 @@ struct macb_config { struct clk **hclk, struct clk **tx_clk, struct clk **rx_clk, struct clk **tsu_clk); int (*init)(struct platform_device *pdev); + unsigned int max_tx_length; int jumbo_max_len; const struct macb_usrio_config *usrio; }; diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 66e30561569e..3a46b75ae54f 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4095,14 +4095,12 @@ static int macb_init(struct platform_device *pdev) /* setup appropriated routines according to adapter type */ if (macb_is_gem(bp)) { - bp->max_tx_length = GEM_MAX_TX_LEN; bp->macbgem_ops.mog_alloc_rx_buffers = gem_alloc_rx_buffers; bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers; bp->macbgem_ops.mog_init_rings = gem_init_rings; bp->macbgem_ops.mog_rx = gem_rx; dev->ethtool_ops = &gem_ethtool_ops; } else { - bp->max_tx_length = MACB_MAX_TX_LEN; bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers; bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers; bp->macbgem_ops.mog_init_rings = macb_init_rings; @@ -4839,7 +4837,8 @@ static const struct macb_config mpfs_config = { .clk_init = macb_clk_init, .init = init_reset_optional, .usrio = &macb_default_usrio, - .jumbo_max_len = 10240, + .max_tx_length = 4040, /* Cadence Erratum 1686 */ + .jumbo_max_len = 4040, }; static const struct macb_config sama7g5_gem_config = { @@ -4989,6 +4988,13 @@ static int macb_probe(struct platform_device *pdev) if (macb_config) bp->jumbo_max_len = macb_config->jumbo_max_len; + if (!hw_is_gem(bp->regs, bp->native_io)) + bp->max_tx_length = MACB_MAX_TX_LEN; + else if (macb_config->max_tx_length) + bp->max_tx_length = macb_config->max_tx_length; + else + bp->max_tx_length = GEM_MAX_TX_LEN; + bp->wol = 0; if (of_property_read_bool(np, "magic-packet")) bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs 2023-05-12 12:20 ` [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs daire.mcnamara @ 2023-05-12 12:23 ` Conor Dooley 2023-05-12 15:11 ` Simon Horman 2023-05-13 8:51 ` Claudiu.Beznea 2 siblings, 0 replies; 6+ messages in thread From: Conor Dooley @ 2023-05-12 12:23 UTC (permalink / raw) To: daire.mcnamara Cc: nicolas.ferre, claudiu.beznea, davem, edumazet, kuba, pabeni, netdev [-- Attachment #1: Type: text/plain, Size: 598 bytes --] On Fri, May 12, 2023 at 01:20:32PM +0100, daire.mcnamara@microchip•com wrote: > From: Daire McNamara <daire.mcnamara@microchip•com> > > On mpfs, with SRAM configured for 4 queues, setting max_tx_len > to GEM_TX_MAX_LEN=0x3f0 results multiple AMBA errors. > Setting max_tx_len to (4KiB - 56) removes those errors. > > The details are described in erratum 1686 by Cadence > > The max jumbo frame size is also reduced for mpfs to (4KiB - 56). > > Signed-off-by: Daire McNamara <daire.mcnamara@microchip•com> Reviewed-by: Conor Dooley <conor.dooley@microchip•com> Thanks, Conor. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs 2023-05-12 12:20 ` [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs daire.mcnamara 2023-05-12 12:23 ` Conor Dooley @ 2023-05-12 15:11 ` Simon Horman 2023-05-13 8:51 ` Claudiu.Beznea 2 siblings, 0 replies; 6+ messages in thread From: Simon Horman @ 2023-05-12 15:11 UTC (permalink / raw) To: daire.mcnamara Cc: nicolas.ferre, claudiu.beznea, davem, edumazet, kuba, pabeni, netdev, conor.dooley On Fri, May 12, 2023 at 01:20:32PM +0100, daire.mcnamara@microchip•com wrote: > From: Daire McNamara <daire.mcnamara@microchip•com> > > On mpfs, with SRAM configured for 4 queues, setting max_tx_len > to GEM_TX_MAX_LEN=0x3f0 results multiple AMBA errors. > Setting max_tx_len to (4KiB - 56) removes those errors. > > The details are described in erratum 1686 by Cadence > > The max jumbo frame size is also reduced for mpfs to (4KiB - 56). > > Signed-off-by: Daire McNamara <daire.mcnamara@microchip•com> Reviewed-by: Simon Horman <simon.horman@corigine•com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs 2023-05-12 12:20 ` [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs daire.mcnamara 2023-05-12 12:23 ` Conor Dooley 2023-05-12 15:11 ` Simon Horman @ 2023-05-13 8:51 ` Claudiu.Beznea 2 siblings, 0 replies; 6+ messages in thread From: Claudiu.Beznea @ 2023-05-13 8:51 UTC (permalink / raw) To: Daire.McNamara, Nicolas.Ferre, davem, edumazet, kuba, pabeni, netdev, Conor.Dooley On 12.05.2023 15:20, daire.mcnamara@microchip•com wrote: > From: Daire McNamara <daire.mcnamara@microchip•com> > > On mpfs, with SRAM configured for 4 queues, setting max_tx_len > to GEM_TX_MAX_LEN=0x3f0 results multiple AMBA errors. > Setting max_tx_len to (4KiB - 56) removes those errors. > > The details are described in erratum 1686 by Cadence > > The max jumbo frame size is also reduced for mpfs to (4KiB - 56). > > Signed-off-by: Daire McNamara <daire.mcnamara@microchip•com> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip•com> > --- > drivers/net/ethernet/cadence/macb.h | 1 + > drivers/net/ethernet/cadence/macb_main.c | 12 +++++++++--- > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h > index 14dfec4db8f9..989e7c5db9b9 100644 > --- a/drivers/net/ethernet/cadence/macb.h > +++ b/drivers/net/ethernet/cadence/macb.h > @@ -1175,6 +1175,7 @@ struct macb_config { > struct clk **hclk, struct clk **tx_clk, > struct clk **rx_clk, struct clk **tsu_clk); > int (*init)(struct platform_device *pdev); > + unsigned int max_tx_length; > int jumbo_max_len; > const struct macb_usrio_config *usrio; > }; > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > index 66e30561569e..3a46b75ae54f 100644 > --- a/drivers/net/ethernet/cadence/macb_main.c > +++ b/drivers/net/ethernet/cadence/macb_main.c > @@ -4095,14 +4095,12 @@ static int macb_init(struct platform_device *pdev) > > /* setup appropriated routines according to adapter type */ > if (macb_is_gem(bp)) { > - bp->max_tx_length = GEM_MAX_TX_LEN; > bp->macbgem_ops.mog_alloc_rx_buffers = gem_alloc_rx_buffers; > bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers; > bp->macbgem_ops.mog_init_rings = gem_init_rings; > bp->macbgem_ops.mog_rx = gem_rx; > dev->ethtool_ops = &gem_ethtool_ops; > } else { > - bp->max_tx_length = MACB_MAX_TX_LEN; > bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers; > bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers; > bp->macbgem_ops.mog_init_rings = macb_init_rings; > @@ -4839,7 +4837,8 @@ static const struct macb_config mpfs_config = { > .clk_init = macb_clk_init, > .init = init_reset_optional, > .usrio = &macb_default_usrio, > - .jumbo_max_len = 10240, > + .max_tx_length = 4040, /* Cadence Erratum 1686 */ > + .jumbo_max_len = 4040, > }; > > static const struct macb_config sama7g5_gem_config = { > @@ -4989,6 +4988,13 @@ static int macb_probe(struct platform_device *pdev) > if (macb_config) > bp->jumbo_max_len = macb_config->jumbo_max_len; > > + if (!hw_is_gem(bp->regs, bp->native_io)) > + bp->max_tx_length = MACB_MAX_TX_LEN; > + else if (macb_config->max_tx_length) > + bp->max_tx_length = macb_config->max_tx_length; > + else > + bp->max_tx_length = GEM_MAX_TX_LEN; > + > bp->wol = 0; > if (of_property_read_bool(np, "magic-packet")) > bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 0/1] Adjust macb max_tx_len for mpfs 2023-05-12 12:20 [PATCH v4 0/1] Adjust macb max_tx_len for mpfs daire.mcnamara 2023-05-12 12:20 ` [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs daire.mcnamara @ 2023-05-13 19:50 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 6+ messages in thread From: patchwork-bot+netdevbpf @ 2023-05-13 19:50 UTC (permalink / raw) To: Daire McNamara Cc: nicolas.ferre, claudiu.beznea, davem, edumazet, kuba, pabeni, netdev, conor.dooley Hello: This patch was applied to netdev/net-next.git (main) by David S. Miller <davem@davemloft•net>: On Fri, 12 May 2023 13:20:31 +0100 you wrote: > From: Daire McNamara <daire.mcnamara@microchip•com> > > Several customers have reported unexpected ethernet issues whereby > the GEM stops transmitting and receiving. Performing an action such > as ifconfig <ethX> down; ifconfig <ethX> up clears this particular > condition. > > [...] Here is the summary with links: - [v4,1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs https://git.kernel.org/netdev/net-next/c/314cf958de2a You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-05-13 19:50 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-05-12 12:20 [PATCH v4 0/1] Adjust macb max_tx_len for mpfs daire.mcnamara 2023-05-12 12:20 ` [PATCH v4 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs daire.mcnamara 2023-05-12 12:23 ` Conor Dooley 2023-05-12 15:11 ` Simon Horman 2023-05-13 8:51 ` Claudiu.Beznea 2023-05-13 19:50 ` [PATCH v4 0/1] Adjust macb max_tx_len for mpfs patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox