From patchwork Tue May 24 09:09:24 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: 9133083 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 24F35607D3 for ; Tue, 24 May 2016 09:11:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AC2228258 for ; Tue, 24 May 2016 09:11:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F5AA28285; Tue, 24 May 2016 09:11:48 +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 B6E5E28258 for ; Tue, 24 May 2016 09:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932533AbcEXJLR (ORCPT ); Tue, 24 May 2016 05:11:17 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34173 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932521AbcEXJK4 (ORCPT ); Tue, 24 May 2016 05:10:56 -0400 Received: by mail-lf0-f66.google.com with SMTP id 65so711897lfq.1; Tue, 24 May 2016 02:10:54 -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:mime-version :content-transfer-encoding; bh=sYOnvAtU9fKaSOX6PcOrQ/dRoBfXDKG4zcO5XiquG6A=; b=Serv1e1sIosnjNts4PiP9RcaEu0jv0LESraUDoT4fWkSxMn6jnx9nWZtcOBnuiwJ0w 3ebWD6zssg475dItUN4t48x/iydsZfipIG0/8CtHg85nRELCyqdXntuHCKaR26I7q6qP 3H6x8E9Lr6551Yym0Ffa/KtE+m8W8qykF91BovIu3Ne1VhdcIG3inXTu1wTGym9Fq7T2 H2DspwOlfwgstp+0cDhg3kjfjNNB8nsmbFtyfbd21Y5d5FvysL1SrDNFgYAvSKOUqDR4 54SdtlZcfMN5YsfAlrTU4xMbALb5tqTMIbUjFecxLrlArYNon7RUhnlcFqHY2wETCONE TZqg== 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:mime-version :content-transfer-encoding; bh=sYOnvAtU9fKaSOX6PcOrQ/dRoBfXDKG4zcO5XiquG6A=; b=MbAaGOJxEB1O9Lv2DcSs/ZeuosVSbo6eCTc2JuJ4FVv4o+5PwDZrd/tsPgZ//MV2Un znIOi0lyGGntRB5+TovFg/EtfTEpNCf47dFnYj0dDhp6dykr/ZyYgHGtCWLNtOrTiFs5 Khe2Xx4CxWYjwgAe2ffGqsWf6yWsVKWTlLZhLyhp+q597a4V0qkcxadj7XMBzOZh/jMZ fZ8wjShr/oWaMjCaCF774ahkwH4bZfx4TmDvOoyz/t2Sks8iyC6Upk6kAXQspmhgZ7vs dU8MgdJdabG0+WbIVR4BxU+orPXy6VYMafFN94WHdeOvt8QAHE9uTmjPiDOJatY2wqZY 4i9w== X-Gm-Message-State: AOPr4FVW3b1e6hkTYfsyCVDcaS7ow8RFIAzG+aSj+7GN7BJlOc42+AkTKIJuyqT4OTz2aQ== X-Received: by 10.25.201.88 with SMTP id z85mr6460768lff.140.1464081053891; Tue, 24 May 2016 02:10:53 -0700 (PDT) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id y5sm345162lba.17.2016.05.24.02.10.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 May 2016 02:10:53 -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] brcmfmac: fix setting AP channel with new firmwares Date: Tue, 24 May 2016 11:09:24 +0200 Message-Id: <1464080979-12150-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 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 fix was verified with BCM4366B1 and tested for regressions on BCM43602. It's unclear if it's needed (or correct at all) for P2P interfaces so it leaves this code unaffected. Signed-off-by: Rafał Miłecki --- .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 299a404..3d09d23 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -4423,7 +4423,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; @@ -4499,16 +4499,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); - if (!mbss) { - chanspec = chandef_to_chanspec(&cfg->d11inf, - &settings->chandef); + 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; } + } + if (!mbss) { if (is_11d != ifp->vif->is_11d) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, is_11d); @@ -4565,6 +4565,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, brcmf_err("setting AP mode failed %d\n", err); goto exit; } + if (!mbss) { + 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);