From patchwork Tue Jul 30 13:45:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 11065849 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 6CCCE1823 for ; Tue, 30 Jul 2019 13:46:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A2AA1FF81 for ; Tue, 30 Jul 2019 13:46:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DA032003F; Tue, 30 Jul 2019 13:46:42 +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 542481FF81 for ; Tue, 30 Jul 2019 13:46:41 +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=GC9nLqBHCiF7rzTWgMMeK6OTccDVejECNXoqvY2oNqg=; b=KoY f3fnvhobiHQqkUf76mb9ocQ4vR3Mwawokz3oNVliBicI4wF+62DBjLWlJLi+WUnY5ISfuz/C+e0on Dy4Sf8ZwmByAW36ARic+3fE+85/QU7gFHRxd1KmQVriAhgnGJEyYlB75Y5DyVs0XqdiLYK+Z1AF+B Q9W7lsmjyIgrJr14BUJGqQMcL6PUJ8vqcMhbTa07HyeUZXVdP9j7FfHw/aPGSXf8cKFks/2cTCt5r NU9irvYMcXuZLk5srEgHKNmJEoVTeHjQedOn2kwLv2CetQLnmXiq5q2TgS/dYCNevACTq1F2xD1IX 2HtCNGuvqQOXrjsGyLHJKzERdnz6wpw==; 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 1hsSSc-0005aR-V6; Tue, 30 Jul 2019 13:46:38 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hsSSa-0005a5-D6 for ath11k@lists.infradead.org; Tue, 30 Jul 2019 13:46:37 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7CF8C605A5; Tue, 30 Jul 2019 13:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1564494395; bh=3pBxQ+KBl5fKOQNPe+T60RSkexWsq8YzpezJsr8U8MI=; h=From:To:Cc:Subject:Date:From; b=CM+S7852uMsIYEe9UKpwwQBdNAILcJB06Ad7gTuuoGVnLl0JnPJaNWgEyNWFedQ5t NVBLlYkWZkFiwP8HgIKfMKv5OoXoCHec2DQsSW26jgG1KH7gDABtJldyEJRcWYVWkz I5umGkufUq9z8YkpeuQ4jswp3mRMc/9sRx3hURPw= Received: from cheath10p342229-lin.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 26E6E606FC; Tue, 30 Jul 2019 13:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1564494394; bh=3pBxQ+KBl5fKOQNPe+T60RSkexWsq8YzpezJsr8U8MI=; h=From:To:Cc:Subject:Date:From; b=FDf1DxSm6Agnx+lSAdmNITWdnwKYlkn/d0pziB7UtWsU0uB/O9wBwd4l2qdztX1fE hbGASX+CC97xllMWoklsgOMw9cQecajB0fa7xa8h7TQ+UMhi+BuE3bkx70Qo5vBoL7 f4jBigf1UhOWOYEEfmahIo2qwt3/feYejkFRtoBg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 26E6E606FC 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=tamizhr@codeaurora.org From: Tamizh chelvam To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: fix missed bw conversion in tx completion Date: Tue, 30 Jul 2019 19:15:34 +0530 Message-Id: <1564494334-5187-1-git-send-email-tamizhr@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-20190730_064636_492128_F22D169D X-CRM114-Status: GOOD ( 11.83 ) 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: Tamizh chelvam MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 83d65ea..ed44d39 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 3794cac..59f6839 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 @@ static u32 ath11k_bw_to_mac80211_bwflags(u8 bw) } 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 6a3b1a1..aad773a 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -156,6 +156,28 @@ [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 7ced4bc1..3ead899 100644 --- a/drivers/net/wireless/ath/ath11k/mac.h +++ b/drivers/net/wireless/ath/ath11k/mac.h @@ -190,4 +190,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