From patchwork Thu May 11 09:09:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 9721111 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.web.codeaurora.org (Postfix) with ESMTP id A7C7160364 for ; Thu, 11 May 2017 09:10:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95D061FE82 for ; Thu, 11 May 2017 09:10:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 874662865D; Thu, 11 May 2017 09:10: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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 1B9E81FE82 for ; Thu, 11 May 2017 09:10: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: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=BZkOEmdrTalW6hu+kA6jGUwgwV1DHB1oi35s2BvKX4Q=; b=rn1 TzDV+jemIUY6JnqQKOJO6SC/htdOYTCjSqtvLpkP3sR/I4AwFYxlPRKSBE67jPn86geb4dcIhKMMg BnxsJ07J4//vjU0PCClRbg8WAc6kD2KpAIALF7uCWq6U6aQnnDoVHct8/08G+BKzfwK9+fuLKilM0 WlGxiMAbHZYCvwbYMyAznMcTpbEN1P4KuKZ6ew1hUhZ3ZOKIirXkDQ3OrPygjtw6ox7xvvxyrFenB 0y2qtExDY+Ygoa9yx9wvdkfcah+q8yJwp48dL76VQFPtuJVzy1Q0fefLr7He58ebR7XJn+kCyM1AM c9r+/cVpDc24KOfGH9eFbh46MCROCwg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d8k6o-0002iQ-2H; Thu, 11 May 2017 09:10:06 +0000 Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d8k6g-0002Aa-44 for ath10k@lists.infradead.org; Thu, 11 May 2017 09:10:00 +0000 Received: by mail-wr0-x22d.google.com with SMTP id w50so15177750wrc.0 for ; Thu, 11 May 2017 02:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=B+qwhYS2OcocufmSbW6GHR5vlRKNOZYJmYm3WDi6kdc=; b=LLxGIB1OkbfWqn1Txj10hocrv603hmxYwBrA7iAtrisr6s7tcDD70qsJ54RCVLZlcW pKqRAVeE+eWoaT2DR0d+EBonGkOGjv+LWU/9FVBtlTued6Q9Yqy5rE+5RM1E4Y+/5nFv YxteLHrrGTQlQH3Ig0xR1mJvE7388VhqYIMSNM9O+Ypdstj36dyExvCtK4ZRYvK3AD6x cbI9QVQE0tVi4pV074wrx1ICEhq0D65BHcx6dRKTKN/Ctq3cJV82EjWdiO5iDeS1Wex1 J3DTuyjCSlgSBESI4bOyu1BOmGXhF5HDfAQFl+y+QmdaPjbAx/VX7Es3vwizHh0foYNN 7M5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=B+qwhYS2OcocufmSbW6GHR5vlRKNOZYJmYm3WDi6kdc=; b=CNmRdx7ugcyGcsLBdLgchu7j+S4krZnCqIkDkpeNDD7u/xX/sC6UuswueTKbjN7pyb F0sHkT/MPDnsDG/zPUP81knD0wRqR+DWYMKh0GBJDqdES044CL6zG19Ho2YLogo0tzEz pw492NcYOolVKUyoHxzDCQ3zIhPMSeT2h/D8WgtEVuvSBE3LzVoserZA7BAasPwAztgI hA8RUqLPyvmlP95l4pVdCr9t38/aKAmbAM9sSXiaDILDvwQ6gA6zWm5k/oE1yV0S+8US W20l6JM5nPM1i14qAmIyohYM8laoQ0Xdl9FyZ8lN0YklmaaN1LYqLfBxAvlPypyun36S YdoA== X-Gm-Message-State: AODbwcAmzYHaiLYnYYprOGkleSW5EZI9URXQgWjDONbIuoUiGi7Ttk6s 4dov7HMwAuu3e7ip X-Received: by 10.223.149.68 with SMTP id 62mr6554265wrs.7.1494493776183; Thu, 11 May 2017 02:09:36 -0700 (PDT) Received: from sven-desktop.home.narfation.org (p2003007C6F60E8FE527B9DFFFECE2683.dip0.t-ipconnect.de. [2003:7c:6f60:e8fe:527b:9dff:fece:2683]) by smtp.gmail.com with ESMTPSA id c128sm6690132wmh.32.2017.05.11.02.09.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 May 2017 02:09:35 -0700 (PDT) From: Sven Eckelmann To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: Fix reported HT MCS rates with NSS > 1 Date: Thu, 11 May 2017 11:09:30 +0200 Message-Id: <20170511090930.18205-1-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170511_020958_321432_F87CF436 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. 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: akolli@qti.qualcomm.com, linux-wireless@vger.kernel.org, Sven Eckelmann MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The QCA4019 firmware 10.4-3.2.1-00050 reports only HT MCS rates between 0-9. But 802.11n MCS rates can be larger than that. For example a 2x2 device can send with up to MCS 15. The firmware encodes the higher MCS rates using the NSS field. The actual calculation is not documented by QCA but it seems like the NSS field can be mapped for HT rates to following MCS offsets: * NSS 1: 0 * NSS 2: 8 * NSS 3: 16 * NSS 4: 24 This offset therefore has to be added for HT rates before they are stored in the rate_info struct. Fixes: cec17c382140 ("ath10k: add per peer htt tx stats support for 10.4") Signed-off-by: Sven Eckelmann --- drivers/net/wireless/ath/ath10k/htt_rx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 84b6067ff6e7..6c0a821fe79d 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2229,9 +2229,15 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar, txrate.mcs = ATH10K_HW_MCS_RATE(peer_stats->ratecode); sgi = ATH10K_HW_GI(peer_stats->flags); - if (((txrate.flags == WMI_RATE_PREAMBLE_HT) || - (txrate.flags == WMI_RATE_PREAMBLE_VHT)) && txrate.mcs > 9) { - ath10k_warn(ar, "Invalid mcs %hhd peer stats", txrate.mcs); + if (txrate.flags == WMI_RATE_PREAMBLE_VHT && txrate.mcs > 9) { + ath10k_warn(ar, "Invalid VHT mcs %hhd peer stats", txrate.mcs); + return; + } + + if (txrate.flags == WMI_RATE_PREAMBLE_HT && + (txrate.mcs > 7 || txrate.nss < 1)) { + ath10k_warn(ar, "Invalid HT mcs %hhd nss %hhd peer stats", + txrate.mcs, txrate.nss); return; } @@ -2254,7 +2260,7 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar, arsta->txrate.legacy = rate; } else if (txrate.flags == WMI_RATE_PREAMBLE_HT) { arsta->txrate.flags = RATE_INFO_FLAGS_MCS; - arsta->txrate.mcs = txrate.mcs; + arsta->txrate.mcs = txrate.mcs + 8 * (txrate.nss - 1); } else { arsta->txrate.flags = RATE_INFO_FLAGS_VHT_MCS; arsta->txrate.mcs = txrate.mcs;