diff mbox

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

Message ID 1436445980-22196-1-git-send-email-zajec5@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Rafał Miłecki July 9, 2015, 12:46 p.m. UTC
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.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Rafał Miłecki July 9, 2015, 2:09 p.m. UTC | #1
On 9 July 2015 at 14:46, Rafa? Mi?ecki <zajec5@gmail.com> wrote:
> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index d86d1f1..4ab1d92 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -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);