From patchwork Sat Mar 10 12:20:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 10273447 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 BBC13601A0 for ; Sat, 10 Mar 2018 12:20:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9CE0299F9 for ; Sat, 10 Mar 2018 12:20:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E7B1299FF; Sat, 10 Mar 2018 12:20:50 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9F605299F9 for ; Sat, 10 Mar 2018 12:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=cFaqdDn16X0UpM02TaWEF7meO1lR1pykBk+BfIkDfW0=; b=a0g EeoteKU8FkGQu8IOxahu0vv5bEUQvu39pqn8MrNL8VQlW0wevGzrNRlQ4bRHODKR7dTvxlqVVRlZN Opo6xjrBjF+JI2EiVYE1G0RvY9opnALlBNmefQpYrj2QBn+Zoa+EwMRBY2UUG/O5QZw+0fTyYOAfz gwevwCJTo3vf0rUogGY53B7rh7+7ourVXXttKSzahuDRWrYuidrIv0hpLfr/Eh3y/JX/t/R+Pic3K baJNodhLl+qc5VXT6dx39gYShEAm6RNpXwUpWk+2b5FHVDcr+DWGVBJG/BajVtOuS6TSgLk8jpzBv z3qa0xiXfi3I28Zn0QLAGy/tXIzwHIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eudUM-0000TG-4b; Sat, 10 Mar 2018 12:20:38 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eudUH-0000Ix-D2 for ath10k@lists.infradead.org; Sat, 10 Mar 2018 12:20:36 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2961160300; Sat, 10 Mar 2018 12:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520684421; bh=BoVXcxZrLN7deGlh4sWhUvEDSIdr0/rmhDXKKcG2K6I=; h=From:To:Cc:Subject:Date:From; b=SniulJOoNoMhs1Sf9eqOe/FTCrk4iTt20QpqkcZK3xTIkdQk01rUJkTQjhXt9Hhec 89m4resAQPGLxkrCBI1lMazxYqhScpzvhl9I9HffWY6oL4GAc0u0ruYPbztKESxwsZ 6xNpOrRZNgLIuFOlix09RdifoNDupsXbiYxflAKs= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: akolli@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EF5F26024C; Sat, 10 Mar 2018 12:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520684420; bh=BoVXcxZrLN7deGlh4sWhUvEDSIdr0/rmhDXKKcG2K6I=; h=From:To:Cc:Subject:Date:From; b=bRGevruMfRtGYJPm7Lb0ZKT3sRwZqFT0Fvf9vMCk/R//gXJk/fjyHaDQjhzQa2KYf piumx906CQestv+GmcX1Em0TtfC32ePL9RLBDFoJ4+idQt1yokzZN039w9NGgmm19r H7FSmO3HSwyzVS4dJd2vgO/h1CxQuF1axdl5kohM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EF5F26024C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=akolli@codeaurora.org From: Anilkumar Kolli To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: fix recent bandwidth conversion bug Date: Sat, 10 Mar 2018 17:50:38 +0530 Message-Id: <1520684438-9233-1-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180310_042033_583740_9A9B86C4 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christian Lamparter The commit "cfg80211: make RATE_INFO_BW_20 the default" changed the index of RATE_INFO_BW_20, but the updates to ath10k missed the special bandwidth calculation case in ath10k_update_per_peer_tx_stats(). This will fix below warning, WARNING: CPU: 0 PID: 609 at net/wireless/util.c:1254 cfg80211_calculate_bitrate+0x174/0x220 invalid rate bw=1, mcs=9, nss=2 (unwind_backtrace) from (cfg80211_calculate_bitrate+0x174/0x220) (cfg80211_calculate_bitrate) from (nl80211_put_sta_rate+0x44/0x1dc)from (nl80211_put_sta_rate) from (nl80211_send_station+0x388/0xaf0) (nl80211_get_station+0xa8/0xec) [ end trace da8257d6a850e91a ] Fixes: 842be75c77cb ("cfg80211: make RATE_INFO_BW_20 the default") Signed-off-by: Christian Lamparter Signed-off-by: Anilkumar Kolli --- drivers/net/wireless/ath/ath10k/htt_rx.c | 43 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 6d96f9560950..47d1f2f6c6bb 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. + * Copyright (c) 2018, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -723,6 +724,28 @@ struct amsdu_subframe_hdr { #define GROUP_ID_IS_SU_MIMO(x) ((x) == 0 || (x) == 63) +static inline u8 ath10k_bw_to_mac80211_bw(u8 bw) +{ + u8 ret = 0; + + switch (bw) { + case 0: + ret = RATE_INFO_BW_20; + break; + case 1: + ret = RATE_INFO_BW_40; + break; + case 2: + ret = RATE_INFO_BW_80; + break; + case 3: + ret = RATE_INFO_BW_160; + break; + } + + return ret; +} + static void ath10k_htt_rx_h_rates(struct ath10k *ar, struct ieee80211_rx_status *status, struct htt_rx_desc *rxd) @@ -825,23 +848,7 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar, if (sgi) status->enc_flags |= RX_ENC_FLAG_SHORT_GI; - switch (bw) { - /* 20MHZ */ - case 0: - break; - /* 40MHZ */ - case 1: - status->bw = RATE_INFO_BW_40; - break; - /* 80MHZ */ - case 2: - status->bw = RATE_INFO_BW_80; - break; - case 3: - status->bw = RATE_INFO_BW_160; - break; - } - + status->bw = ath10k_bw_to_mac80211_bw(bw); status->encoding = RX_ENC_VHT; break; default: @@ -2499,7 +2506,7 @@ static inline bool is_valid_legacy_rate(u8 rate) arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; arsta->txrate.nss = txrate.nss; - arsta->txrate.bw = txrate.bw + RATE_INFO_BW_20; + arsta->txrate.bw = ath10k_bw_to_mac80211_bw(txrate.bw); } static void ath10k_htt_fetch_peer_stats(struct ath10k *ar,