From patchwork Wed Jan 20 15:46:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 8072651 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6D3F4BEEE5 for ; Wed, 20 Jan 2016 15:46:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85936204A9 for ; Wed, 20 Jan 2016 15:46:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B781204A7 for ; Wed, 20 Jan 2016 15:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933889AbcATPqN (ORCPT ); Wed, 20 Jan 2016 10:46:13 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:35297 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbcATPqM (ORCPT ); Wed, 20 Jan 2016 10:46:12 -0500 Received: by mail-lf0-f49.google.com with SMTP id c192so8497153lfe.2 for ; Wed, 20 Jan 2016 07:46:11 -0800 (PST) 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-type :content-transfer-encoding; bh=vKuoND9wwMYm1x3g27q7CXdiD5rNNDE5INMhMhIs4DY=; b=RyQhe+d3dujWPoIg/Gxmp+ROXSdwNFcEuwGtH7QIlNkBbfye1/GDzeUP4QKN4qplZx GuuKyHS7XCd6uaAfV0lgtxaAB9vj3VA4dmR74gqsgP3Se2d/1pc/croIUe98Qvk7Pzl+ v5hQZBnUWra66x+nUM9flr5SIaZqRlcBh2PPABcTuAkDP5VdAsvY81XyC9P+mPdCWvXX b18+CISB+nYyDjOfJzdrmo2TqvWSEhkJzlJcXCmC3h9BZSNALlXfn+o9ppd3Lb7PwVcH TOY4ozrf617FfayQoB4EYrnzChoT6jQSbG8I+UdshipFgoTRl80Qvif8b3c9oFBrEv0S N7pQ== 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-type:content-transfer-encoding; bh=vKuoND9wwMYm1x3g27q7CXdiD5rNNDE5INMhMhIs4DY=; b=FWCQ4SnQzT0BzEycXuA7diUQ0ZVt7bLp26nihZSG9vGagIdIX39ADbLtiIRorYAgW4 DU4E2JDq3ioF3/fEiKN1p4LchkhHYNiyeB83+msXTgKYTp9lvQnygf/BgYLpj1S078L4 yTZPlZTOxTYwzBXyplFLmpTsWbgoy4WdfxVwg3zT7cKvr1KT8fhxlp+EeiFvtd7XS22J /1+XQEWqvyqVrl7ISIhvmvY91nT40Bx0N0PwRfrbkxIc/ljKZVMvT+vTlojLy7ocAnFI dN35MZYW1PZtojpCagrKZiySyTlfBWpmVFoiu9paWhdjH02BpyWz4oKAxRBQ7Aaswe8W 3rrA== X-Gm-Message-State: ALoCoQm7WXxI9TAO7eEqe8H5PLkW90FdK0ybpO6GblWMWJU8vtTlNYSbYE3aL1IFMr1bgXVabNLslpbb9DCbbgzHh9pomtlVHQ== X-Received: by 10.25.85.20 with SMTP id j20mr13135021lfb.131.1453304770343; Wed, 20 Jan 2016 07:46:10 -0800 (PST) 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 s2sm4799154lfe.34.2016.01.20.07.46.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jan 2016 07:46:09 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo , Brett Rudley , Arend van Spriel , "Franky (Zhenhui) Lin" , Hante Meuleman , linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width Date: Wed, 20 Jan 2016 16:46:04 +0100 Message-Id: <1453304764-11895-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-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP First of all it changes the way we calculate primary channel offset. If we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means center frequency is 5210 MHz) it makes sense to calculate primary offset as -30 MHz. Then it fixes values we compare primary_offset with. We were comparing offset in MHz against -2 or 2 which was resulting in picking a wrong primary channel. Signed-off-by: Rafa? Mi?ecki Acked-by: Arend van Spriel --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 8d9cff4..2b335de 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", ch->chan->center_freq, ch->center_freq1, ch->width); ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); - primary_offset = ch->center_freq1 - ch->chan->center_freq; + primary_offset = ch->chan->center_freq - ch->center_freq1; switch (ch->width) { case NL80211_CHAN_WIDTH_20: case NL80211_CHAN_WIDTH_20_NOHT: @@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, break; case NL80211_CHAN_WIDTH_40: ch_inf.bw = BRCMU_CHAN_BW_40; - if (primary_offset < 0) + if (primary_offset > 0) ch_inf.sb = BRCMU_CHAN_SB_U; else ch_inf.sb = BRCMU_CHAN_SB_L; break; case NL80211_CHAN_WIDTH_80: ch_inf.bw = BRCMU_CHAN_BW_80; - if (primary_offset < 0) { - if (primary_offset < -CH_10MHZ_APART) - ch_inf.sb = BRCMU_CHAN_SB_UU; - else - ch_inf.sb = BRCMU_CHAN_SB_UL; - } else { - if (primary_offset > CH_10MHZ_APART) - ch_inf.sb = BRCMU_CHAN_SB_LL; - else - ch_inf.sb = BRCMU_CHAN_SB_LU; - } + if (primary_offset == -30) + ch_inf.sb = BRCMU_CHAN_SB_LL; + else if (primary_offset == -10) + ch_inf.sb = BRCMU_CHAN_SB_LU; + else if (primary_offset == 10) + ch_inf.sb = BRCMU_CHAN_SB_UL; + else + ch_inf.sb = BRCMU_CHAN_SB_UU; break; case NL80211_CHAN_WIDTH_80P80: case NL80211_CHAN_WIDTH_160: