From patchwork Tue Jun 25 10:00:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganesh Sesetti X-Patchwork-Id: 11015181 X-Patchwork-Delegate: kvalo@adurom.com 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 062541580 for ; Tue, 25 Jun 2019 10:00:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECC2C288C6 for ; Tue, 25 Jun 2019 10:00:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0EA728922; Tue, 25 Jun 2019 10:00:27 +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 72DF0289B0 for ; Tue, 25 Jun 2019 10:00:27 +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=cSvvmTmV139P8u1aZwDW20msnRkv30sXYkvQewQZpkM=; b=K0j pe3nfLd3R4ZJ8wKJYdL+A41T157wlCCrz15oLbILhPaVKGc9HgldFy/mFU/OuZn0aunOA2HLetiMC +hWeQEYICj14ll2SD6id8CyGahjWqTYIh/qxSIy9GuzF1jPnRF6M7HQpCxLTXJhoQ44+sZgT4rD1l 858PbOCstK3k5N7opNjlfGvYIe8KdnB86NBcMa8Kt3E0rPNUaJHBi7iFqUhXZQntIxAVyxcklnCQi T/wnsAmXSCMXo+a2wDXRSxGmRNgUqG91DEieZFAZjqStYbvCHcNqNM6KER2mwGZ3pvAP5pdqzjWcl 9YdqDxmYh2BFCNaEuONpTgNceF/owyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfiFW-0001RY-Ms; Tue, 25 Jun 2019 10:00:26 +0000 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfiFT-0001R3-Ai for ath11k@lists.infradead.org; Tue, 25 Jun 2019 10:00:25 +0000 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 25 Jun 2019 03:00:22 -0700 X-IronPort-AV: E=McAfee;i="6000,8403,9298"; a="354659095" Received: from c-gseset-linux.qca.qualcomm.com (HELO c-gseset-linux.qualcomm.com) ([10.201.26.126]) by ironmsg01-sd.qualcomm.com with ESMTP; 25 Jun 2019 03:00:20 -0700 Received: by c-gseset-linux.qualcomm.com (Postfix, from userid 2334523) id 066E51C7B; Tue, 25 Jun 2019 15:30:18 +0530 (IST) From: Ganesh Sesetti To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: Fix rx_duration reporting Date: Tue, 25 Jun 2019 15:30:16 +0530 Message-Id: <1561456816-27459-1-git-send-email-gseset@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-20190625_030023_578129_D750F783 X-CRM114-Status: UNSURE ( 9.18 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ganesh Sesetti MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since rx duration is wrongly reported in iw wlanX station dump, fetch correct rx duration reported in PPDU_END tlv. Enable PPDU_END, MPDU_START and PPDU_END_STATUS_DONE tlv reporting in monitor status by default. Pass the sta's Rx duration to mac80211 in sta_statistics() ops. Signed-off-by: Ganesh Sesetti --- drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/debugfs_sta.c | 2 ++ drivers/net/wireless/ath/ath11k/dp_rx.c | 2 ++ drivers/net/wireless/ath/ath11k/hal_rx.c | 8 ++++++++ drivers/net/wireless/ath/ath11k/hal_rx.h | 8 ++++++++ drivers/net/wireless/ath/ath11k/mac.c | 4 +++- 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index c05bce994956..3f62d67ce705 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -239,6 +239,7 @@ struct ath11k_rx_peer_stats { u64 pream_cnt[HAL_RX_PREAMBLE_MAX]; u64 reception_type[HAL_RX_RECEPTION_TYPE_MAX]; u32 rssi_comb; + u64 rx_duration; }; struct ath11k_peer { diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c index c39b6e1d22c3..6c88dd26fec4 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c @@ -362,6 +362,8 @@ static ssize_t ath11k_dbg_sta_dump_rx_stats(struct file *file, len += scnprintf(buf + len, size - len, "\nNSS(1-8):"); for (i = 0; i < HAL_RX_MAX_NSS; i++) len += scnprintf(buf + len, size - len, "%llu ", rx_stats->nss_count[i]); + len += scnprintf(buf + len, size - len, "\nRX Duration:%llu ", + rx_stats->rx_duration); len += scnprintf(buf + len, size - len, "\n"); spin_unlock_bh(&ar->ab->data_lock); diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 3566258c0c6d..ad4e2ea73119 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -2146,6 +2146,7 @@ static void ath11k_dp_rx_update_peer_stats(struct ath11k_sta *arsta, rx_stats->num_mpdu_fcs_err += ppdu_info->num_mpdu_fcs_err; rx_stats->rssi_comb = ppdu_info->rssi_comb; + rx_stats->rx_duration = ppdu_info->rx_duration; } static struct sk_buff *ath11k_dp_rx_alloc_mon_status_buf(struct ath11k_base *ab, @@ -2399,6 +2400,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id, } arsta = (struct ath11k_sta *)peer->sta->drv_priv; + arsta->rx_duration = ppdu_info.rx_duration; ath11k_dp_rx_update_peer_stats(arsta, &ppdu_info); if (ath11k_debug_is_pktlog_peer_vaild(ar, peer->addr)) { diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.c b/drivers/net/wireless/ath/ath11k/hal_rx.c index 0308089c88df..6b06826394b9 100644 --- a/drivers/net/wireless/ath/ath11k/hal_rx.c +++ b/drivers/net/wireless/ath/ath11k/hal_rx.c @@ -1149,6 +1149,14 @@ void ath11k_hal_reo_hw_setup(struct ath11k_base *ab, ppdu_info->peer_id = peer_id; break; } + case HAL_RXPCU_PPDU_END_INFO: { + struct hal_rx_ppdu_end_duration *ppdu_rx_duration = + (struct hal_rx_ppdu_start *)tlv_data; + ppdu_info->rx_duration = + FIELD_GET(HAL_RX_PPDU_END_DURATION, + __le32_to_cpu(ppdu_rx_duration->info0)); + break; + } case HAL_DUMMY: return HAL_RX_MON_STATUS_BUF_DONE; case HAL_RX_PPDU_END_STATUS_DONE: diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.h b/drivers/net/wireless/ath/ath11k/hal_rx.h index 650ebe5d952c..eaf53b9ca4af 100644 --- a/drivers/net/wireless/ath/ath11k/hal_rx.h +++ b/drivers/net/wireless/ath/ath11k/hal_rx.h @@ -124,6 +124,7 @@ struct hal_rx_mon_ppdu_info { u8 rssi_comb; u8 tid; u8 reception_type; + u64 rx_duration; }; #define HAL_RX_PPDU_START_INFO0_PPDU_ID GENMASK(15, 0) @@ -275,6 +276,13 @@ struct hal_rx_mpdu_info { __le32 rsvd1[21]; } __packed; +#define HAL_RX_PPDU_END_DURATION GENMASK(23, 0) +struct hal_rx_ppdu_end_duration { + __le32 rsvd0[9]; + __le32 info0; + __le32 rsvd1[4]; +} __packed; + struct hal_rx_rxpcu_classification_overview { u32 rsvd0; } __packed; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index fe5c4a888ea7..2d7ec9404bcc 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -111,7 +111,9 @@ HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE, .pkt_filter_flags0 = HTT_RX_FP_MGMT_FILTER_FLAGS0, .pkt_filter_flags1 = HTT_RX_FP_MGMT_FILTER_FLAGS1, - .pkt_filter_flags3 = HTT_RX_FP_DATA_FILTER_FLASG3 + .pkt_filter_flags2 = HTT_RX_FP_CTRL_FILTER_FLASG2, + .pkt_filter_flags3 = HTT_RX_FP_DATA_FILTER_FLASG3 | + HTT_RX_FP_CTRL_FILTER_FLASG3 }; #define ATH11K_MAC_FIRST_OFDM_RATE_IDX 4