1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
2 Date: Thu, 9 Jul 2015 16:53:30 +0200
3 Subject: [PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
8 Broadcom's firmware requires every BSS to use MAC address with unique
9 last few bits. The amount of bits may depend on a particular firmware,
10 it was verified to be 2 for BCM43602 one.
11 If this condition won't be fulfilled firmware will reject such MAC:
12 brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52
14 We don't want to simply set addr_mask as it would also disallow using
15 locally administrated bit. Instead let's build a list of addresses
16 manually enabling 0x2 bit for extra interfaces.
18 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
21 --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
22 +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
23 @@ -5813,6 +5813,7 @@ static void brcmf_wiphy_wowl_params(struct wiphy *wiphy)
25 static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
27 + struct brcmf_pub *drvr = ifp->drvr;
28 struct ieee80211_supported_band *band;
31 @@ -5826,6 +5827,19 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
35 + for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
36 + i < ARRAY_SIZE(drvr->addresses); i++) {
37 + u8 *addr = drvr->addresses[i].addr;
39 + memcpy(addr, drvr->mac, ETH_ALEN);
42 + addr[ETH_ALEN - 1] ^= i;
45 + wiphy->addresses = drvr->addresses;
46 + wiphy->n_addresses = i;
48 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
49 wiphy->cipher_suites = __wl_cipher_suites;
50 wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
51 --- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
52 +++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
54 #ifndef BRCMFMAC_CORE_H
55 #define BRCMFMAC_CORE_H
57 +#include <net/cfg80211.h>
60 #define TOE_TX_CSUM_OL 0x00000001
61 @@ -118,6 +119,8 @@ struct brcmf_pub {
62 /* Multicast data packets sent to dongle */
63 unsigned long tx_multicast;
65 + struct mac_address addresses[BRCMF_MAX_IFS];
67 struct brcmf_if *iflist[BRCMF_MAX_IFS];
69 struct mutex proto_block;