From patchwork Tue Mar 12 04:33:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Huang X-Patchwork-Id: 10848579 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 E528B1515 for ; Tue, 12 Mar 2019 04:34:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB82028FD1 for ; Tue, 12 Mar 2019 04:34:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BED842929F; Tue, 12 Mar 2019 04:34:16 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham 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 6AC9D28FD1 for ; Tue, 12 Mar 2019 04:34:16 +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=qGt3RPXaV7n5wPv4AukrzYALyI9uhrgw/o/2nkMoF4Q=; b=WFL YbfvVeoRO07V42PNL3qIN3OrFdy+1IpVB/1I4r5UhI6E/CfP4PH/q5iUaqfhRkHizApjHu17lW+1M urUWaON0+jShVVcMPaeSSwD06WC02ljDLCsbQyfnrXv7Wec5SCHwq0QIIILlGUzXEkiC6kRM31CkL wDkdoQsdR0IjgsK1vj9PF6iG/OtQtzuxR8HhON5xynG0q1ebwaqNHJF8r+OD/wrUQl6m7qOs+ggfJ 72eY/RDlV5PTC4KHe7bX92PuNujNc750Al8Lfjbm/cmpE3E3tB4C/f4h38i/Wn0q7tW25Nzl6ERsp //yyBF+I6FqpstsFCqzLDYwAPYJg6hg==; 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 1h3Z7F-000164-Rm; Tue, 12 Mar 2019 04:34:13 +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 1h3Z7D-00015d-G3 for ath10k@lists.infradead.org; Tue, 12 Mar 2019 04:34:12 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2EF3F607C3; Tue, 12 Mar 2019 04:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552365249; bh=KwzbrWBYXszv7PvzuATdkZzaJG8kj7CXlvg95Aer6W0=; h=From:To:Cc:Subject:Date:From; b=BuNFOmR0ypaOIKzgXK9az/NvdlvtfRP0h4R4XM9phrXmxneAOeuYjiIOYVeEhDYvx 2B8Owy4DIxTnqDXYrxeJNKgc79jawY7rmfpRMYTfN2d3L/qr6RyUOeUGfJ/RSuLhBC fZ3aagwbqZCZpms3jfkCjxxDe2vaIKPsaR1IjIt4= Received: from hy-Z220.ap.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: yanghuan@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8C90C6021F; Tue, 12 Mar 2019 04:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552365248; bh=KwzbrWBYXszv7PvzuATdkZzaJG8kj7CXlvg95Aer6W0=; h=From:To:Cc:Subject:Date:From; b=GleS3K05BsQxAtY13nnss8MeoHlvzQSd4tUGblYEm9Cv7Cz+9w79lIQmQRnuPmk0a jW4qGoEYgwZuC70Pup0VewZuqT6BKa7oyN2Uw1ZrV0U+u4Ai7OI73WTHHVH8v3/VgN 5xl2uQ8wihzeeV+/1RTB/+zyyYAzaf8qXzuocu6E= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8C90C6021F 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=yanghuan@codeaurora.org From: Brandon Huang To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: Fix the tx stats bytes & packets parsing Date: Tue, 12 Mar 2019 12:33:39 +0800 Message-Id: <1552365219-16842-1-git-send-email-yanghuan@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190311_213411_571029_77325852 X-CRM114-Status: GOOD ( 11.02 ) 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: Brandon Huang , 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 In tx_stats debugfs, txrate->flags may contain multiple bits. For example, RATE_INFO_FLAGS_SHORT_GI could be set, and tx stats bytes and packets will be not updated correctly. Fix this issue by using bit operation to check txrate->flags. Tested HW: QCA9984 Tested Firmware: 10.4-3.9.0.1-00007 Signed-off-by: Brandon Huang --- drivers/net/wireless/ath/ath10k/htt_rx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index a20ea27..584b86b 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2938,14 +2938,14 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) #define STATS_OP_FMT(name) tx_stats->stats[ATH10K_STATS_TYPE_##name] - if (txrate->flags == RATE_INFO_FLAGS_VHT_MCS) { + if (txrate->flags & RATE_INFO_FLAGS_VHT_MCS) { STATS_OP_FMT(SUCC).vht[0][mcs] += pstats->succ_bytes; STATS_OP_FMT(SUCC).vht[1][mcs] += pstats->succ_pkts; STATS_OP_FMT(FAIL).vht[0][mcs] += pstats->failed_bytes; STATS_OP_FMT(FAIL).vht[1][mcs] += pstats->failed_pkts; STATS_OP_FMT(RETRY).vht[0][mcs] += pstats->retry_bytes; STATS_OP_FMT(RETRY).vht[1][mcs] += pstats->retry_pkts; - } else if (txrate->flags == RATE_INFO_FLAGS_MCS) { + } else if (txrate->flags & RATE_INFO_FLAGS_MCS) { STATS_OP_FMT(SUCC).ht[0][ht_idx] += pstats->succ_bytes; STATS_OP_FMT(SUCC).ht[1][ht_idx] += pstats->succ_pkts; STATS_OP_FMT(FAIL).ht[0][ht_idx] += pstats->failed_bytes; @@ -2966,7 +2966,7 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) if (ATH10K_HW_AMPDU(pstats->flags)) { tx_stats->ba_fails += ATH10K_HW_BA_FAIL(pstats->flags); - if (txrate->flags == RATE_INFO_FLAGS_MCS) { + if (txrate->flags & RATE_INFO_FLAGS_MCS) { STATS_OP_FMT(AMPDU).ht[0][ht_idx] += pstats->succ_bytes + pstats->retry_bytes; STATS_OP_FMT(AMPDU).ht[1][ht_idx] +=