From patchwork Fri May 27 19:07:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9138883 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EAAE16075C for ; Fri, 27 May 2016 19:08:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D92EC25404 for ; Fri, 27 May 2016 19:08:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD31B2823E; Fri, 27 May 2016 19:08:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66C0A25404 for ; Fri, 27 May 2016 19:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932760AbcE0THn (ORCPT ); Fri, 27 May 2016 15:07:43 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35650 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753296AbcE0THm (ORCPT ); Fri, 27 May 2016 15:07:42 -0400 Received: by mail-wm0-f68.google.com with SMTP id e3so1104877wme.2; Fri, 27 May 2016 12:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vzgP6hA7mA/mGGE2UbP4RQ5/EVEq8WHbC1P3o7jNUEk=; b=QjuOIpLqpuSURPguvHeftSw7vaf8ysp5TGuel/ldJwEzTz+mE4UpIlR2W+TNdmXBx9 GmGKycebEqZk3R97CExB8LChLOMDsuHtVEzmz1tGdvLC+8XlLtjzIwBR/QkBG/02Ljy3 0rpvF2FzIhZGvABBN23rsxk8LhTFgh7hFIB8zmm31mrcIcr8Mzu5A4fQgu1XND8agFcj 2FGbW1K3R8e9LcfCN8I5D4mm4o8UT2hE4f4Qcz/9Y1UAlu2kCfs2hiHIgJ13fCCt5cT/ ioZOSFTxW5eRAA1KATzPj7ST8PteXnvkNBGImi2XnhiQ7LNRKGkgMmtW6KDqmgO+xtzG RBWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vzgP6hA7mA/mGGE2UbP4RQ5/EVEq8WHbC1P3o7jNUEk=; b=TUvxDeZyeaYgtiCGb/1O02BRRoYwjSKlI0ksn8GExQcO0+8zbXU+sRi4VmliTuQZ3W I/EOxyIpZ0rZ0qheE4ywJ+xkoWUipebyVhUi/AwhLh3G8Ww+LvxYIb3UQozzmWHokB+m sttqgfqReL+wLrb24AUwwZZKfB6hSp72sIY2czA93cBtRIa/CjmyX3vhqgTjNDMxujjv i9rV5vMGf3j/bdEnrC3+kznV21u/7ktYtkXQ3luQIFdcRm5qO00+TyToWlE8dDBTpkeA 1hyR9zmPy+4qs7FJ1qw6SXVsdXapIXDcAXk/IWgL8q6PYqyTa1r4cGWN4Sq7WlPorCPw /96w== X-Gm-Message-State: ALyK8tLbKC3YpO1BxI1TjHo3kr3ouSFW3xmPAZ5NhWyfrxAKIlwFROjp06tH9lQNKnv2xA== X-Received: by 10.28.29.195 with SMTP id d186mr159795wmd.27.1464376060511; Fri, 27 May 2016 12:07:40 -0700 (PDT) Received: from linux-samsung.lan (euj241.neoplus.adsl.tpnet.pl. [83.20.181.241]) by smtp.gmail.com with ESMTPSA id c185sm10007746wme.9.2016.05.27.12.07.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 May 2016 12:07:39 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Brett Rudley , Arend van Spriel , "Franky (Zhenhui) Lin" , Hante Meuleman , Pieter-Paul Giesberts , linux-wireless@vger.kernel.org (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), brcm80211-dev-list@broadcom.com (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2] brcmfmac: fix setting AP channel with new firmwares Date: Fri, 27 May 2016 21:07:19 +0200 Message-Id: <1464376045-8220-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1464080979-12150-1-git-send-email-zajec5@gmail.com> References: <1464080979-12150-1-git-send-email-zajec5@gmail.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Firmware for new chipsets is based on a new major version of code internally maintained at Broadcom. E.g. brcmfmac4366b-pcie.bin (used for BCM4366B1) is based on 10.10.69.3309 while brcmfmac43602-pcie.ap.bin was based on 7.35.177.56. Currently setting AP 5 GHz channel doesn't work reliably with BCM4366B1. When setting e.g. 36 control channel with VHT80 (center channel 42) firmware may randomly pick one of: 1) 52 control channel with 58 as center one 2) 100 control channel with 106 as center one 3) 116 control channel with 122 as center one 4) 149 control channel with 155 as center one It seems new firmwares require setting AP mode (BRCMF_C_SET_AP) before specifying a channel. Changing an order of firmware calls fixes the problem. This requirement resulted in two separated "chanspec" calls, one in AP code path and one in P2P path. This fix was verified with BCM4366B1 and tested for regressions on BCM43602. Signed-off-by: Rafał Miłecki --- V2: Avoid checking AP vs. P2P at two different places, just add code setting "chanspec" to existing paths. --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 1e2527f..38df1be 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -4438,7 +4438,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, struct brcmf_join_params join_params; enum nl80211_iftype dev_role; struct brcmf_fil_bss_enable_le bss_enable; - u16 chanspec; + u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); bool mbss; int is_11d; @@ -4514,16 +4514,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); + /* Parameters shared by all radio interfaces */ if (!mbss) { - chanspec = chandef_to_chanspec(&cfg->d11inf, - &settings->chandef); - err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); - if (err < 0) { - brcmf_err("Set Channel failed: chspec=%d, %d\n", - chanspec, err); - goto exit; - } - if (is_11d != ifp->vif->is_11d) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, is_11d); @@ -4571,6 +4563,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, err = -EINVAL; goto exit; } + + /* Interface specific setup */ if (dev_role == NL80211_IFTYPE_AP) { if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss)) brcmf_fil_iovar_int_set(ifp, "mbss", 1); @@ -4580,6 +4574,17 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, brcmf_err("setting AP mode failed %d\n", err); goto exit; } + if (!mbss) { + /* Firmware 10.x requires setting channel after enabling + * AP and before bringing interface up. + */ + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { + brcmf_err("Set Channel failed: chspec=%d, %d\n", + chanspec, err); + goto exit; + } + } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); if (err < 0) { brcmf_err("BRCMF_C_UP error (%d)\n", err); @@ -4601,7 +4606,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, goto exit; } brcmf_dbg(TRACE, "AP mode configuration complete\n"); - } else { + } else if (dev_role == NL80211_IFTYPE_P2P_GO) { + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { + brcmf_err("Set Channel failed: chspec=%d, %d\n", + chanspec, err); + goto exit; + } err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le, sizeof(ssid_le)); if (err < 0) { @@ -4618,7 +4629,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, } brcmf_dbg(TRACE, "GO mode configuration complete\n"); + } else { + WARN_ON(1); } + set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); brcmf_net_setcarrier(ifp, true);