🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Andrew Gaylard Fri, 20 Nov 2026 07:39
[PATCH net-next v2] net: sunplus: also fix the byte order of 1c:50:1e MAC addresses
#19674
Author: Andrew Gaylard
Date: Fri, 20 Nov 2026 07:39
60 lines
13289 bytes
The driver reverses a MAC address from the OTP when it finds the
Sunplus OUI fc:4b:bc at the wrong end. Newer SP7021 chips have
a different Sunplus OUI (1c:50:1e), possibly stored in the same
reversed order, which the driver does not recognise. If the reversed
address has the multicast bit set, the driver rejects it and uses a
random address; otherwise it uses the reversed address as it is.

Handle both these OUIs. An address that already starts with either OUI
is left as is.  On chips that used the reversed address, the interface
now gets the correct address, so configuration tied to the old address
(DHCP reservations, udev or networkd rules) will need updating.

Tested on chips that needed each of these OUIs to be reversed.

Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: Andrew Gaylard <ag@ffroot.co.za>
---
v2: Use a helper that checks for both OUIs instead of an OUI table and
    two loops, as suggested by Daniel Machon.
v1: https://lore.kernel.org/netdev/20261112123738.429728-1-ag@ffroot.co.za/

 drivers/net/ethernet/sunplus/spl2sw_driver.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
index 9ccaf928ed66..b5ae950f6d5b 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -203,15 +203,20 @@ static const struct net_device_ops netdev_ops = {
 	.ndo_tx_timeout = spl2sw_ethernet_tx_timeout,
 };
 
+static bool spl2sw_is_sunplus_oui(u8 b0, u8 b1, u8 b2)
+{
+	return (b0 == 0xfc && b1 == 0x4b && b2 == 0xbc) ||
+	       (b0 == 0x1c && b1 == 0x50 && b2 == 0x1e);
+}
+
 static void spl2sw_check_mac_vendor_id_and_convert(u8 *mac_addr)
 {
-	/* Byte order of MAC address of some samples are reversed.
-	 * Check vendor id and convert byte order if it is wrong.
-	 * OUI of Sunplus: fc:4b:bc
+	/* Some chips have the byte order of the MAC address reversed.
+	 * Check for the Sunplus OUIs (fc:4b:bc, 1c:50:1e) and fix the
+	 * byte order if it is.
 	 */
-	if (mac_addr[5] == 0xfc && mac_addr[4] == 0x4b && mac_addr[3] == 0xbc &&
-	    (mac_addr[0] != 0xfc || mac_addr[1] != 0x4b || mac_addr[2] != 0xbc)) {
-
+	if (spl2sw_is_sunplus_oui(mac_addr[5], mac_addr[4], mac_addr[3]) &&
+	    !spl2sw_is_sunplus_oui(mac_addr[0], mac_addr[1], mac_addr[2])) {
 		swap(mac_addr[0], mac_addr[5]);
 		swap(mac_addr[1], mac_addr[4]);
 		swap(mac_addr[2], mac_addr[3]);

base-commit: 2208ab00f4f213ade91ab775e7f8c4dacdcc856e
-- 
2.53.0
Re: [PATCH net-next v2] net: sunplus: also fix the byte order of 1c:50:1e MAC addresses
#19812
Author: Andrew Lunn
Date: Fri, 20 Nov 2026 13:00
22 lines
9188 bytes
On Fri, Nov 20, 2026 at 09:39:01AM +0200, Andrew Gaylard wrote:
> The driver reverses a MAC address from the OTP when it finds the
> Sunplus OUI fc:4b:bc at the wrong end. Newer SP7021 chips have
> a different Sunplus OUI (1c:50:1e), possibly stored in the same
> reversed order, which the driver does not recognise. If the reversed
> address has the multicast bit set, the driver rejects it and uses a
> random address; otherwise it uses the reversed address as it is.
> 
> Handle both these OUIs. An address that already starts with either OUI
> is left as is.  On chips that used the reversed address, the interface
> now gets the correct address, so configuration tied to the old address
> (DHCP reservations, udev or networkd rules) will need updating.
> 
> Tested on chips that needed each of these OUIs to be reversed.
> 
> Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
> Signed-off-by: Andrew Gaylard <ag@ffroot.co.za>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Re: [PATCH net-next v2] net: sunplus: also fix the byte order of 1c:50:1e MAC addresses
#22270
Author: patchwork-bot+netdevbpf
Date: Wed, 25 Nov 2026 02:50
24 lines
8696 bytes
Hello:

This patch was applied to netdev/net-next.git (main)
by Willem de Bruijn <willemb@google.com>:

On Fri, 20 Nov 2026 09:39:01 +0200 you wrote:
> The driver reverses a MAC address from the OTP when it finds the
> Sunplus OUI fc:4b:bc at the wrong end. Newer SP7021 chips have
> a different Sunplus OUI (1c:50:1e), possibly stored in the same
> reversed order, which the driver does not recognise. If the reversed
> address has the multicast bit set, the driver rejects it and uses a
> random address; otherwise it uses the reversed address as it is.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: sunplus: also fix the byte order of 1c:50:1e MAC addresses
    https://git.kernel.org/netdev/net-next/c/612848d37e68

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads