lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <07af1102-0fa7-45ad-bcbc-aef0295ceb63@arm.com>
Date: Fri, 31 Jan 2025 09:46:41 +0000
From: Steven Price <steven.price@....com>
To: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>,
 Alexandre Torgue <alexandre.torgue@...s.st.com>,
 Jose Abreu <joabreu@...opsys.com>, Andrew Lunn <andrew+netdev@...n.ch>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Maxime Coquelin <mcoquelin.stm32@...il.com>
Cc: Russell King <linux@...linux.org.uk>, Yanteng Si <si.yanteng@...ux.dev>,
 Furong Xu <0x1207@...il.com>, Joao Pinto <Joao.Pinto@...opsys.com>,
 netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v4 3/3] net: stmmac: Specify hardware capability value
 when FIFO size isn't specified

On 27/01/2025 01:38, Kunihiko Hayashi wrote:
> When Tx/Rx FIFO size is not specified in advance, the driver checks if
> the value is zero and sets the hardware capability value in functions
> where that value is used.
> 
> Consolidate the check and settings into function stmmac_hw_init() and
> remove redundant other statements.
> 
> If FIFO size is zero and the hardware capability also doesn't have upper
> limit values, return with an error message.

This patch breaks my Firefly RK3288 board. It appears that all of the 
following are true:

 * priv->plat->rx_fifo_size == 0
 * priv->dma_cap.rx_fifo_size == 0
 * priv->plat->tx_fifo_size == 0
 * priv->dma_cap.tx_fifo_size == 0

Simply removing the "return -ENODEV" lines gets this platform working 
again (and AFAICT matches the behaviour before this patch was applied).
I'm not sure whether this points to another bug causing these to 
all be zero or if this is just an oversight. The below patch gets my 
board working:

-----8<-----
>From 5097d29181f320875d29da8fc24e6d3ae44db581 Mon Sep 17 00:00:00 2001
From: Steven Price <steven.price@....com>
Date: Fri, 31 Jan 2025 09:32:17 +0000
Subject: [PATCH] net: stmmac: Allow zero for [tr]x_fifo_size

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 there are platforms out there (e.g. RK3288) where this is the
case which this breaks.

Remove the error return and use the dma_cap value as is.

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

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d04543e5697b..41c837c91811 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7220,12 +7220,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 {
-			dev_err(priv->device, "Can't specify Rx FIFO size\n");
-			return -ENODEV;
-		}
+		priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size;
 	} else if (priv->dma_cap.rx_fifo_size &&
 		   priv->plat->rx_fifo_size > priv->dma_cap.rx_fifo_size) {
 		dev_warn(priv->device,
@@ -7234,12 +7229,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
 		priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size;
 	}
 	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 {
-			dev_err(priv->device, "Can't specify Tx FIFO size\n");
-			return -ENODEV;
-		}
+		priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size;
 	} else if (priv->dma_cap.tx_fifo_size &&
 		   priv->plat->tx_fifo_size > priv->dma_cap.tx_fifo_size) {
 		dev_warn(priv->device,
-- 
2.39.5



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ