From patchwork Tue May 28 06:48:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 10963925 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 45C0B1395 for ; Tue, 28 May 2019 06:54:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34F9C28757 for ; Tue, 28 May 2019 06:54:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2942128776; Tue, 28 May 2019 06:54:12 +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 A241A28757 for ; Tue, 28 May 2019 06:54:11 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=9o+uLNotCzNv7CpvUKVFWPefIcMRg55xaJCuGMjt+y4=; b=Cb4eqN/ulfSjQT +Z6+cLsFRiRqck7hHtc/SBt8puHc1H9Ahf7jm7C413Xmbt/OS8uaMe/lMdnLs1UbSDoX0GpaSE2W6 qXlC5JBS9TJjUIm4qvNxQKQ4codC/DCuzkSDlEhZ2CM2RT+CisGcB3i6gzpl9dXq4ciXBhNmWs+rF KtIzQcIr0dYxhk0gpxt6yUrOS8x/fNKXJIT38oB5Bmyvmazel9kFJjbvVlJJ1+7O1S+11V/kXiclL 8Ij3g9TXufZZr03VtYZfby0o3hKvilJ01eYCFDIiFrMuIV2VjNcRPKIuUwx5LaCYUxGfCYTKJ3H5K xqm7sN1dHPA7bAF6o9vw==; 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 1hVVzu-0005xf-GG; Tue, 28 May 2019 06:54:10 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVVzr-0005xE-5m for ath11k@lists.infradead.org; Tue, 28 May 2019 06:54:08 +0000 Received: from p5dcfb1b7.dip0.t-ipconnect.de ([93.207.177.183] helo=bertha.fritz.box) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1hVVuC-0001w3-Ji; Tue, 28 May 2019 08:48:16 +0200 From: John Crispin To: Kalle Valo Subject: [PATCH V6 11/11] ath11k: add HE rate reporting Date: Tue, 28 May 2019 08:48:03 +0200 Message-Id: <20190528064803.24419-12-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528064803.24419-1-john@phrozen.org> References: <20190528064803.24419-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190527_235407_367257_61A147FD X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashidhar Lakkavalli , ath11k@lists.infradead.org, John Crispin Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add TX rate reporting. We still need to figure out how to read the ru_alloc and DCM values from FW. Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/dp.h | 9 +++++ drivers/net/wireless/ath/ath11k/dp_rx.c | 45 ++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/ath/ath11k/dp.h index 79b665816378..0bb7cbc92e11 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -1049,6 +1049,13 @@ struct htt_ppdu_stats_common { u16 bw_mhz; } __packed; +enum htt_ppdu_stats_gi { + HTT_PPDU_STATS_SGI_0_8_US, + HTT_PPDU_STATS_SGI_0_4_US, + HTT_PPDU_STATS_SGI_1_6_US, + HTT_PPDU_STATS_SGI_3_2_US, +}; + #define HTT_PPDU_STATS_USER_RATE_INFO0_USER_POS_M GENMASK(3,0) #define HTT_PPDU_STATS_USER_RATE_INFO0_MU_GROUP_ID_M GENMASK(11,4) @@ -1077,6 +1084,8 @@ struct htt_ppdu_stats_common { FIELD_GET(HTT_PPDU_STATS_USER_RATE_FLAGS_MCS_M, _val) #define HTT_USR_RATE_GI(_val) \ FIELD_GET(HTT_PPDU_STATS_USER_RATE_FLAGS_GI_M, _val) +#define HTT_USR_RATE_DCM(_val) \ + FIELD_GET(HTT_PPDU_STATS_USER_RATE_FLAGS_DCM_M, _val) #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_LTF_SIZE_M GENMASK(1,0) #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_STBC_M BIT(2) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 38cc787671ee..c8f190be3e82 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -831,6 +831,24 @@ static inline u32 ath11k_bw_to_mac80211_bwflags(u8 bw) return bwflags; } +static inline u32 ath11k_he_gi_to_nl80211_he_gi(u8 sgi) +{ + u32 ret = 0; + + switch (sgi) { + case RX_MSDU_START_SGI_0_8_US: + ret = NL80211_RATE_INFO_HE_GI_0_8; + break; + case RX_MSDU_START_SGI_1_6_US: + ret = NL80211_RATE_INFO_HE_GI_1_6; + break; + case RX_MSDU_START_SGI_3_2_US: + ret = NL80211_RATE_INFO_HE_GI_3_2; + break; + } + return ret; +} + static void ath11k_update_per_peer_tx_stats(struct ath11k *ar, struct htt_ppdu_user_stats *usr_stats) @@ -843,7 +861,7 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, struct ieee80211_chanctx_conf *conf = NULL; struct ath11k_per_peer_tx_stats *peer_stats = &ar->peer_tx_stats; int ret; - u8 flags, mcs, nss, bw, sgi, rate_idx = 0; + u8 flags, mcs, nss, bw, sgi, dcm, rate_idx = 0; u32 succ_bytes = 0; u16 rate = 0, succ_pkts = 0; bool is_ampdu = false; @@ -871,12 +889,18 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, nss = HTT_USR_RATE_NSS(user_rate->rate_flags) + 1; mcs = HTT_USR_RATE_MCS(user_rate->rate_flags); sgi = HTT_USR_RATE_GI(user_rate->rate_flags); + dcm = HTT_USR_RATE_DCM(user_rate->rate_flags); /* Note: If host configured fixed rates and in some other special * cases, the broadcast/management frames are sent in different rates. * Firmare rate's control to be skipped for this? */ + if (flags == WMI_RATE_PREAMBLE_HE && mcs > 11) { + ath11k_warn(ab, "Invalid HE mcs %hhd peer stats", mcs); + return; + } + if (flags == WMI_RATE_PREAMBLE_VHT && mcs > 9) { ath11k_warn(ab, "Invalid VHT mcs %hhd peer stats", mcs); return; @@ -951,6 +975,23 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, IEEE80211_TX_RC_SHORT_GI; } break; + case WMI_RATE_PREAMBLE_HE: + arsta->txrate.mcs = mcs; + arsta->txrate.flags = RATE_INFO_FLAGS_HE_MCS; + arsta->txrate.he_dcm = dcm; + /* TODO how do we get the RU rate ? */ + arsta->txrate.he_ru_alloc = 0; + arsta->txrate.he_gi = ath11k_he_gi_to_nl80211_he_gi(sgi); + /* TODO arsta->tx_info.status.rates cannot be set as there are not + * enough bits left. Use VHT for now. + */ + arsta->tx_info.status.rates[0].flags |= IEEE80211_TX_RC_VHT_MCS; + if (sgi) { + arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; + arsta->tx_info.status.rates[0].flags |= + IEEE80211_TX_RC_SHORT_GI; + } + break; } arsta->txrate.nss = nss; @@ -1737,6 +1778,8 @@ static void ath11k_dp_rx_h_rate(struct ath11k *ar, void *rx_desc, rx_status->encoding = RX_ENC_HE; rx_status->nss = nss; rx_status->bw = ath11k_bw_to_mac80211_bw(bw); + rx_status->he_gi = ath11k_he_gi_to_nl80211_he_gi(sgi); + /* TODO DCM and RU are missing */ break; } }