Skip to contentSkip to conversation

brcmfmac: set wiphy's addr_mask to force using valid MACs

PATCH In review Rafał Miłecki 1 participant 2 messages Jul 9, 2015 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmfmac: set wiphy's addr_mask to force using valid MACs

Broadcom's firmware requires every BSS to use MAC address with unique last 2 bits. Otherwise it rejects submitted MAC which results in:
brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52

Set addr_mask properly to hint only last 2 bits can be modified. This isn't exactly true as all bits can be changed but that's the only way to force unique values in the last 2 bits.

---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +5 -0
index d86d1f1..4ab1d92 100644
@@ -6100,6 +6100,11 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
 		return NULL;
 	}
 	memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
+	/* Firmware requires last 2 bits to contain unique value for every BSS.
+	 * Unfortunately this will also disallow changing other bits (firmware
+	 * supports it as long as last 2 bits are unique) but it's the only way.
+	 */
+	wiphy->addr_mask[ETH_ALEN - 1] = 0x02;
 	set_wiphy_dev(wiphy, busdev);
 
 	cfg = wiphy_priv(wiphy);
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 7 lines · Rafał Miłecki

Broadcom's firmware requires every BSS to use MAC address with unique last 2 bits. Otherwise it rejects submitted MAC which results in:
brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52

Set addr_mask properly to hint only last 2 bits can be modified. This isn't exactly true as all bits can be changed but that's the only way to force unique values in the last 2 bits.

I asked Felix about this and he pointed it may be not a good idea to disallow using locally administrated bit.

I'll rework my fix to provide a full list of addresses that shall be used. Please drop this one.