netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: Allow zero for [tr]x_fifo_size
@ 2025-02-03  9:34 Steven Price
  2025-02-03 10:38 ` Russell King (Oracle)
  0 siblings, 1 reply; 9+ messages in thread
From: Steven Price @ 2025-02-03  9:34 UTC (permalink / raw)
  To: David S. Miller, Kunihiko Hayashi, Alexandre Torgue, Andrew Lunn,
	Eric Dumazet, Jakub Kicinski, Maxime Coquelin, Jose Abreu,
	Paolo Abeni
  Cc: Steven Price, linux-arm-kernel, linux-kernel, linux-stm32, netdev,
	Russell King (Oracle), Furong Xu, Petr Tesarik, Serge Semin,
	Yanteng Si, Xi Ruoyao

Commit 8865d22656b4 ("net: stmmac: Specify hardware capability value
when FIFO size isn't specified") modified the behaviour to bail out if
both the FIFO size and the hardware capability were both set to zero.
However devices where has_gmac4 and has_xgmac are both false don't use
the fifo size and that commit breaks platforms for which these values
were zero.

Only warn and error out when (has_gmac4 || has_xgmac) where the values
are used and zero would cause problems, otherwise continue with the zero
values.

Fixes: 8865d22656b4 ("net: stmmac: Specify hardware capability value when FIFO size isn't specified")
Tested-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Steven Price <steven.price@arm.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d04543e5697b..821404beb629 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7222,7 +7222,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 	if (!priv->plat->rx_fifo_size) {
 		if (priv->dma_cap.rx_fifo_size) {
 			priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size;
-		} else {
+		} else if (priv->plat->has_gmac4 || priv->plat->has_xgmac) {
 			dev_err(priv->device, "Can't specify Rx FIFO size\n");
 			return -ENODEV;
 		}
@@ -7236,7 +7236,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 	if (!priv->plat->tx_fifo_size) {
 		if (priv->dma_cap.tx_fifo_size) {
 			priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size;
-		} else {
+		} else if (priv->plat->has_gmac4 || priv->plat->has_xgmac) {
 			dev_err(priv->device, "Can't specify Tx FIFO size\n");
 			return -ENODEV;
 		}
-- 
2.43.0


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

end of thread, other threads:[~2025-02-06  7:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03  9:34 [PATCH] net: stmmac: Allow zero for [tr]x_fifo_size Steven Price
2025-02-03 10:38 ` Russell King (Oracle)
2025-02-03 11:01   ` Steven Price
2025-02-03 11:16     ` Russell King (Oracle)
2025-02-03 11:40       ` Steven Price
2025-02-03 22:23       ` Jakub Kicinski
2025-02-05 14:22         ` Yanteng Si
2025-02-05 14:39           ` Russell King (Oracle)
2025-02-06  7:05             ` Kunihiko Hayashi

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