From patchwork Mon Nov 25 16:36:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 11260613 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAE80138C for ; Mon, 25 Nov 2019 16:36:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C784820740 for ; Mon, 25 Nov 2019 16:36:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TkhnU5aJ"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="ajN8YIG/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="SpSHf5CZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C784820740 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org 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=XIAJuIWEzRvJGFlwAWHD5C6H6gawxVMn2ifusSEe+qc=; b=TkhnU5aJ3M9oxiR/TItJSrUQcz WCmz5hhZoLb2n7OTdnVzAfg12A6dLZEGbKUTXqzYvHCrcu0lBSKReGof7VgAQyYTCSAeVHiEz5dHp 45ENwYavq6UDeD7NbmBLRNmKeUG+4Ro2lDcfuw5yan9FeOeBtB/pucBCsbsMif9EIuKwDOIybxQei bJPb7sUwxwxsuc0geG+GDUcgCuGPkp+eYculaXJT6FWX8Acv1L5z5RSwlHay+nsTCwnBLzmRln1n/ I2cGLZefUw7WD85M0goJmbeZF1op2bk7Xy3dBiSW+aBeJOTdgQpBrNpv7W7fnlbP1/UyS1q+Yt/QG DCtN3NeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iZHLh-0006ty-1b; Mon, 25 Nov 2019 16:36:29 +0000 Received: from a27-185.smtp-out.us-west-2.amazonses.com ([54.240.27.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iZHLc-0006pp-99 for ath11k@lists.infradead.org; Mon, 25 Nov 2019 16:36:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574699782; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=ptQo3o2Cds+Gk/PFuVcSEw/zhh4oG0rTcHOJZlPimrM=; b=ajN8YIG/kHn8S6kOMiLkqZbwZXpCB/PeiO2rbrB4IE6t+9NEA5v2b+KIM5aLbB8l q98lYfVCkwc5rErYXKiFrjqblsEyR5RCx8xWn/9ovkWNGtF5wBYmdlsPo7y77Stpq8Y 56Of1/cUYAlC6Vh3/jgijBTjDdL54Y/5p9SpLVYA= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574699782; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=ptQo3o2Cds+Gk/PFuVcSEw/zhh4oG0rTcHOJZlPimrM=; b=SpSHf5CZREQIoXpzfpRZgjmLs7IVOgdSfJ6h/Xk1EKcssMV2SLyHUnxZkym5Xw3I x/a8WUDZ+SfHdsWFs8dIvgFlW/6QnC+3L413gPL+4QN7h8Wpsqs20IibQ1YtBjY7KXc f/U01wFH3gFjIQWdw+UDLnI6dUMcuJJOyMlXXJE0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F0181C447AC Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 4/8] ath11k: fix missed bw conversion in tx completion Date: Mon, 25 Nov 2019 16:36:22 +0000 Message-ID: <0101016ea36bd186-58d91e19-0aaa-484f-aa0c-959488bb5812-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574699772-17938-1-git-send-email-kvalo@codeaurora.org> References: <1574699772-17938-1-git-send-email-kvalo@codeaurora.org> X-SES-Outgoing: 2019.11.25-54.240.27.185 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191125_083624_357768_AA79E39B X-CRM114-Status: GOOD ( 10.50 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [54.240.27.185 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: ath11k@lists.infradead.org MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org From: Tamizh chelvam TX rate stats for the retried packets for a station comes through tx completion events. Assigning hw reported bandwidth information directly to station's txrate bandwidth will cause below warning. Fix this warning by converting the hw reported bandwidth to mac80211 base bandwidth. [ 134.758190] PC is at cfg80211_calculate_bitrate+0x1bc/0x214 [cfg80211] [ 134.765730] LR is at cfg80211_calculate_bitrate+0x1bc/0x214 [cfg80211] [ 134.875014] [] cfg80211_calculate_bitrate+0x1bc/0x214 [cfg80211] [ 134.877192] [] nl80211_put_sta_rate+0x54/0xf24 [cfg80211] [ 134.884829] [] nl80211_put_sta_rate+0x698/0xf24 [cfg80211] [ 134.891687] [] nl80211_put_sta_rate+0xde0/0xf24 [cfg80211] [ 134.898975] [] genl_lock_dumpit+0x30/0x4c [ 134.905998] [] netlink_dump+0xf4/0x248 [ 134.911291] [] __netlink_dump_start+0xe0/0x174 [ 134.916850] [] genl_family_rcv_msg+0x130/0x2c0 Signed-off-by: Tamizh chelvam Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/debugfs_sta.c | 2 +- drivers/net/wireless/ath/ath11k/dp_rx.c | 30 ++++----------------------- drivers/net/wireless/ath/ath11k/mac.c | 22 ++++++++++++++++++++ drivers/net/wireless/ath/ath11k/mac.h | 1 + 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c index b392117eff3c..3c5f931e22a9 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c @@ -192,7 +192,7 @@ void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar, } arsta->txrate.nss = arsta->last_txrate.nss; - arsta->txrate.bw = ts->bw; + arsta->txrate.bw = ath11k_mac_bw_to_mac80211_bw(ts->bw); ath11k_accumulate_per_peer_tx_stats(arsta, peer_stats, rate_idx); spin_unlock_bh(&ab->base_lock); diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index d5963509419b..0ff0ff81adeb 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -987,28 +987,6 @@ int ath11k_dp_htt_tlv_iter(struct ath11k_base *ab, const void *ptr, size_t len, return 0; } -static u8 ath11k_bw_to_mac80211_bw(u8 bw) -{ - u8 ret = 0; - - switch (bw) { - case ATH11K_BW_20: - ret = RATE_INFO_BW_20; - break; - case ATH11K_BW_40: - ret = RATE_INFO_BW_40; - break; - case ATH11K_BW_80: - ret = RATE_INFO_BW_80; - break; - case ATH11K_BW_160: - ret = RATE_INFO_BW_160; - break; - } - - return ret; -} - static u32 ath11k_bw_to_mac80211_bwflags(u8 bw) { u32 bwflags = 0; @@ -1157,7 +1135,7 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, } arsta->txrate.nss = nss; - arsta->txrate.bw = ath11k_bw_to_mac80211_bw(bw); + arsta->txrate.bw = ath11k_mac_bw_to_mac80211_bw(bw); arsta->tx_info.status.rates[0].flags |= ath11k_bw_to_mac80211_bwflags(bw); memcpy(&arsta->last_txrate, &arsta->txrate, sizeof(struct rate_info)); @@ -1934,7 +1912,7 @@ static void ath11k_dp_rx_h_rate(struct ath11k *ar, struct hal_rx_desc *rx_desc, rx_status->rate_idx = rate_mcs + (8 * (nss - 1)); if (sgi) rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI; - rx_status->bw = ath11k_bw_to_mac80211_bw(bw); + rx_status->bw = ath11k_mac_bw_to_mac80211_bw(bw); break; case RX_MSDU_START_PKT_TYPE_11AC: rx_status->encoding = RX_ENC_VHT; @@ -1948,7 +1926,7 @@ static void ath11k_dp_rx_h_rate(struct ath11k *ar, struct hal_rx_desc *rx_desc, rx_status->nss = nss; if (sgi) rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI; - rx_status->bw = ath11k_bw_to_mac80211_bw(bw); + rx_status->bw = ath11k_mac_bw_to_mac80211_bw(bw); break; case RX_MSDU_START_PKT_TYPE_11AX: rx_status->rate_idx = rate_mcs; @@ -1960,7 +1938,7 @@ static void ath11k_dp_rx_h_rate(struct ath11k *ar, struct hal_rx_desc *rx_desc, } rx_status->encoding = RX_ENC_HE; rx_status->nss = nss; - rx_status->bw = ath11k_bw_to_mac80211_bw(bw); + rx_status->bw = ath11k_mac_bw_to_mac80211_bw(bw); break; } } diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cb025a4a5785..939f5880bce6 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -156,6 +156,28 @@ static const u32 ath11k_smps_map[] = { [WLAN_HT_CAP_SM_PS_DISABLED] = WMI_PEER_SMPS_PS_NONE, }; +u8 ath11k_mac_bw_to_mac80211_bw(u8 bw) +{ + u8 ret = 0; + + switch (bw) { + case ATH11K_BW_20: + ret = RATE_INFO_BW_20; + break; + case ATH11K_BW_40: + ret = RATE_INFO_BW_40; + break; + case ATH11K_BW_80: + ret = RATE_INFO_BW_80; + break; + case ATH11K_BW_160: + ret = RATE_INFO_BW_160; + break; + } + + return ret; +} + int ath11k_mac_hw_ratecode_to_legacy_rate(u8 hw_rc, u8 preamble, u8 *rateidx, u16 *rate) { diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/ath/ath11k/mac.h index f84af1fc4952..8c37573ae5dc 100644 --- a/drivers/net/wireless/ath/ath11k/mac.h +++ b/drivers/net/wireless/ath/ath11k/mac.h @@ -142,4 +142,5 @@ struct ath11k *ath11k_mac_get_ar_vdev_stop_status(struct ath11k_base *ab, void ath11k_mac_drain_tx(struct ath11k *ar); void ath11k_mac_peer_cleanup_all(struct ath11k *ar); int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); +u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); #endif