* [PATCH v2] wifi: rtw89: 8922a: set random mac if efuse contains zeroes
@ 2025-11-26 9:18 Jose Ignacio Tornos Martinez
2025-11-27 0:46 ` Ping-Ke Shih
2025-12-23 3:44 ` Ping-Ke Shih
0 siblings, 2 replies; 3+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2025-11-26 9:18 UTC (permalink / raw)
To: pkshih, linux-wireless, linux-kernel; +Cc: Jose Ignacio Tornos Martinez
I have some rtl8922ae 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.
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
---
v2:
- Fix the typo for the hardware model in comments.
- Use rtw89_info instead of rtw89_warn.
- Some fixes in the format of the info message.
v1: https://lore.kernel.org/all/20251125120350.228288-1-jtornosm@redhat.com/
drivers/net/wireless/realtek/rtw89/rtw8922a.c | 22 +++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922a.c b/drivers/net/wireless/realtek/rtw89/rtw8922a.c
index 6aa19ad259ac..050307fa16d2 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8922a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8922a.c
@@ -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_info(rtwdev, "efuse mac address is zero, using random mac\n");
+ eth_random_addr(efuse->addr);
}
+
+ return ret;
}
#define THM_TRIM_POSITIVE_MASK BIT(6)
--
2.51.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH v2] wifi: rtw89: 8922a: set random mac if efuse contains zeroes
2025-11-26 9:18 [PATCH v2] wifi: rtw89: 8922a: set random mac if efuse contains zeroes Jose Ignacio Tornos Martinez
@ 2025-11-27 0:46 ` Ping-Ke Shih
2025-12-23 3:44 ` Ping-Ke Shih
1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-11-27 0:46 UTC (permalink / raw)
To: Jose Ignacio Tornos Martinez, linux-wireless, linux-kernel
Jose Ignacio Tornos Martinez <jtornosm@redhat.com> wrote:
> I have some rtl8922ae 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.
>
> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] wifi: rtw89: 8922a: set random mac if efuse contains zeroes
2025-11-26 9:18 [PATCH v2] wifi: rtw89: 8922a: set random mac if efuse contains zeroes Jose Ignacio Tornos Martinez
2025-11-27 0:46 ` Ping-Ke Shih
@ 2025-12-23 3:44 ` Ping-Ke Shih
1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-12-23 3:44 UTC (permalink / raw)
To: Jose Ignacio Tornos Martinez, pkshih, linux-wireless, linux-kernel
Cc: Jose Ignacio Tornos Martinez
Jose Ignacio Tornos Martinez <jtornosm@redhat.com> wrote:
> I have some rtl8922ae 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.
>
> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
41be33d3efc1 wifi: rtw89: 8922a: set random mac if efuse contains zeroes
---
https://github.com/pkshih/rtw.git
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-23 3:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-26 9:18 [PATCH v2] wifi: rtw89: 8922a: set random mac if efuse contains zeroes Jose Ignacio Tornos Martinez
2025-11-27 0:46 ` Ping-Ke Shih
2025-12-23 3:44 ` Ping-Ke Shih
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®