mac80211: brcmfmac: backport important changes from the 4.14
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 326-v4.14-0002-brcmfmac-fix-wrong-num_different_channels-when-mchan.patch
1 From 99976fc084129e07df3a066dc15651853386da19 Mon Sep 17 00:00:00 2001
2 From: Wright Feng <wright.feng@cypress.com>
3 Date: Thu, 3 Aug 2017 17:37:59 +0800
4 Subject: [PATCH] brcmfmac: fix wrong num_different_channels when mchan feature
5 enabled
6
7 When the device/firmware supports multi-channel, it can have P2P
8 connection and regular connection with AP simultaneous. In this case,
9 the num_different_channels in wiphy info was not correct when firmware
10 supports multi-channel (The iw wiphy# info showed "#channels <= 1" in
11 interface combinations). It caused association failed and error message
12 "CTRL-EVENT-FREQ-CONFLICT error" in wpa_supplicant when P2P GO interface
13 was running at the same time.
14 The root cause is that the num_different_channels was always overridden
15 to 1 in brcmf_setup_ifmodes even multi-channel was enabled.
16 We correct the logic by moving num_different_channels setting forward.
17
18 Signed-off-by: Wright Feng <wright.feng@cypress.com>
19 Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
20 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
21 ---
22 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +++-
23 1 file changed, 3 insertions(+), 1 deletion(-)
24
25 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
26 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
27 @@ -6311,6 +6311,8 @@ static int brcmf_setup_ifmodes(struct wi
28 if (p2p) {
29 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
30 combo[c].num_different_channels = 2;
31 + else
32 + combo[c].num_different_channels = 1;
33 wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
34 BIT(NL80211_IFTYPE_P2P_GO) |
35 BIT(NL80211_IFTYPE_P2P_DEVICE);
36 @@ -6320,10 +6322,10 @@ static int brcmf_setup_ifmodes(struct wi
37 c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
38 BIT(NL80211_IFTYPE_P2P_GO);
39 } else {
40 + combo[c].num_different_channels = 1;
41 c0_limits[i].max = 1;
42 c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
43 }
44 - combo[c].num_different_channels = 1;
45 combo[c].max_interfaces = i;
46 combo[c].n_limits = i;
47 combo[c].limits = c0_limits;