Netdev List
 help / color / mirror / Atom feed
* [PATCH net v4] tg3: use random MAC address when tg3_get_device_address fails
@ 2026-09-18 22:47 Ivan Delalande
  2026-09-24  2:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Delalande @ 2026-09-18 22:47 UTC (permalink / raw)
  To: Jakub Kicinski, Andrew Lunn, Pavan Chebbi
  Cc: netdev, Paul SAGE, Vincent MORVAN, Atharva Tiwari, Michael Chan,
	mchan, David S. Miller, Eric Dumazet, Paolo Abeni

Some of the tg3 NICs we use (BCM57762) reset the SRAM MAC address to the
placeholder address on link flaps, tg3_chip_reset, etc. We've typically
fixed it from userspace, but since e4c00ba7274b ("tg3: replace
placeholder MAC address with device property") was merged, tg3 just
fails probe as we don't have a way to get it through the generic
device_get_mac_address infrastructure as fallback on our systems.

Make the driver assign a random address in this condition instead of
being fatal for probe. Set deferred_probe_reason through dev_warn_probe
if the address isn't yet available from the provider.

Fixes: e4c00ba7274b ("tg3: replace placeholder MAC address with device property")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/netdev/20260909191751.651aa5c4@kernel.org/
Signed-off-by: Ivan Delalande <colona@arista.com>
---
v4: use dev_warn_probe and the more compact calling form,
v3: https://lore.kernel.org/netdev/20260917223416.GA245819@visor/t/
    handle EPROBE_DEFER, set deferred_reason through dev_err_probe,
v2: https://lore.kernel.org/netdev/20260914230521.GA1400582@visor/t/
    assign random address instead of changing the logic in
    tg3_get_device_address,
v1: https://lore.kernel.org/netdev/20260903233255.GA4109366@visor/t/
---
 drivers/net/ethernet/broadcom/tg3.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 73a4b569b03e..6b8cb5b50f98 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17915,11 +17915,14 @@ static int tg3_init_one(struct pci_dev *pdev,
 
 	err = tg3_get_device_address(tp, addr);
 	if (err) {
-		dev_err(&pdev->dev,
-			"Could not obtain valid ethernet address, aborting\n");
-		goto err_out_apeunmap;
+		dev_warn_probe(&pdev->dev, err,
+			       "Could not obtain a valid ethernet address\n");
+		if (err == -EPROBE_DEFER)
+			goto err_out_apeunmap;
+		eth_hw_addr_random(dev);
+	} else {
+		eth_hw_addr_set(dev, addr);
 	}
-	eth_hw_addr_set(dev, addr);
 
 	intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW;
 	rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW;
-- 
2.43.0

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

* Re: [PATCH net v4] tg3: use random MAC address when tg3_get_device_address fails
  2026-09-18 22:47 [PATCH net v4] tg3: use random MAC address when tg3_get_device_address fails Ivan Delalande
@ 2026-09-24  2:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-24  2:10 UTC (permalink / raw)
  To: Ivan Delalande
  Cc: kuba, andrew+netdev, pavan.chebbi, netdev, paul.sage, vinc,
	atharvatiwarilinuxdev, michael.chan, mchan, davem, edumazet,
	pabeni

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 18 Sep 2026 15:47:15 -0700 you wrote:
> Some of the tg3 NICs we use (BCM57762) reset the SRAM MAC address to the
> placeholder address on link flaps, tg3_chip_reset, etc. We've typically
> fixed it from userspace, but since e4c00ba7274b ("tg3: replace
> placeholder MAC address with device property") was merged, tg3 just
> fails probe as we don't have a way to get it through the generic
> device_get_mac_address infrastructure as fallback on our systems.
> 
> [...]

Here is the summary with links:
  - [net,v4] tg3: use random MAC address when tg3_get_device_address fails
    https://git.kernel.org/netdev/net/c/4eb3f195ef08

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

end of thread, other threads:[~2026-09-24  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 22:47 [PATCH net v4] tg3: use random MAC address when tg3_get_device_address fails Ivan Delalande
2026-09-24  2:10 ` 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