* [PATCH] wifi: rtw88: use firmware MAC address as fallback
@ 2026-09-01 12:45 YuChia-Kan
2026-09-02 1:22 ` Ping-Ke Shih
2026-09-02 2:46 ` [PATCH v2] " YuChia-Kan
0 siblings, 2 replies; 6+ messages in thread
From: YuChia-Kan @ 2026-09-01 12:45 UTC (permalink / raw)
To: linux-wireless; +Cc: pkshih, linux-kernel, YuChia-Kan
Some devices provide the Wi-Fi MAC address through firmware instead of
storing a valid address in the chip efuse.
Try to read the MAC address from firmware before falling back to a
randomly generated address.
Signed-off-by: YuChia-Kan <raspberrykan@stu.hqu.edu.cn>
---
drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index cd9254370fcc..b9d8e0f5d15e 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2060,8 +2060,12 @@ static int rtw_chip_efuse_info_setup(struct rtw_dev *rtwdev)
efuse->ext_lna_5g = efuse->lna_type_5g & BIT(3) ? 1 : 0;
if (!is_valid_ether_addr(efuse->addr)) {
- eth_random_addr(efuse->addr);
- dev_warn(rtwdev->dev, "efuse MAC invalid, using random\n");
+ mac_ret = device_get_mac_address(rtwdev->dev, efuse->addr);
+ if (mac_ret) {
+ eth_random_addr(efuse->addr);
+ dev_warn(rtwdev->dev,
+ "failed to get valid MAC address, using random\n");
+ }
}
out_disable:
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] wifi: rtw88: use firmware MAC address as fallback
2026-09-01 12:45 [PATCH] wifi: rtw88: use firmware MAC address as fallback YuChia-Kan
@ 2026-09-02 1:22 ` Ping-Ke Shih
[not found] ` <SEZPR04MB617269B16E24E662180A7678FFB72@SEZPR04MB6172.apcprd04.prod.outlook.com>
2026-09-02 2:46 ` [PATCH v2] " YuChia-Kan
1 sibling, 1 reply; 6+ messages in thread
From: Ping-Ke Shih @ 2026-09-02 1:22 UTC (permalink / raw)
To: YuChia-Kan, linux-wireless; +Cc: linux-kernel
YuChia-Kan <raspberrykan@stu.hqu.edu.cn> wrote:
> Some devices provide the Wi-Fi MAC address through firmware instead of
> storing a valid address in the chip efuse.
>
> Try to read the MAC address from firmware before falling back to a
> randomly generated address.
Please share the board and WiFi chip you are using.
>
> Signed-off-by: YuChia-Kan <raspberrykan@stu.hqu.edu.cn>
> ---
> drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index cd9254370fcc..b9d8e0f5d15e 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -2060,8 +2060,12 @@ static int rtw_chip_efuse_info_setup(struct rtw_dev *rtwdev)
> efuse->ext_lna_5g = efuse->lna_type_5g & BIT(3) ? 1 : 0;
>
> if (!is_valid_ether_addr(efuse->addr)) {
> - eth_random_addr(efuse->addr);
> - dev_warn(rtwdev->dev, "efuse MAC invalid, using random\n");
> + mac_ret = device_get_mac_address(rtwdev->dev, efuse->addr);
mac_ret isn't declared.
> + if (mac_ret) {
> + eth_random_addr(efuse->addr);
> + dev_warn(rtwdev->dev,
> + "failed to get valid MAC address, using random\n");
> + }
> }
>
> out_disable:
> --
> 2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] wifi: rtw88: use firmware MAC address as fallback
[not found] ` <SEZPR04MB617269B16E24E662180A7678FFB72@SEZPR04MB6172.apcprd04.prod.outlook.com>
@ 2026-09-02 2:33 ` Ping-Ke Shih
2026-09-02 3:10 ` 回复: " raspberrykan
0 siblings, 1 reply; 6+ messages in thread
From: Ping-Ke Shih @ 2026-09-02 2:33 UTC (permalink / raw)
To: raspberrykan, linux-wireless; +Cc: linux-kernel
(Please in plain text and not top posting)
raspberrykan@stu.hqu.edu.cn <raspberrykan@stu.hqu.edu.cn> wrote:
> > Please share the board and WiFi chip you are using.
> The board is a Xiaomi Mi Box 4 based on the Amlogic S905L SoC, and the
> WiFi chip is an RTL8723DS.
> On this device, the actual WiFi MAC address is stored in the S905L
> SoC's eFuse rather than in the RTL8723DS efuse. The platform firmware
> provides this MAC address to the device, so I am using
> device_get_mac_address() as a fallback when the MAC address read by
> rtw88 is invalid.
Please share it in commit message.
> The kernel tree I used for testing is also available here:
> https://github.com/Raspberry-Monster/linux
I see the top commit of [1]. The mac_ret is also missed. How can you
test it?
[1] https://github.com/Raspberry-Monster/linux/commits/rtw88-dt-mac/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] wifi: rtw88: use firmware MAC address as fallback
2026-09-01 12:45 [PATCH] wifi: rtw88: use firmware MAC address as fallback YuChia-Kan
2026-09-02 1:22 ` Ping-Ke Shih
@ 2026-09-02 2:46 ` YuChia-Kan
2026-09-02 3:14 ` [PATCH v3] " YuChia-Kan
1 sibling, 1 reply; 6+ messages in thread
From: YuChia-Kan @ 2026-09-02 2:46 UTC (permalink / raw)
To: linux-wireless; +Cc: pkshih, linux-kernel, YuChia-Kan
Some devices provide the Wi-Fi MAC address through firmware instead of
storing a valid address in the chip efuse.
Try to read the MAC address from firmware before falling back to a
randomly generated address.
Signed-off-by: YuChia-Kan <raspberrykan@stu.hqu.edu.cn>
---
Changes in v2:
- Fix the undeclared mac_ret issue by checking
device_get_mac_address() directly.
drivers/net/wireless/realtek/rtw88/main.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index cd9254370fcc..0f23498b5c96 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2060,8 +2060,11 @@ static int rtw_chip_efuse_info_setup(struct rtw_dev *rtwdev)
efuse->ext_lna_5g = efuse->lna_type_5g & BIT(3) ? 1 : 0;
if (!is_valid_ether_addr(efuse->addr)) {
- eth_random_addr(efuse->addr);
- dev_warn(rtwdev->dev, "efuse MAC invalid, using random\n");
+ if (device_get_mac_address(rtwdev->dev, efuse->addr)) {
+ eth_random_addr(efuse->addr);
+ dev_warn(rtwdev->dev,
+ "failed to get valid MAC address, using random\n");
+ }
}
out_disable:
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* 回复: [PATCH] wifi: rtw88: use firmware MAC address as fallback
2026-09-02 2:33 ` Ping-Ke Shih
@ 2026-09-02 3:10 ` raspberrykan
0 siblings, 0 replies; 6+ messages in thread
From: raspberrykan @ 2026-09-02 3:10 UTC (permalink / raw)
To: Ping-Ke Shih, linux-wireless; +Cc: linux-kernel
> Please share it in commit message.
Sure. I will include the hardware information in the commit message
in v3, since I had not seen this email when preparing v2.
> I see the top commit of [1]. The mac_ret is also missed. How can you
> test it?
I tested an earlier version on another kernel tree where `mac_ret` was
used to inspect the error returned when retrieving the MAC address
failed. When moving the change to this tree, I missed the declaration.
I have removed the unnecessary variable now and verified that
`rtw88/main.c` is actually compiled.
Sorry for the oversight.
Best regards,
YuChia Kan
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3] wifi: rtw88: use firmware MAC address as fallback
2026-09-02 2:46 ` [PATCH v2] " YuChia-Kan
@ 2026-09-02 3:14 ` YuChia-Kan
0 siblings, 0 replies; 6+ messages in thread
From: YuChia-Kan @ 2026-09-02 3:14 UTC (permalink / raw)
To: linux-wireless; +Cc: pkshih, linux-kernel, YuChia-Kan
Some devices provide the Wi-Fi MAC address through firmware instead of
storing a valid address in the Wi-Fi chip efuse.
This is the case on the Xiaomi Mi Box 4, which uses an Amlogic S905L
SoC and an RTL8723DS Wi-Fi chip. The Wi-Fi MAC address is stored in the
S905L efuse rather than the RTL8723DS efuse and is provided to the
device through firmware.
Try to read the MAC address from firmware before falling back to a
randomly generated address.
Signed-off-by: YuChia-Kan <raspberrykan@stu.hqu.edu.cn>
---
Changes in v3:
- Add Xiaomi Mi Box 4, Amlogic S905L and RTL8723DS hardware details
to the commit message.
drivers/net/wireless/realtek/rtw88/main.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index cd9254370fcc..0f23498b5c96 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2060,8 +2060,11 @@ static int rtw_chip_efuse_info_setup(struct rtw_dev *rtwdev)
efuse->ext_lna_5g = efuse->lna_type_5g & BIT(3) ? 1 : 0;
if (!is_valid_ether_addr(efuse->addr)) {
- eth_random_addr(efuse->addr);
- dev_warn(rtwdev->dev, "efuse MAC invalid, using random\n");
+ if (device_get_mac_address(rtwdev->dev, efuse->addr)) {
+ eth_random_addr(efuse->addr);
+ dev_warn(rtwdev->dev,
+ "failed to get valid MAC address, using random\n");
+ }
}
out_disable:
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-02 3:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 12:45 [PATCH] wifi: rtw88: use firmware MAC address as fallback YuChia-Kan
2026-09-02 1:22 ` Ping-Ke Shih
[not found] ` <SEZPR04MB617269B16E24E662180A7678FFB72@SEZPR04MB6172.apcprd04.prod.outlook.com>
2026-09-02 2:33 ` Ping-Ke Shih
2026-09-02 3:10 ` 回复: " raspberrykan
2026-09-02 2:46 ` [PATCH v2] " YuChia-Kan
2026-09-02 3:14 ` [PATCH v3] " YuChia-Kan
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®