Skip to contentSkip to conversation

wifi: ath11k: retrieve MAC address from system firmware if provided

PATCH Superseded Jun Yu 2 participants 2 messages Sep 19, 2022 Qualcomm Atheros ATH11K wireless driver

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jun Yu

author
#0 lore raw

PATCH v2 1/1 wifi: ath11k: retrieve MAC address from system firmware if provided

Devices may provide their own MAC address via system firmware (e.g., device tree), especially in the case where the device doesn't have a useful EEPROM on which to store its MAC address (e.g., for integrated ahb WCN6750).

Use the generic device helper to retrieve the MAC address, and (if present) honor it above the MAC address advertised by the card.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

---
 drivers/net/wireless/ath/ath11k/mac.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/mac.c +7 -1
index 7e91e347c9ff2..16a238ef713e7 100644
@@ -8967,6 +8967,7 @@ int ath11k_mac_register(struct ath11k_base *ab)
 	struct ath11k_pdev *pdev;
 	int i;
 	int ret;
+	u8 mac_addr[ETH_ALEN] = {0};
 
 	if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))
 		return 0;
@@ -8979,13 +8980,18 @@ int ath11k_mac_register(struct ath11k_base *ab)
 	if (ret)
 		return ret;
 
+	device_get_mac_address(ab->dev, mac_addr);
+
 	for (i = 0; i < ab->num_radios; i++) {
 		pdev = &ab->pdevs[i];
 		ar = pdev->ar;
 		if (ab->pdevs_macaddr_valid) {
 			ether_addr_copy(ar->mac_addr, pdev->mac_addr);
 		} else {
-			ether_addr_copy(ar->mac_addr, ab->mac_addr);
+			if (is_zero_ether_addr(mac_addr))
+				ether_addr_copy(ar->mac_addr, ab->mac_addr);
+			else
+				ether_addr_copy(ar->mac_addr, mac_addr);
 			ar->mac_addr[4] += i;
 		}
 
Signature · 1 line
2.31.0
#1 lore raw
Quoted 5 lines · Jun Yu

Devices may provide their own MAC address via system firmware (e.g., device tree), especially in the case where the device doesn't have a useful EEPROM on which to store its MAC address (e.g., for integrated ahb WCN6750).

Quoted 7 lines

Use the generic device helper to retrieve the MAC address, and (if present) honor it above the MAC address advertised by the card.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

---

v2 but no changelog?

Quoted 2 lines
  drivers/net/wireless/ath/ath11k/mac.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 3 lines
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k