mac80211: brcmfmac: fix support for BCM4366
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
2 Date: Mon, 30 May 2016 06:40:54 +0200
3 Subject: [PATCH] brcmfmac: don't remove interface on link down firmware event
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 There are two firmware events we handle similarly in brcmfmac:
9 BRCMF_E_LINK and BRCMF_E_IF. The difference from firmware point of view
10 is that the first one means BSS remains present in the firmware. Trying
11 to (re)create it (e.g. when adding new virtual interface) will result in
12 an error.
13
14 Current code treats both events in a similar way. It removes Linux
15 interface for each of them. It works OK with e.g. BCM43602. Its firmware
16 generates both events for each interface. It means we get BRCMF_E_LINK
17 and remove interface. That is soon followed by BRCMF_E_IF which means
18 BSS was also removed in a firmware. The only downside of this is a
19 harmless error like:
20 [ 208.643180] brcmfmac: brcmf_fweh_call_event_handler: no interface object
21
22 Unfortunately BCM4366 firmware doesn't automatically remove BSS and so
23 it doesn't generate BRCMF_E_IF. In such case we incorrectly remove Linux
24 interface on BRCMF_E_LINK as BSS is still present in the firmware. It
25 results in an error when trying to re-create virtual interface, e.g.:
26 > iw phy phy1 interface add wlan1-1 type __ap
27 [ 3602.929199] brcmfmac: brcmf_ap_add_vif: timeout occurred
28 command failed: I/O error (-5)
29
30 With this patch we don't remove Linux interface while firmware keeps
31 BSS. Thanks to this we keep a consistent states of host driver and
32 device firmware.
33
34 Further improvement should be to mark BSS as disabled and remove
35 interface on BRCMF_E_LINK. Then we should add support for reusing
36 BSS-es.
37
38 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
39 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
40 ---
41
42 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
43 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
44 @@ -5388,7 +5388,6 @@ brcmf_notify_connect_status_ap(struct br
45 struct net_device *ndev,
46 const struct brcmf_event_msg *e, void *data)
47 {
48 - struct brcmf_if *ifp = netdev_priv(ndev);
49 static int generation;
50 u32 event = e->event_code;
51 u32 reason = e->reason;
52 @@ -5399,8 +5398,6 @@ brcmf_notify_connect_status_ap(struct br
53 ndev != cfg_to_ndev(cfg)) {
54 brcmf_dbg(CONN, "AP mode link down\n");
55 complete(&cfg->vif_disabled);
56 - if (ifp->vif->mbss)
57 - brcmf_remove_interface(ifp);
58 return 0;
59 }
60