netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3
@ 2023-06-02 19:04 Bartosz Golaszewski
  2023-06-02 19:30 ` Andrew Halaney
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2023-06-02 19:04 UTC (permalink / raw)
  To: Vinod Koul, Bhupesh Sharma, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Andrew Halaney, Jesse Brandeburg
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

We must not assign plat_dat->dwmac4_addrs unconditionally as for
structures which don't set them, this will result in the core driver
using zeroes everywhere and breaking the driver for older HW. On EMAC < 2
the address should remain NULL.

Fixes: b68376191c69 ("net: stmmac: dwmac-qcom-ethqos: Add EMAC3 support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 16a8c361283b..f07905f00f98 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -644,7 +644,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
 	plat_dat->fix_mac_speed = ethqos_fix_mac_speed;
 	plat_dat->dump_debug_regs = rgmii_dump;
 	plat_dat->has_gmac4 = 1;
-	plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
+	if (ethqos->has_emac3)
+		plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
 	plat_dat->pmt = 1;
 	plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
 	if (of_device_is_compatible(np, "qcom,qcs404-ethqos"))
-- 
2.39.2


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

* Re: [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3
  2023-06-02 19:04 [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3 Bartosz Golaszewski
@ 2023-06-02 19:30 ` Andrew Halaney
  2023-06-03  6:30 ` Siddharth Vadapalli
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andrew Halaney @ 2023-06-02 19:30 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Vinod Koul, Bhupesh Sharma, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Jesse Brandeburg, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On Fri, Jun 02, 2023 at 09:04:55PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We must not assign plat_dat->dwmac4_addrs unconditionally as for
> structures which don't set them, this will result in the core driver
> using zeroes everywhere and breaking the driver for older HW. On EMAC < 2
> the address should remain NULL.
> 
> Fixes: b68376191c69 ("net: stmmac: dwmac-qcom-ethqos: Add EMAC3 support")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>

Thanks for the fix, sorry about that!

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index 16a8c361283b..f07905f00f98 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -644,7 +644,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
>  	plat_dat->fix_mac_speed = ethqos_fix_mac_speed;
>  	plat_dat->dump_debug_regs = rgmii_dump;
>  	plat_dat->has_gmac4 = 1;
> -	plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
> +	if (ethqos->has_emac3)
> +		plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
>  	plat_dat->pmt = 1;
>  	plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
>  	if (of_device_is_compatible(np, "qcom,qcs404-ethqos"))
> -- 
> 2.39.2
> 


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

* Re: [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3
  2023-06-02 19:04 [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3 Bartosz Golaszewski
  2023-06-02 19:30 ` Andrew Halaney
@ 2023-06-03  6:30 ` Siddharth Vadapalli
  2023-06-05  7:06 ` Vinod Koul
  2023-06-05 10:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Siddharth Vadapalli @ 2023-06-03  6:30 UTC (permalink / raw)
  To: Bartosz Golaszewski, Vinod Koul, Bhupesh Sharma,
	Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Andrew Halaney, Jesse Brandeburg
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	Bartosz Golaszewski, s-vadapalli



On 03-06-2023 00:34, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We must not assign plat_dat->dwmac4_addrs unconditionally as for
> structures which don't set them, this will result in the core driver
> using zeroes everywhere and breaking the driver for older HW. On EMAC < 2
> the address should remain NULL.
> 
> Fixes: b68376191c69 ("net: stmmac: dwmac-qcom-ethqos: Add EMAC3 support")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index 16a8c361283b..f07905f00f98 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -644,7 +644,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
>  	plat_dat->fix_mac_speed = ethqos_fix_mac_speed;
>  	plat_dat->dump_debug_regs = rgmii_dump;
>  	plat_dat->has_gmac4 = 1;
> -	plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
> +	if (ethqos->has_emac3)
> +		plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
>  	plat_dat->pmt = 1;
>  	plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
>  	if (of_device_is_compatible(np, "qcom,qcs404-ethqos"))

-- 
Regards,
Siddharth.

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

* Re: [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3
  2023-06-02 19:04 [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3 Bartosz Golaszewski
  2023-06-02 19:30 ` Andrew Halaney
  2023-06-03  6:30 ` Siddharth Vadapalli
@ 2023-06-05  7:06 ` Vinod Koul
  2023-06-05 10:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2023-06-05  7:06 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Bhupesh Sharma, Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Andrew Halaney, Jesse Brandeburg, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On 02-06-23, 21:04, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We must not assign plat_dat->dwmac4_addrs unconditionally as for
> structures which don't set them, this will result in the core driver
> using zeroes everywhere and breaking the driver for older HW. On EMAC < 2
> the address should remain NULL.

Reviewed-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

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

* Re: [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3
  2023-06-02 19:04 [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3 Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2023-06-05  7:06 ` Vinod Koul
@ 2023-06-05 10:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-05 10:40 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: vkoul, bhupesh.sharma, peppe.cavallaro, alexandre.torgue, joabreu,
	davem, edumazet, kuba, pabeni, mcoquelin.stm32, ahalaney,
	jesse.brandeburg, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, bartosz.golaszewski

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri,  2 Jun 2023 21:04:55 +0200 you wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We must not assign plat_dat->dwmac4_addrs unconditionally as for
> structures which don't set them, this will result in the core driver
> using zeroes everywhere and breaking the driver for older HW. On EMAC < 2
> the address should remain NULL.
> 
> [...]

Here is the summary with links:
  - [net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3
    https://git.kernel.org/netdev/net/c/9bc009734774

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] 5+ messages in thread

end of thread, other threads:[~2023-06-05 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02 19:04 [PATCH net] net: stmmac: dwmac-qcom-ethqos: fix a regression on EMAC < 3 Bartosz Golaszewski
2023-06-02 19:30 ` Andrew Halaney
2023-06-03  6:30 ` Siddharth Vadapalli
2023-06-05  7:06 ` Vinod Koul
2023-06-05 10:40 ` 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;
as well as URLs for NNTP newsgroup(s).