Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c95dcb59 authored by Aarthi Thiruvengadam's avatar Aarthi Thiruvengadam Committed by Kalle Valo
Browse files

ath6kl: use custom MAC address for newly created interfaces



Firmware and driver generate MAC addresses for the second and third interfaces.
In addition to the existing algorithm, flip bit 7 of 5th octet. Since both
firmware and driver individually generate the MAC addresses, introduce a new
firmware capability bit to keep them compatible.

Signed-off-by: default avatarAarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 85b20fc2
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -3523,9 +3523,13 @@ struct wireless_dev *ath6kl_interface_add(struct ath6kl *ar, const char *name,
	vif->htcap[IEEE80211_BAND_5GHZ].ht_enable = true;
	vif->htcap[IEEE80211_BAND_5GHZ].ht_enable = true;


	memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
	memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
	if (fw_vif_idx != 0)
	if (fw_vif_idx != 0) {
		ndev->dev_addr[0] = (ndev->dev_addr[0] ^ (1 << fw_vif_idx)) |
		ndev->dev_addr[0] = (ndev->dev_addr[0] ^ (1 << fw_vif_idx)) |
				     0x2;
				     0x2;
		if (test_bit(ATH6KL_FW_CAPABILITY_CUSTOM_MAC_ADDR,
			     ar->fw_capabilities))
			ndev->dev_addr[4] ^= 0x80;
	}


	init_netdev(ndev);
	init_netdev(ndev);


+3 −0
Original line number Original line Diff line number Diff line
@@ -118,6 +118,9 @@ enum ath6kl_fw_capability {
	/* Firmware supports filtering BSS results by RSSI */
	/* Firmware supports filtering BSS results by RSSI */
	ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD,
	ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD,


	/* FW sets mac_addr[4] ^= 0x80 for newly created interfaces */
	ATH6KL_FW_CAPABILITY_CUSTOM_MAC_ADDR,

	/* this needs to be last */
	/* this needs to be last */
	ATH6KL_FW_CAPABILITY_MAX,
	ATH6KL_FW_CAPABILITY_MAX,
};
};