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: 9721109 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 F324460364 for ; Thu, 11 May 2017 09:09:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E539C1FE82 for ; Thu, 11 May 2017 09:09:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9CC82865D; Thu, 11 May 2017 09:09:40 +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=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AD3B1FE82 for ; Thu, 11 May 2017 09:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754928AbdEKJJi (ORCPT ); Thu, 11 May 2017 05:09:38 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:34818 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752011AbdEKJJh (ORCPT ); Thu, 11 May 2017 05:09:37 -0400 Received: by mail-wr0-f172.google.com with SMTP id z52so15087465wrc.2 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=XnsI1w401QL2EruJDEYLB5DTfOQRvoAO5k1K2+bUSFZEKEKgxnrEhmTgmQE0Tl2wGq BzdV/YUDfLC3+lL4BUuyz4RNmcX6UDb6QAYJ3Nr3OErTkKVHQrtY1fNf1yK0WsP1L7Ff 6maVhYKsBoeM7KtXDfbPHz5cKPHQDPTHJMgXMWM4vibjFWyCZY+uf1snNDvTbwsmCGY9 7+DkM2MNboOq5z89L4XZ2OCKedF13g4TKxdLZc5aIKMRzkspgBZCaclau3wfHt8wmNm3 SmHV+nxMIdSc+74RLsBYoWpVO7juLmQ9fMrkoVJIB4YqqbQG30cU6NORSSTSN+CF4Mll LwFQ== X-Gm-Message-State: AODbwcDVy1jpmDFxScapSSrSiny1ZeejrJO25twq4TuTxKGx/Bb6J6AD X6zt6PF6nk16+vpB 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 Cc: linux-wireless@vger.kernel.org, akolli@qti.qualcomm.com, Sven Eckelmann 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 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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;