package/devel/binutils: Update to 2.27
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 319-0020-brcmfmac-ignore-11d-configuration-errors.patch
1 From b3589dfe02123a0d0ea82076a9f8ef84a46852c0 Mon Sep 17 00:00:00 2001
2 From: Hante Meuleman <hante.meuleman@broadcom.com>
3 Date: Mon, 19 Sep 2016 12:09:51 +0100
4 Subject: [PATCH] brcmfmac: ignore 11d configuration errors
5
6 802.11d is not always supported by firmware anymore. Currently the
7 AP configuration of 11d will cause an abort if the ioctl set is
8 failing. This behavior is not correct and the error should be
9 ignored.
10
11 Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
12 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
13 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
14 Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
15 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
16 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
17 ---
18 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 27 ++++++++++++----------
19 1 file changed, 15 insertions(+), 12 deletions(-)
20
21 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
22 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
23 @@ -4498,6 +4498,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
24 u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
25 bool mbss;
26 int is_11d;
27 + bool supports_11d;
28
29 brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n",
30 settings->chandef.chan->hw_value,
31 @@ -4510,11 +4511,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
32 mbss = ifp->vif->mbss;
33
34 /* store current 11d setting */
35 - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, &ifp->vif->is_11d);
36 - country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
37 - settings->beacon.tail_len,
38 - WLAN_EID_COUNTRY);
39 - is_11d = country_ie ? 1 : 0;
40 + if (brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY,
41 + &ifp->vif->is_11d)) {
42 + supports_11d = false;
43 + } else {
44 + country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
45 + settings->beacon.tail_len,
46 + WLAN_EID_COUNTRY);
47 + is_11d = country_ie ? 1 : 0;
48 + supports_11d = true;
49 + }
50
51 memset(&ssid_le, 0, sizeof(ssid_le));
52 if (settings->ssid == NULL || settings->ssid_len == 0) {
53 @@ -4573,7 +4579,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
54
55 /* Parameters shared by all radio interfaces */
56 if (!mbss) {
57 - if (is_11d != ifp->vif->is_11d) {
58 + if ((supports_11d) && (is_11d != ifp->vif->is_11d)) {
59 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
60 is_11d);
61 if (err < 0) {
62 @@ -4615,7 +4621,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
63 brcmf_err("SET INFRA error %d\n", err);
64 goto exit;
65 }
66 - } else if (WARN_ON(is_11d != ifp->vif->is_11d)) {
67 + } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
68 /* Multiple-BSS should use same 11d configuration */
69 err = -EINVAL;
70 goto exit;
71 @@ -4749,11 +4755,8 @@ static int brcmf_cfg80211_stop_ap(struct
72 brcmf_err("setting INFRA mode failed %d\n", err);
73 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
74 brcmf_fil_iovar_int_set(ifp, "mbss", 0);
75 - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
76 - ifp->vif->is_11d);
77 - if (err < 0)
78 - brcmf_err("restoring REGULATORY setting failed %d\n",
79 - err);
80 + brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
81 + ifp->vif->is_11d);
82 /* Bring device back up so it can be used again */
83 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
84 if (err < 0)