brcmfmac: fix wrong num_different_channels when mchan feature enabled
authorWright Feng <wright.feng@cypress.com>
Thu, 3 Aug 2017 09:37:59 +0000 (17:37 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 8 Aug 2017 11:51:22 +0000 (14:51 +0300)
When the device/firmware supports multi-channel, it can have P2P
connection and regular connection with AP simultaneous. In this case,
the num_different_channels in wiphy info was not correct when firmware
supports multi-channel (The iw wiphy# info showed "#channels <= 1" in
interface combinations). It caused association failed and error message
"CTRL-EVENT-FREQ-CONFLICT error" in wpa_supplicant when P2P GO interface
was running at the same time.
The root cause is that the num_different_channels was always overridden
to 1 in brcmf_setup_ifmodes even multi-channel was enabled.
We correct the logic by moving num_different_channels setting forward.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

index 579089a340f6d065522e1b58281114562e2dcb79..65cbb3d1e5090257473edb3c55f864fe7199de85 100644 (file)
@@ -6461,6 +6461,8 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
        if (p2p) {
                if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
                        combo[c].num_different_channels = 2;
+               else
+                       combo[c].num_different_channels = 1;
                wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
                                          BIT(NL80211_IFTYPE_P2P_GO) |
                                          BIT(NL80211_IFTYPE_P2P_DEVICE);
@@ -6470,10 +6472,10 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
                c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
                                       BIT(NL80211_IFTYPE_P2P_GO);
        } else {
+               combo[c].num_different_channels = 1;
                c0_limits[i].max = 1;
                c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
        }
-       combo[c].num_different_channels = 1;
        combo[c].max_interfaces = i;
        combo[c].n_limits = i;
        combo[c].limits = c0_limits;