From patchwork Tue May 17 03:25:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Chadd X-Patchwork-Id: 9108351 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 119659F1D3 for ; Tue, 17 May 2016 03:25:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EA6D20218 for ; Tue, 17 May 2016 03:25:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2CBE7201FE for ; Tue, 17 May 2016 03:25:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754132AbcEQDZn (ORCPT ); Mon, 16 May 2016 23:25:43 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36619 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754087AbcEQDZm (ORCPT ); Mon, 16 May 2016 23:25:42 -0400 Received: by mail-pf0-f193.google.com with SMTP id g132so491168pfb.3 for ; Mon, 16 May 2016 20:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NwO9opG0scX32bOEAq533LNQOKYOAYm9VgRjYYrG4Ts=; b=iVFkxMyPnu6WKNuprgt5aOIzIRsBznvZ1Eq11TnL9FII5l6dzCTsnUSKWySU/yUMQm ujh6MmxP8D12HNYMwqcahNs7Ue1i6ZfxefFm6LwtdC6tqrsxdBzt5qB5j8OAswq9cUNz qLfDo6doPGcuYlPV+xW594BaMBJlYaPzit6gIPeFgObwmkTYQsCE/1MHk4sHhe92KkgX Pft6Z/TixcD/Jo5WnRhTKQtD0NnhZzDqiJrvkirGL5TrTxgIWjwR3pgSD1F8ivcNmUpj W8jio0Bwckhzbjxo9RIoHgt0iy8uazTUI3dKPUu8sWiVCkGz+tB9xzp6GL2JLXlGUjDq Xp5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=NwO9opG0scX32bOEAq533LNQOKYOAYm9VgRjYYrG4Ts=; b=IX/54RIK+CU0BB+znTKc9HUiACGRSQG6aHv/zseveuGq+jA51zDbWRVRdjTb5yy+9n IDvdpDH0lZSAfFwOFl822sfLNkKTWg8VTIMRwFfPlQKKVTsqVUCX7vNGRZpYJLooJS/V pskbdF1dJaBMHq79PSSAOVUD5nRbPAByTQXyZhHdRLvFtbvlr2YiB/l8smuVVbcaJLwy fIv7mbvjCRnXMuanO0aGd4SFfyDoL6D4EWZ4HSFr28MP79J/p8WWYWJcFPme/ZX6gF1h vXdTU9vXCgaF8/ryCVI9ctOaKvGjtStChhidxgDIKO3FuR310dVVsYtDosQyEgNgDfyF +2pA== X-Gm-Message-State: AOPr4FXIFjlmBi/EZ40Sv4/XlxoBJ9C6047IwcZrWObFscMFKfmGjO6S54efDV3AbgLx/w== X-Received: by 10.98.24.208 with SMTP id 199mr49851899pfy.160.1463455541865; Mon, 16 May 2016 20:25:41 -0700 (PDT) Received: from gertrude.my.domain (74-212-220-31.static-ip.telepacific.net. [74.212.220.31]) by smtp.gmail.com with ESMTPSA id k65sm547063pfj.31.2016.05.16.20.25.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 May 2016 20:25:40 -0700 (PDT) From: Adrian Chadd To: linux-wireless@vger.kernel.org Cc: Adrian Chadd , Kalle Valo , b43-dev@lists.infradead.org Subject: [PATCH] [b43] don't unconditionally fall back to CCK if the rate is 6MB OFDM. Date: Mon, 16 May 2016 20:25:34 -0700 Message-Id: <1463455534-22512-2-git-send-email-adrian@freebsd.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1463455534-22512-1-git-send-email-adrian@freebsd.org> References: <1463455534-22512-1-git-send-email-adrian@freebsd.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 Check the current PHY operating mode (gmode) to see if we should fall back from 6MB OFDM to 11MB CCK. For 5GHz operation this isn't allowed. Note, the fallback lookup is only done for RTS rates; normal fallback rates are done via mac80211 and aren't affected by this change. Signed-off-by: Adrian Chadd --- drivers/net/wireless/broadcom/b43/xmit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/xmit.c b/drivers/net/wireless/broadcom/b43/xmit.c index f620126..7edbcdb 100644 --- a/drivers/net/wireless/broadcom/b43/xmit.c +++ b/drivers/net/wireless/broadcom/b43/xmit.c @@ -205,7 +205,7 @@ static u16 b43_generate_tx_phy_ctl1(struct b43_wldev *dev, u8 bitrate) return control; } -static u8 b43_calc_fallback_rate(u8 bitrate) +static u8 b43_calc_fallback_rate(u8 bitrate, int gmode) { switch (bitrate) { case B43_CCK_RATE_1MB: @@ -216,8 +216,15 @@ static u8 b43_calc_fallback_rate(u8 bitrate) return B43_CCK_RATE_2MB; case B43_CCK_RATE_11MB: return B43_CCK_RATE_5MB; + /* + * Don't just fallback to CCK; it may be in 5GHz operation + * and falling back to CCK won't work out very well. + */ case B43_OFDM_RATE_6MB: - return B43_CCK_RATE_5MB; + if (gmode) + return B43_CCK_RATE_5MB; + else + return B43_OFDM_RATE_6MB; case B43_OFDM_RATE_9MB: return B43_OFDM_RATE_6MB; case B43_OFDM_RATE_12MB: @@ -438,7 +445,7 @@ int b43_generate_txhdr(struct b43_wldev *dev, rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB; rts_rate_ofdm = b43_is_ofdm_rate(rts_rate); - rts_rate_fb = b43_calc_fallback_rate(rts_rate); + rts_rate_fb = b43_calc_fallback_rate(rts_rate, phy->gmode); rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {