public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] tg3: replace placeholder MAC address with device property
@ 2026-03-14 21:54 Atharva Tiwari
  2026-03-16 19:00 ` Michael Chan
  2026-03-17  4:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Atharva Tiwari @ 2026-03-14 21:54 UTC (permalink / raw)
  Cc: Atharva Tiwari, Rishon Jonathan R, Vincent MORVAN, Paul SAGE,
	Pavan Chebbi, Michael Chan, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

From: Paul SAGE <paul.sage@42.fr>

On some systems (e.g. iMac 20,1 with BCM57766), the tg3 driver reads
a default placeholder mac address (00:10:18:00:00:00) from the
mailbox. The correct value on those systems are stored in the
'local-mac-address' property.

This patch, detect the default value and tries to retrieve
the correct address from the device_get_mac_address
function instead.

The patch has been tested on two different systems:
- iMac 20,1 (BCM57766) model which use the local-mac-address property
- iMac 13,2 (BCM57766) model which can use the mailbox,
    NVRAM or MAC control registers

Tested-by: Rishon Jonathan R <mithicalaviator85@gmail.com>

Co-developed-by: Vincent MORVAN <vinc@42.fr>
Signed-off-by: Vincent MORVAN <vinc@42.fr>
Signed-off-by: Paul SAGE <paul.sage@42.fr>
Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>

---
---
v4:
- Used static for default_mac_address
- Returned the value of device_get_mac_address in tg3_get_device_address
v3:
- Used ether_addr_equal
v2:
- Wrapped commit message to 70 characters
- Removed BROADCOM_OUI constant
---
---
 drivers/net/ethernet/broadcom/tg3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 75f66587983d..a80f27e66ab5 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17030,6 +17030,13 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
 	return err;
 }
 
+static int tg3_is_default_mac_address(u8 *addr)
+{
+	static const u8 default_mac_address[ETH_ALEN] = { 0x00, 0x10, 0x18, 0x00, 0x00, 0x00 };
+
+	return ether_addr_equal(default_mac_address, addr);
+}
+
 static int tg3_get_device_address(struct tg3 *tp, u8 *addr)
 {
 	u32 hi, lo, mac_offset;
@@ -17103,6 +17110,10 @@ static int tg3_get_device_address(struct tg3 *tp, u8 *addr)
 
 	if (!is_valid_ether_addr(addr))
 		return -EINVAL;
+
+	if (tg3_is_default_mac_address(addr))
+		return device_get_mac_address(&tp->pdev->dev, addr);
+
 	return 0;
 }
 
-- 
2.43.0


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

* Re: [PATCH v4] tg3: replace placeholder MAC address with device property
  2026-03-14 21:54 [PATCH v4] tg3: replace placeholder MAC address with device property Atharva Tiwari
@ 2026-03-16 19:00 ` Michael Chan
  2026-03-17  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Chan @ 2026-03-16 19:00 UTC (permalink / raw)
  To: Atharva Tiwari
  Cc: Rishon Jonathan R, Vincent MORVAN, Paul SAGE, Pavan Chebbi,
	Michael Chan, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

On Sat, Mar 14, 2026 at 2:54 PM Atharva Tiwari
<atharvatiwarilinuxdev@gmail.com> wrote:
>
> From: Paul SAGE <paul.sage@42.fr>
>
> On some systems (e.g. iMac 20,1 with BCM57766), the tg3 driver reads
> a default placeholder mac address (00:10:18:00:00:00) from the
> mailbox. The correct value on those systems are stored in the
> 'local-mac-address' property.
>
> This patch, detect the default value and tries to retrieve
> the correct address from the device_get_mac_address
> function instead.
>
> The patch has been tested on two different systems:
> - iMac 20,1 (BCM57766) model which use the local-mac-address property
> - iMac 13,2 (BCM57766) model which can use the mailbox,
>     NVRAM or MAC control registers
>
> Tested-by: Rishon Jonathan R <mithicalaviator85@gmail.com>
>
> Co-developed-by: Vincent MORVAN <vinc@42.fr>
> Signed-off-by: Vincent MORVAN <vinc@42.fr>
> Signed-off-by: Paul SAGE <paul.sage@42.fr>
> Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>

Reviewed-by: Michael Chan <michael.chan@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5469 bytes --]

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

* Re: [PATCH v4] tg3: replace placeholder MAC address with device property
  2026-03-14 21:54 [PATCH v4] tg3: replace placeholder MAC address with device property Atharva Tiwari
  2026-03-16 19:00 ` Michael Chan
@ 2026-03-17  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-17  4:00 UTC (permalink / raw)
  To: Atharva Tiwari
  Cc: mithicalaviator85, vinc, paul.sage, pavan.chebbi, mchan,
	andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

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

On Sun, 15 Mar 2026 03:24:30 +0530 you wrote:
> From: Paul SAGE <paul.sage@42.fr>
> 
> On some systems (e.g. iMac 20,1 with BCM57766), the tg3 driver reads
> a default placeholder mac address (00:10:18:00:00:00) from the
> mailbox. The correct value on those systems are stored in the
> 'local-mac-address' property.
> 
> [...]

Here is the summary with links:
  - [v4] tg3: replace placeholder MAC address with device property
    https://git.kernel.org/netdev/net/c/e4c00ba7274b

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

end of thread, other threads:[~2026-03-17  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-14 21:54 [PATCH v4] tg3: replace placeholder MAC address with device property Atharva Tiwari
2026-03-16 19:00 ` Michael Chan
2026-03-17  4:00 ` 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