Skip to contentSkip to conversation

wifi: rtw89: 8922a: set random mac if efuse contains zeroes

PATCH Superseded Jose Ignacio Tornos Martinez 2 participants 3 messages Nov 25, 2025 – Nov 26, 2025 Realtek wireless driver (rtw89)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: rtw89: 8922a: set random mac if efuse contains zeroes

I have some rtl8952ae devices with no permanent mac stored in efuse.

It could be properly saved and/or configured from user tools like NetworkManager, but it would be desirable to be able to initialize it somehow to get the device working by default.

So, in the same way as with other devices, if the mac address read from efuse contains zeros, a random mac address is assigned to at least allow operation, and the user is warned about this in case any action needs to be considered.

---
 drivers/net/wireless/realtek/rtw89/rtw8922a.c | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8922a.c +18 -4
index 6aa19ad259ac..050307fa16d2 100644
@@ -636,16 +636,30 @@ static int rtw8922a_read_efuse_rf(struct rtw89_dev *rtwdev, u8 *log_map)
 static int rtw8922a_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map,
 			       enum rtw89_efuse_block block)
 {
+	struct rtw89_efuse *efuse = &rtwdev->efuse;
+	int ret;
+
 	switch (block) {
 	case RTW89_EFUSE_BLOCK_HCI_DIG_PCIE_SDIO:
-		return rtw8922a_read_efuse_pci_sdio(rtwdev, log_map);
+		ret = rtw8922a_read_efuse_pci_sdio(rtwdev, log_map);
+		break;
 	case RTW89_EFUSE_BLOCK_HCI_DIG_USB:
-		return rtw8922a_read_efuse_usb(rtwdev, log_map);
+		ret = rtw8922a_read_efuse_usb(rtwdev, log_map);
+		break;
 	case RTW89_EFUSE_BLOCK_RF:
-		return rtw8922a_read_efuse_rf(rtwdev, log_map);
+		ret = rtw8922a_read_efuse_rf(rtwdev, log_map);
+		break;
 	default:
-		return 0;
+		ret = 0;
+		break;
+	}
+
+	if (!ret && is_zero_ether_addr(efuse->addr)) {
+		rtw89_warn(rtwdev,"efuse mac address is zero, using random mac");
+		eth_random_addr(efuse->addr);
 	}
+
+	return ret;
 }
 
 #define THM_TRIM_POSITIVE_MASK BIT(6)
Signature · 1 line
2.51.1
maintainer
#1 lore raw
Quoted 1 line · Jose Ignacio Tornos Martinez

I have some rtl8952ae devices with no permanent mac stored in efuse.

I think rtl8952ae is NOT a typo, but it is surprising me that this driver can bring it up. Does it really work well? And where did you get the hardware?

Quoted 38 lines

It could be properly saved and/or configured from user tools like NetworkManager, but it would be desirable to be able to initialize it somehow to get the device working by default.

So, in the same way as with other devices, if the mac address read from efuse contains zeros, a random mac address is assigned to at least allow operation, and the user is warned about this in case any action needs to be considered.

---
 drivers/net/wireless/realtek/rtw89/rtw8922a.c | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8922a.c +7 -3
index 6aa19ad259ac..050307fa16d2 100644
@@ -636,16 +636,30 @@ static int rtw8922a_read_efuse_rf(struct rtw89_dev *rtwdev, u8 *log_map)
 static int rtw8922a_read_efuse(struct rtw89_dev *rtwdev, u8 *log_map,
                               enum rtw89_efuse_block block)
 {
+       struct rtw89_efuse *efuse = &rtwdev->efuse;
+       int ret;
+
        switch (block) {
        case RTW89_EFUSE_BLOCK_HCI_DIG_PCIE_SDIO:
-               return rtw8922a_read_efuse_pci_sdio(rtwdev, log_map);
+               ret = rtw8922a_read_efuse_pci_sdio(rtwdev, log_map);
+               break;
        case RTW89_EFUSE_BLOCK_HCI_DIG_USB:
-               return rtw8922a_read_efuse_usb(rtwdev, log_map);
+               ret = rtw8922a_read_efuse_usb(rtwdev, log_map);
+               break;
        case RTW89_EFUSE_BLOCK_RF:
-               return rtw8922a_read_efuse_rf(rtwdev, log_map);

drivers/net/wireless/realtek/rtw89/rtw8922a.c static int rtw8922a_read_efuse_rf(struct rtw89_dev *rtwdev, u8 *log_map) · line 658

Quoted 10 lines
drivers/net/wireless/realtek/rtw89/rtw8922a.c +8 -1
+               ret = rtw8922a_read_efuse_rf(rtwdev, log_map);
+               break;
        default:
-               return 0;
+               ret = 0;
+               break;
+       }
+
+       if (!ret && is_zero_ether_addr(efuse->addr)) {
+               rtw89_warn(rtwdev,"efuse mac address is zero, using random mac");

I think rtw89_info() is more suitable.

Need a '\n' at end of the message, and you missed a space after comma.

Quoted 9 lines
drivers/net/wireless/realtek/rtw89/rtw8922a.c +3 -1
+               eth_random_addr(efuse->addr);
        }
+
+       return ret;
 }
 
 #define THM_TRIM_POSITIVE_MASK BIT(6)
--

2.51.1

#2 lore raw
Quoted 2 lines

I think rtl8952ae is NOT a typo, but it is surprising me that this driver can bring it up. Does it really work well? And where did you get the hardware?

Sorry, it is a typo (I was checking other realtek cards too at the same time), I have some rtl8922ae:

# lspci -nn
...
07:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8922AE 802.11be PCIe Wireless Network Adapter [10ec:8922] (rev 01)

And yes, it really works well (only the mac with zeroes). The hardware comes from a normal provider.

Quoted 1 line

I think rtw89_info() is more suitable.

Ok

Quoted 1 line

Need a '\n' at end of the message, and you missed a space after comma.

Ok

I will send a second version of the patch with this. Thank you for reviewing

Best regards
José Ignacio