linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
@ 2025-02-04 16:13 Chen-Yu Tsai
  2025-02-04 19:45 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2025-02-04 16:13 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Heiko Stuebner
  Cc: Russell King (Oracle), Steven Price, Chen-Yu Tsai,
	Kunihiko Hayashi, netdev, linux-arm-kernel, linux-kernel,
	linux-rockchip, stable

From: Chen-Yu Tsai <wens@csie.org>

The DWMAC 1000 DMA capabilities register does not provide actual
FIFO sizes, nor does the driver really care. If they are not
provided via some other means, the driver will work fine, only
disallowing changing the MTU setting.

The recent commit 8865d22656b4 ("net: stmmac: Specify hardware
capability value when FIFO size isn't specified") changed this by
requiring the FIFO sizes to be provided, breaking devices that were
working just fine.

Provide the FIFO sizes through the driver's platform data, to not
only fix the breakage, but also enable MTU changes. The FIFO sizes
are confirmed to be the same across RK3288, RK3328, RK3399 and PX30,
based on their respective manuals. It is likely that Rockchip
synthesized their DWMAC 1000 with the same parameters on all their
chips that have it.

Fixes: eaf4fac47807 ("net: stmmac: Do not accept invalid MTU values")
Fixes: 8865d22656b4 ("net: stmmac: Specify hardware capability value when FIFO size isn't specified")
Cc: <stable@vger.kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
The reason for stable inclusion is not to fix the device breakage
(which only broke in v6.14-rc1), but to provide the values so that MTU
changes can work in older kernels.

Since a fix for stmmac in general has already been sent [1] and a revert
was also proposed [2], I'll refrain from sending mine.

[1] https://lore.kernel.org/all/20250203093419.25804-1-steven.price@arm.com/
[2] https://lore.kernel.org/all/Z6Clkh44QgdNJu_O@shell.armlinux.org.uk/

 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index a4dc89e23a68..71a4c4967467 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1966,8 +1966,11 @@ static int rk_gmac_probe(struct platform_device *pdev)
 	/* If the stmmac is not already selected as gmac4,
 	 * then make sure we fallback to gmac.
 	 */
-	if (!plat_dat->has_gmac4)
+	if (!plat_dat->has_gmac4) {
 		plat_dat->has_gmac = true;
+		plat_dat->rx_fifo_size = 4096;
+		plat_dat->tx_fifo_size = 2048;
+	}
 	plat_dat->fix_mac_speed = rk_fix_speed;
 
 	plat_dat->bsp_priv = rk_gmac_setup(pdev, plat_dat, data);
-- 
2.39.5



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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-04 16:13 [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000 Chen-Yu Tsai
@ 2025-02-04 19:45 ` Andrew Lunn
  2025-02-04 21:43 ` Jakub Kicinski
  2025-02-06  9:35 ` Steven Price
  2 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2025-02-04 19:45 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Heiko Stuebner, Russell King (Oracle), Steven Price,
	Chen-Yu Tsai, Kunihiko Hayashi, netdev, linux-arm-kernel,
	linux-kernel, linux-rockchip, stable

On Wed, Feb 05, 2025 at 12:13:59AM +0800, Chen-Yu Tsai wrote:
> From: Chen-Yu Tsai <wens@csie.org>
> 
> The DWMAC 1000 DMA capabilities register does not provide actual
> FIFO sizes, nor does the driver really care. If they are not
> provided via some other means, the driver will work fine, only
> disallowing changing the MTU setting.
> 
> The recent commit 8865d22656b4 ("net: stmmac: Specify hardware
> capability value when FIFO size isn't specified") changed this by
> requiring the FIFO sizes to be provided, breaking devices that were
> working just fine.
> 
> Provide the FIFO sizes through the driver's platform data, to not
> only fix the breakage, but also enable MTU changes. The FIFO sizes
> are confirmed to be the same across RK3288, RK3328, RK3399 and PX30,
> based on their respective manuals. It is likely that Rockchip
> synthesized their DWMAC 1000 with the same parameters on all their
> chips that have it.
> 
> Fixes: eaf4fac47807 ("net: stmmac: Do not accept invalid MTU values")
> Fixes: 8865d22656b4 ("net: stmmac: Specify hardware capability value when FIFO size isn't specified")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> The reason for stable inclusion is not to fix the device breakage
> (which only broke in v6.14-rc1), but to provide the values so that MTU
> changes can work in older kernels.

Allowing the MTU to be changed is probably classed as a new feature,
not bug fix.

I _think_ this also allows flow control, which again is a new feature.

Please submit to net-next.

	Andrew


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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-04 16:13 [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000 Chen-Yu Tsai
  2025-02-04 19:45 ` Andrew Lunn
@ 2025-02-04 21:43 ` Jakub Kicinski
  2025-02-05  3:45   ` Chen-Yu Tsai
  2025-02-06  9:35 ` Steven Price
  2 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2025-02-04 21:43 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Heiko Stuebner, Russell King (Oracle), Steven Price, Chen-Yu Tsai,
	Kunihiko Hayashi, netdev, linux-arm-kernel, linux-kernel,
	linux-rockchip, stable

On Wed,  5 Feb 2025 00:13:59 +0800 Chen-Yu Tsai wrote:
> Since a fix for stmmac in general has already been sent [1] and a revert
> was also proposed [2], I'll refrain from sending mine.

No, no, please do. You need to _submit_ the revert like a normal patch.
With all the usual details in the commit message.


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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-04 21:43 ` Jakub Kicinski
@ 2025-02-05  3:45   ` Chen-Yu Tsai
  2025-02-05 17:38     ` Simon Horman
  0 siblings, 1 reply; 9+ messages in thread
From: Chen-Yu Tsai @ 2025-02-05  3:45 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Heiko Stuebner, Russell King (Oracle), Steven Price,
	Kunihiko Hayashi, netdev, linux-arm-kernel, linux-kernel,
	linux-rockchip, stable

On Wed, Feb 5, 2025 at 5:43 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed,  5 Feb 2025 00:13:59 +0800 Chen-Yu Tsai wrote:
> > Since a fix for stmmac in general has already been sent [1] and a revert
> > was also proposed [2], I'll refrain from sending mine.
>
> No, no, please do. You need to _submit_ the revert like a normal patch.
> With all the usual details in the commit message.

Mine isn't a revert, but simply downgrading the error to a warning.
So... yet another workaround approach.


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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-05  3:45   ` Chen-Yu Tsai
@ 2025-02-05 17:38     ` Simon Horman
  2025-02-05 17:40       ` Chen-Yu Tsai
  2025-02-05 17:44       ` Russell King (Oracle)
  0 siblings, 2 replies; 9+ messages in thread
From: Simon Horman @ 2025-02-05 17:38 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Jakub Kicinski, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Heiko Stuebner, Russell King (Oracle), Steven Price,
	Kunihiko Hayashi, netdev, linux-arm-kernel, linux-kernel,
	linux-rockchip, stable

On Wed, Feb 05, 2025 at 11:45:17AM +0800, Chen-Yu Tsai wrote:
> On Wed, Feb 5, 2025 at 5:43 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Wed,  5 Feb 2025 00:13:59 +0800 Chen-Yu Tsai wrote:
> > > Since a fix for stmmac in general has already been sent [1] and a revert
> > > was also proposed [2], I'll refrain from sending mine.
> >
> > No, no, please do. You need to _submit_ the revert like a normal patch.
> > With all the usual details in the commit message.
> 
> Mine isn't a revert, but simply downgrading the error to a warning.
> So... yet another workaround approach.

I think the point is that someone needs to formally
submit the revert. And I assume it should target the net tree.


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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-05 17:38     ` Simon Horman
@ 2025-02-05 17:40       ` Chen-Yu Tsai
  2025-02-06 10:34         ` Simon Horman
  2025-02-05 17:44       ` Russell King (Oracle)
  1 sibling, 1 reply; 9+ messages in thread
From: Chen-Yu Tsai @ 2025-02-05 17:40 UTC (permalink / raw)
  To: Simon Horman
  Cc: Jakub Kicinski, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Heiko Stuebner, Russell King (Oracle), Steven Price,
	Kunihiko Hayashi, netdev, linux-arm-kernel, linux-kernel,
	linux-rockchip, stable

On Thu, Feb 6, 2025 at 1:38 AM Simon Horman <horms@kernel.org> wrote:
>
> On Wed, Feb 05, 2025 at 11:45:17AM +0800, Chen-Yu Tsai wrote:
> > On Wed, Feb 5, 2025 at 5:43 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > >
> > > On Wed,  5 Feb 2025 00:13:59 +0800 Chen-Yu Tsai wrote:
> > > > Since a fix for stmmac in general has already been sent [1] and a revert
> > > > was also proposed [2], I'll refrain from sending mine.
> > >
> > > No, no, please do. You need to _submit_ the revert like a normal patch.
> > > With all the usual details in the commit message.
> >
> > Mine isn't a revert, but simply downgrading the error to a warning.
> > So... yet another workaround approach.
>
> I think the point is that someone needs to formally
> submit the revert. And I assume it should target the net tree.

Russell sent one a couple hours ago, so I think we're covered.


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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-05 17:38     ` Simon Horman
  2025-02-05 17:40       ` Chen-Yu Tsai
@ 2025-02-05 17:44       ` Russell King (Oracle)
  1 sibling, 0 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2025-02-05 17:44 UTC (permalink / raw)
  To: Simon Horman
  Cc: Chen-Yu Tsai, Jakub Kicinski, Andrew Lunn, David S. Miller,
	Eric Dumazet, Paolo Abeni, Heiko Stuebner, Steven Price,
	Kunihiko Hayashi, netdev, linux-arm-kernel, linux-kernel,
	linux-rockchip, stable

On Wed, Feb 05, 2025 at 05:38:24PM +0000, Simon Horman wrote:
> On Wed, Feb 05, 2025 at 11:45:17AM +0800, Chen-Yu Tsai wrote:
> > On Wed, Feb 5, 2025 at 5:43 AM Jakub Kicinski <kuba@kernel.org> wrote:
> > >
> > > On Wed,  5 Feb 2025 00:13:59 +0800 Chen-Yu Tsai wrote:
> > > > Since a fix for stmmac in general has already been sent [1] and a revert
> > > > was also proposed [2], I'll refrain from sending mine.
> > >
> > > No, no, please do. You need to _submit_ the revert like a normal patch.
> > > With all the usual details in the commit message.
> > 
> > Mine isn't a revert, but simply downgrading the error to a warning.
> > So... yet another workaround approach.
> 
> I think the point is that someone needs to formally
> submit the revert. And I assume it should target the net tree.

For what I think is the third time today (fourth if you include the
actual patch...)

https://lore.kernel.org/r/E1tfeyR-003YGJ-Gb@rmk-PC.armlinux.org.uk

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-04 16:13 [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000 Chen-Yu Tsai
  2025-02-04 19:45 ` Andrew Lunn
  2025-02-04 21:43 ` Jakub Kicinski
@ 2025-02-06  9:35 ` Steven Price
  2 siblings, 0 replies; 9+ messages in thread
From: Steven Price @ 2025-02-06  9:35 UTC (permalink / raw)
  To: Chen-Yu Tsai, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Heiko Stuebner
  Cc: Russell King (Oracle), Chen-Yu Tsai, Kunihiko Hayashi, netdev,
	linux-arm-kernel, linux-kernel, linux-rockchip, stable

On 04/02/2025 16:13, Chen-Yu Tsai wrote:
> From: Chen-Yu Tsai <wens@csie.org>
> 
> The DWMAC 1000 DMA capabilities register does not provide actual
> FIFO sizes, nor does the driver really care. If they are not
> provided via some other means, the driver will work fine, only
> disallowing changing the MTU setting.
> 
> The recent commit 8865d22656b4 ("net: stmmac: Specify hardware
> capability value when FIFO size isn't specified") changed this by
> requiring the FIFO sizes to be provided, breaking devices that were
> working just fine.
> 
> Provide the FIFO sizes through the driver's platform data, to not
> only fix the breakage, but also enable MTU changes. The FIFO sizes
> are confirmed to be the same across RK3288, RK3328, RK3399 and PX30,
> based on their respective manuals. It is likely that Rockchip
> synthesized their DWMAC 1000 with the same parameters on all their
> chips that have it.
> 
> Fixes: eaf4fac47807 ("net: stmmac: Do not accept invalid MTU values")
> Fixes: 8865d22656b4 ("net: stmmac: Specify hardware capability value when FIFO size isn't specified")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

I think it's better at this stage to apply the revert first. However
I've run this on my board (Firefly RK3288) and it works, so when rebased
onto the (reverted) revert:

Tested-by: Steven Price <steven.price@arm.com>

Thanks,
Steve

> ---
> The reason for stable inclusion is not to fix the device breakage
> (which only broke in v6.14-rc1), but to provide the values so that MTU
> changes can work in older kernels.
> 
> Since a fix for stmmac in general has already been sent [1] and a revert
> was also proposed [2], I'll refrain from sending mine.
> 
> [1] https://lore.kernel.org/all/20250203093419.25804-1-steven.price@arm.com/
> [2] https://lore.kernel.org/all/Z6Clkh44QgdNJu_O@shell.armlinux.org.uk/
> 
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index a4dc89e23a68..71a4c4967467 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> @@ -1966,8 +1966,11 @@ static int rk_gmac_probe(struct platform_device *pdev)
>  	/* If the stmmac is not already selected as gmac4,
>  	 * then make sure we fallback to gmac.
>  	 */
> -	if (!plat_dat->has_gmac4)
> +	if (!plat_dat->has_gmac4) {
>  		plat_dat->has_gmac = true;
> +		plat_dat->rx_fifo_size = 4096;
> +		plat_dat->tx_fifo_size = 2048;
> +	}
>  	plat_dat->fix_mac_speed = rk_fix_speed;
>  
>  	plat_dat->bsp_priv = rk_gmac_setup(pdev, plat_dat, data);



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

* Re: [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000
  2025-02-05 17:40       ` Chen-Yu Tsai
@ 2025-02-06 10:34         ` Simon Horman
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2025-02-06 10:34 UTC (permalink / raw)
  To: Chen-Yu Tsai, Russell King (Oracle)
  Cc: Jakub Kicinski, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Heiko Stuebner, Russell King (Oracle), Steven Price,
	Kunihiko Hayashi, netdev, linux-arm-kernel, linux-kernel,
	linux-rockchip, stable

On Thu, Feb 06, 2025 at 01:40:17AM +0800, Chen-Yu Tsai wrote:
> On Thu, Feb 6, 2025 at 1:38 AM Simon Horman <horms@kernel.org> wrote:

...

> > I think the point is that someone needs to formally
> > submit the revert. And I assume it should target the net tree.
> 
> Russell sent one a couple hours ago, so I think we're covered.
> 

On Wed, Feb 05, 2025 at 05:44:58PM +0000, Russell King (Oracle) wrote:
> On Wed, Feb 05, 2025 at 05:38:24PM +0000, Simon Horman wrote:

...

> > I think the point is that someone needs to formally
> > submit the revert. And I assume it should target the net tree.
> 
> For what I think is the third time today (fourth if you include the
> actual patch...)
> 
> https://lore.kernel.org/r/E1tfeyR-003YGJ-Gb@rmk-PC.armlinux.org.uk

Thanks, I see it now.


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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04 16:13 [PATCH netdev] net: stmmac: dwmac-rk: Provide FIFO sizes for DWMAC 1000 Chen-Yu Tsai
2025-02-04 19:45 ` Andrew Lunn
2025-02-04 21:43 ` Jakub Kicinski
2025-02-05  3:45   ` Chen-Yu Tsai
2025-02-05 17:38     ` Simon Horman
2025-02-05 17:40       ` Chen-Yu Tsai
2025-02-06 10:34         ` Simon Horman
2025-02-05 17:44       ` Russell King (Oracle)
2025-02-06  9:35 ` Steven Price

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