From patchwork Mon Aug 6 13:13:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 10557067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABF21157D for ; Mon, 6 Aug 2018 13:12:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AAC1283AF for ; Mon, 6 Aug 2018 13:12:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E958284C4; Mon, 6 Aug 2018 13:12:58 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 440C9283AF for ; Mon, 6 Aug 2018 13:12:58 +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:References: In-Reply-To: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:List-Owner; bh=kL60JpPolDRt5YN3Y38GqfUX1qGYiiAjWmNVg6bkZC8=; b=qM8GTu2scZqENl1i6XLRHqwJy5 KjKQ99hRd8XYAiJibsFoQdwYvoDkQh4IL8IKa5l4DxOYhWKhOOwLee5dZgzkTSjB0HG8gZLhYp0/x IS+kwsLzKFWbP+aqm1Tp5BPqBlxA5x4fLr4MHkiKDzmj/Uhyjw4MtSS8br5RZTzHHQaEZI613ANQL oO4ShMXh083GCvWWJjoPFIRohSe9mMoK1YGIULpqShXWmHgciGmBHWcgu0JvJblt5JmsJt7d81WUE GTMm33YPtKdY5jV8gkjTeWKeRH6yIhgDO47NpT0Tr58dDfIZDvvAKy/q5SOYTLtLHczHB4XPkXiFo sEsXNU4g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmfJX-000870-KJ; Mon, 06 Aug 2018 13:12:47 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmfJT-00085K-1i for ath10k@lists.infradead.org; Mon, 06 Aug 2018 13:12:44 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5323F60769; Mon, 6 Aug 2018 13:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533561161; bh=nuKAJ60Wm8oOtKsJCad3L9ICluUADrGDQr+30iFN2L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWT5Y4xZH2Uaxv7ifaN1oB9FbtLWFTVUhyacb/FhS6YuzoiNAU8/6X/pLmftMkZ2x HLb8tIUNqZrchqu2XAp9B92kw+4sMGynld1ecausuApYW11Cpf+H6k7Guf8n2/Gpru T9KjiXounxRqDek4UCBHJBKB5Fx47aGSRKpz2XFI= 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 7330460769; Mon, 6 Aug 2018 13:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533561160; bh=nuKAJ60Wm8oOtKsJCad3L9ICluUADrGDQr+30iFN2L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkzscrLmRjTcEEs6D598i4Hb3LM/JvbroSzVxylscS1ruBCgo0DtomFJKI/nBF2g6 pnrUaI3F1SObtnSM3w8cVu/LmV2J/h7tMYLkFEFeBZ7NOKWTGCtVG+JX/OIg9agXK/ IgSzoAAI4jGuoB0+8ihy6oezYANdpl/0ib0D1sGQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7330460769 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 1/4] ath10k: get the legacy rate index to update the txrate table Date: Mon, 6 Aug 2018 18:43:40 +0530 Message-Id: <1533561223-342-2-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1533561223-342-1-git-send-email-akolli@codeaurora.org> References: <1533561223-342-1-git-send-email-akolli@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180806_061243_131430_CF220C1C X-CRM114-Status: GOOD ( 11.80 ) 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 Get the legacy rate index to update the pkts/bytes counter against each possible tx rate. Signed-off-by: Anilkumar Kolli --- drivers/net/wireless/ath/ath10k/htt_rx.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 4d1cd90d6d27..01eb4a7f4a69 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2488,7 +2488,7 @@ void ath10k_htt_htc_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) dev_kfree_skb_any(skb); } -static inline bool is_valid_legacy_rate(u8 rate) +static inline int ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) { static const u8 legacy_rates[] = {1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54}; @@ -2496,10 +2496,11 @@ static inline bool is_valid_legacy_rate(u8 rate) for (i = 0; i < ARRAY_SIZE(legacy_rates); i++) { if (rate == legacy_rates[i]) - return true; + return i; } - return false; + ath10k_warn(ar, "Invalid legacy rate %hhd peer stats", rate); + return -EINVAL; } static void @@ -2508,7 +2509,7 @@ static inline bool is_valid_legacy_rate(u8 rate) struct ath10k_per_peer_tx_stats *peer_stats) { struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; - u8 rate = 0, sgi; + u8 rate = 0, rate_idx = 0, sgi; struct rate_info txrate; lockdep_assert_held(&ar->data_lock); @@ -2536,17 +2537,12 @@ static inline bool is_valid_legacy_rate(u8 rate) if (txrate.flags == WMI_RATE_PREAMBLE_CCK || txrate.flags == WMI_RATE_PREAMBLE_OFDM) { rate = ATH10K_HW_LEGACY_RATE(peer_stats->ratecode); - - if (!is_valid_legacy_rate(rate)) { - ath10k_warn(ar, "Invalid legacy rate %hhd peer stats", - rate); - return; - } - /* This is hacky, FW sends CCK rate 5.5Mbps as 6 */ - rate *= 10; - if (rate == 60 && txrate.flags == WMI_RATE_PREAMBLE_CCK) - rate = rate - 5; + if (rate == 6 && txrate.flags == WMI_RATE_PREAMBLE_CCK) + rate = 5; + rate_idx = ath10k_get_legacy_rate_idx(ar, rate); + if (rate_idx < 0) + return; arsta->txrate.legacy = rate; } else if (txrate.flags == WMI_RATE_PREAMBLE_HT) { arsta->txrate.flags = RATE_INFO_FLAGS_MCS;