Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp67938imu; Thu, 6 Dec 2018 16:14:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/XMtpgXNpY8MbFd80J5JKEK/fIJkOWB30pkzEWcP//od9QDSCK3Fj0lK9Peaf8MGjk8FEhD X-Received: by 2002:a63:31d0:: with SMTP id x199mr63186pgx.10.1544141664845; Thu, 06 Dec 2018 16:14:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544141664; cv=none; d=google.com; s=arc-20160816; b=ObRx6qBCI0IeFCK8+FJBLz6y3EyXQ/Qu5NXXy+uIuoKu8ptS+m9q3sNwFLiVQhU0CB yIRZL5sZDSw3P70qrCoWcLg2mL0RioWqp2c9wIZ3Li8z9u6b+tGKQAR9MXiAXC4xFwKd QdNtbCJi4dKO/RT2qSEZKvoqm+ZXGmKa2WpchkOp+8uvO+fLkX5ed/KmH4HA445/cGgf BWg6ipdQmpzkJEkQY5mmis4ZNitIUAq+HozOVgAwVFvRSeugIpXDqNPI6/xQPk7tXWHr 98IEEQrfadI3GpmI1YR+iUif+1FsooONTf/Zqir5qw+Nx/jB7FGFqiYyvITvVK64To+x cjUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KnxtaTSUT4ZjS4fAMsNPM8zLcRZ7oBhSPNZwlUEuE60=; b=h2BKhaQlIwH/bFAQKGESNAibK33ZpA1/uV+tTg6X4M9dqoJezaum9JqjBMQ3/ZhHeK R8lBtZZOPDR3I9UTvaandVwapVFW0jIYM4+lcmgqWBk4U/jt1GDX1gUIy7irSX0NTlgf 4GWw92l34LXzZ3oL/jkDxBW/AMiQSv+xwht2kqgZhJ39z11QHUyzBNOvKSKhSGrUdItx GM2eXwHwlYeTeNH8DjYK7tUhYw0Qwvu24DCf83Ld2TzkTLpdd4x4RG63lQIt8Ma421R3 9EMMyV4Ur4pk+qZgtLEBrbMFhPDmtxc0x9dLAh7+r4/m3ikrDG3GN3xmSJIRkpr5hEVt M1/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Fsuanyn7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p66si1514500pfp.144.2018.12.06.16.14.07; Thu, 06 Dec 2018 16:14:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Fsuanyn7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725989AbeLGAN2 (ORCPT + 99 others); Thu, 6 Dec 2018 19:13:28 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40049 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbeLGAN1 (ORCPT ); Thu, 6 Dec 2018 19:13:27 -0500 Received: by mail-pg1-f196.google.com with SMTP id z10so873794pgp.7 for ; Thu, 06 Dec 2018 16:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KnxtaTSUT4ZjS4fAMsNPM8zLcRZ7oBhSPNZwlUEuE60=; b=Fsuanyn7StOHvNQ7bqa87XghNNfi7t8tRG6DPQ29wYdcadcjjhK1WvOw5TwZMm9kT8 UusRXE/8NPcsdRAOJshMLKoSLK9+1f1x4FBuxlvZ7j1tisljcSuWkLq5bCUPBWvbDBjL EWgLp5s6t+38kbidPAGui5DECeNodxSAOpE6Q= 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:mime-version :content-transfer-encoding; bh=KnxtaTSUT4ZjS4fAMsNPM8zLcRZ7oBhSPNZwlUEuE60=; b=AL2VNjREdB+WztYm/0fL536BycyY00Hs/xwvF1waD70I7wCIQAL5UQe70iS5kDf/qh sN+7eyOAz6cdjE/ZZ2OulgK+KconydxgwvF9LPLPyWA6xw3+eFCNtl+FvakeOvNx75fX ebqZBMQAsCCVRkjo2j0Ogv2N40TE71GYh5hqR0dwVMAX28aPp8YNtYCalFxHZGAoQU5N YLV8o0fT1QvmkQS14fBnZ+2E5JZwJThL0Y7BbFJF/3d++pZ0OyGUcXIhUrRlEWH8q23t 75VwlFJszxaDa8HtpLFJMQtv9UJEVPgy9vHLliwEpFGNT6zd4Rx4ZbWXnyMTUfgnQJ8E 8bXw== X-Gm-Message-State: AA+aEWZkIXss/d1MMvqC5mby/M/fAzIK54IspwBybb5wAHOn6BFDbWXI PSDwCHZC+QyvYjqqZatQuwJunQ== X-Received: by 2002:a63:1258:: with SMTP id 24mr56312pgs.114.1544141606581; Thu, 06 Dec 2018 16:13:26 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:1:534:b7c0:a63c:460c]) by smtp.gmail.com with ESMTPSA id o66sm1654437pgo.75.2018.12.06.16.13.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 16:13:17 -0800 (PST) From: Brian Norris To: Kalle Valo Cc: , Amitkumar Karwar , Nishant Sarmukadam , Ganapathi Bhat , Xinming Hu , linux-wireless@vger.kernel.org, Brian Norris Subject: [RFC PATCH v2 1/2] mwifiex: refactor mwifiex_parse_htinfo() for reuse Date: Thu, 6 Dec 2018 16:12:48 -0800 Message-Id: <20181207001249.165477-1-briannorris@chromium.org> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This function converts some firmware-specific parameters into cfg80211 'rate_info' structures. It currently assumes it's dealing only with TX bitrate, but the RX bitrate looks to be the same, so refactor this function to be reusable. Signed-off-by: Brian Norris --- v2: * no change - just split unrelated (debugfs) patch to its own series --- .../net/wireless/marvell/mwifiex/cfg80211.c | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index adc88433faa8..02b80ea232a7 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -1275,27 +1275,27 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, } static void -mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 tx_htinfo, +mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 rateinfo, u8 htinfo, struct rate_info *rate) { struct mwifiex_adapter *adapter = priv->adapter; if (adapter->is_hw_11ac_capable) { /* bit[1-0]: 00=LG 01=HT 10=VHT */ - if (tx_htinfo & BIT(0)) { + if (htinfo & BIT(0)) { /* HT */ - rate->mcs = priv->tx_rate; + rate->mcs = rateinfo; rate->flags |= RATE_INFO_FLAGS_MCS; } - if (tx_htinfo & BIT(1)) { + if (htinfo & BIT(1)) { /* VHT */ - rate->mcs = priv->tx_rate & 0x0F; + rate->mcs = rateinfo & 0x0F; rate->flags |= RATE_INFO_FLAGS_VHT_MCS; } - if (tx_htinfo & (BIT(1) | BIT(0))) { + if (htinfo & (BIT(1) | BIT(0))) { /* HT or VHT */ - switch (tx_htinfo & (BIT(3) | BIT(2))) { + switch (htinfo & (BIT(3) | BIT(2))) { case 0: rate->bw = RATE_INFO_BW_20; break; @@ -1310,26 +1310,26 @@ mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 tx_htinfo, break; } - if (tx_htinfo & BIT(4)) + if (htinfo & BIT(4)) rate->flags |= RATE_INFO_FLAGS_SHORT_GI; - if ((priv->tx_rate >> 4) == 1) + if ((rateinfo >> 4) == 1) rate->nss = 2; else rate->nss = 1; } } else { /* - * Bit 0 in tx_htinfo indicates that current Tx rate - * is 11n rate. Valid MCS index values for us are 0 to 15. + * Bit 0 in htinfo indicates that current rate is 11n. Valid + * MCS index values for us are 0 to 15. */ - if ((tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) { - rate->mcs = priv->tx_rate; + if ((htinfo & BIT(0)) && (rateinfo < 16)) { + rate->mcs = rateinfo; rate->flags |= RATE_INFO_FLAGS_MCS; rate->bw = RATE_INFO_BW_20; - if (tx_htinfo & BIT(1)) + if (htinfo & BIT(1)) rate->bw = RATE_INFO_BW_40; - if (tx_htinfo & BIT(2)) + if (htinfo & BIT(2)) rate->flags |= RATE_INFO_FLAGS_SHORT_GI; } } @@ -1375,7 +1375,8 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, sinfo->tx_packets = node->stats.tx_packets; sinfo->tx_failed = node->stats.tx_failed; - mwifiex_parse_htinfo(priv, node->stats.last_tx_htinfo, + mwifiex_parse_htinfo(priv, priv->tx_rate, + node->stats.last_tx_htinfo, &sinfo->txrate); sinfo->txrate.legacy = node->stats.last_tx_rate * 5; @@ -1401,7 +1402,8 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, HostCmd_ACT_GEN_GET, DTIM_PERIOD_I, &priv->dtim_period, true); - mwifiex_parse_htinfo(priv, priv->tx_htinfo, &sinfo->txrate); + mwifiex_parse_htinfo(priv, priv->tx_rate, priv->tx_htinfo, + &sinfo->txrate); sinfo->signal_avg = priv->bcn_rssi_avg; sinfo->rx_bytes = priv->stats.rx_bytes; -- 2.20.0.rc2.403.gdbc3b29805-goog