From patchwork Tue Sep 4 06:45:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 10586759 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 3A30F14E0 for ; Tue, 4 Sep 2018 06:43:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2751328F2A for ; Tue, 4 Sep 2018 06:43:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19C1628C31; Tue, 4 Sep 2018 06:43:37 +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,RCVD_IN_DNSWL_NONE 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 9FC4928C31 for ; Tue, 4 Sep 2018 06:43:36 +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=j2SDbhYyzdgzaMLkrxuZT9RPbbzLiRjlR909ryjav78=; b=bliiqxMp1AMUhYdgWlgYVxsqLA JuJma0rEqsjCJyF0vIENbCTk9x/ws0hKolWG295xORUtLgAq29FcaeSMcECzLd2SzMmxd/IAqwm5+ TUVeWKyXN8rKCQsdnyOkydhnaGg5pnNg5cSIrySo6jbcPettShsuWhSPQ7ys7I7qn2dTegtHVQo2i QfUk1Q1/fMMnaQom8ubPxfrQx5db/OdqFnqnm90e5vKbVJnVk9Zh9MijjZhxDk3ZgjHrJpZc6I44g TX7aohD8WSwAjEZhLn1OxEylpBXg1IIG+/tMlWyzJmZIb9jZW9SJG44sGZWKo3M4hUYGLEa/zUOmu RE8Gt5lA==; 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 1fx53g-0008MZ-Ge; Tue, 04 Sep 2018 06:43:28 +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 1fx53d-0008Lu-FP for ath10k@lists.infradead.org; Tue, 04 Sep 2018 06:43:27 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 47F656044E; Tue, 4 Sep 2018 06:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536043403; bh=FGe9qDTfwrav9MNx/VTeUF43s4A/pmuNINgPsFQ9pgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jVid0fK8MeStiWaq3luPwZ08Z67H7XrR/Uot5Np8blpvH7w+PK2i/+VAF2rq4J6V5 6G4lWd7Kj3ENDejpSXh6AwPUXTADoQemq4Iw25Hb9Lm0Nt9dUR5xaJcGefkFmc+FgE 5jrgxS3zdjO/DzHAZUVj0u/n6HvqPRpxmX46lSGw= 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 1B0EE606CF; Tue, 4 Sep 2018 06:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536043402; bh=FGe9qDTfwrav9MNx/VTeUF43s4A/pmuNINgPsFQ9pgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HUPgkMSSxGhA/e2/eVkF+DZjMY9X0hi0wWdVoKAaXi1f6WRFSKH0kuTZsk5humOnj uW6jXr9cK/Qxpzd2hTVoHZKwoURmYlIUmYVtua/3K5UcqGQYTSqHS2IDJRDOgJ8zl/ FACsJefjbr1cOyx5OvBGe67Z3UOVwuxuiLOUSGXw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1B0EE606CF 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: akolli@codeaurora.org To: ath10k@lists.infradead.org Subject: [PATCHv2 1/4] ath10k: get the legacy rate index to update the txrate table Date: Tue, 4 Sep 2018 12:15:13 +0530 Message-Id: <1536043516-12462-2-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1536043516-12462-1-git-send-email-akolli@codeaurora.org> References: <1536043516-12462-1-git-send-email-akolli@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180903_234325_568397_5E2772C9 X-CRM114-Status: GOOD ( 11.86 ) 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: Anilkumar Kolli , 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: Anilkumar Kolli 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;