linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 17/20] iwlwifi: mvm: implement VHT extended NSS support in rs.c
Date: Fri, 15 Feb 2019 13:49:21 +0200	[thread overview]
Message-ID: <20190215114924.2545-18-luca@coelho.fi> (raw)
In-Reply-To: <20190215114924.2545-1-luca@coelho.fi>

From: Johannes Berg <johannes.berg@intel.com>

For non-offloaded rate control, implement VHT extended NSS
support by just ignoring 160 MHz on transmit if the peer
doesn't support the full NSS (2). This is pretty unlikely
and gets us 160 MHz RX as well as TX in most cases, since
the typical case for this workaround is 4x4 AP only doing
2x2 on 160 MHz.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 23 +++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 2d7a089d93a3..e231a44d2423 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -3,7 +3,7 @@
  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 Intel Corporation
+ * Copyright(c) 2018 - 2019 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -1643,8 +1643,26 @@ static s32 rs_get_best_rate(struct iwl_mvm *mvm,
 
 static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta)
 {
+	struct ieee80211_sta_vht_cap *sta_vht_cap = &sta->vht_cap;
+	struct ieee80211_vht_cap vht_cap = {
+		.vht_cap_info = cpu_to_le32(sta_vht_cap->cap),
+		.supp_mcs = sta_vht_cap->vht_mcs,
+	};
+
 	switch (sta->bandwidth) {
 	case IEEE80211_STA_RX_BW_160:
+		/*
+		 * Don't use 160 MHz if VHT extended NSS support
+		 * says we cannot use 2 streams, we don't want to
+		 * deal with this.
+		 * We only check MCS 0 - they will support that if
+		 * we got here at all and we don't care which MCS,
+		 * we want to determine a more global state.
+		 */
+		if (ieee80211_get_vht_max_nss(&vht_cap,
+					      IEEE80211_VHT_CHANWIDTH_160MHZ,
+					      0, true) < sta->rx_nss)
+			return RATE_MCS_CHAN_WIDTH_80;
 		return RATE_MCS_CHAN_WIDTH_160;
 	case IEEE80211_STA_RX_BW_80:
 		return RATE_MCS_CHAN_WIDTH_80;
@@ -1796,7 +1814,7 @@ static bool rs_tweak_rate_tbl(struct iwl_mvm *mvm,
 			      struct iwl_scale_tbl_info *tbl,
 			      enum rs_action scale_action)
 {
-	if (sta->bandwidth != IEEE80211_STA_RX_BW_80)
+	if (rs_bw_from_sta_bw(sta) != RATE_MCS_CHAN_WIDTH_80)
 		return false;
 
 	if (!is_vht_siso(&tbl->rate))
@@ -4127,6 +4145,7 @@ static const struct rate_control_ops rs_mvm_ops_drv = {
 	.add_sta_debugfs = rs_drv_add_sta_debugfs,
 	.remove_sta_debugfs = rs_remove_sta_debugfs,
 #endif
+	.capa = RATE_CTRL_CAPA_VHT_EXT_NSS_BW,
 };
 
 void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
-- 
2.20.1


  parent reply	other threads:[~2019-02-15 11:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 11:49 [PATCH 00/20] iwlwifi: updates intended for v5.1 2019-02-15 Luca Coelho
2019-02-15 11:49 ` [PATCH 01/20] iwlwifi: pcie: allocate rb_stts's for all queues in one place Luca Coelho
2019-02-15 11:49 ` [PATCH 02/20] iwlwifi: mvm: Don't request HW restart if already requested Luca Coelho
2019-02-15 11:49 ` [PATCH 03/20] iwlwifi: fix false-positive maybe-uninitialized warning Luca Coelho
2019-02-15 11:49 ` [PATCH 04/20] iwlwifi: eeprom-parse: use struct_size() in kzalloc() Luca Coelho
2019-02-15 11:49 ` [PATCH 05/20] iwlwifi: nvm-parse: " Luca Coelho
2019-02-15 11:49 ` [PATCH 06/20] iwlwifi: mvm: fix error path in iwl_mvm_mac_setup_register() Luca Coelho
2019-02-15 11:49 ` [PATCH 07/20] iwlwifi: nvm-parse: advertise IEEE80211_VHT_EXT_NSS_BW_CAPABLE in VHT Luca Coelho
2019-02-15 11:49 ` [PATCH 08/20] iwlwifi: dvm: no need to check return value of debugfs_create functions Luca Coelho
2019-02-15 11:49 ` [PATCH 09/20] iwlwifi: fw: " Luca Coelho
2019-02-15 11:49 ` [PATCH 10/20] iwlwifi: iwl-drv: " Luca Coelho
2019-02-15 11:49 ` [PATCH 11/20] iwlwifi: mvm: reject new beacons when in inject mode Luca Coelho
2019-02-20  8:54   ` [PATCH v2 " Luca Coelho
2019-02-15 11:49 ` [PATCH 12/20] iwlwifi: mvm: add read debugfs for he_sniffer_params Luca Coelho
2019-02-15 11:49 ` [PATCH 13/20] iwlwifi: mvm: support non-transmitting AP Luca Coelho
2019-02-15 11:49 ` [PATCH 14/20] iwlwifi: mvm: Set TX_CMD_FLG_PROT_REQUIRE correctly Luca Coelho
2019-02-15 11:49 ` [PATCH 15/20] iwlwifi: mvm: remove IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE Luca Coelho
2019-02-15 11:49 ` [PATCH 16/20] iwlwifi: mvm: Allow retries for probe responses Luca Coelho
2019-02-15 11:49 ` Luca Coelho [this message]
2019-02-15 11:49 ` [PATCH 18/20] iwlwifi: remove redundant condition from prior alive dump flow Luca Coelho
2019-02-15 11:49 ` [PATCH 19/20] iwlwifi: mvm: add some debug data to TX path Luca Coelho
2019-02-15 11:49 ` [PATCH 20/20] iwlwifi: dbg_ini: fix infinite time ignore consecutive dumps Luca Coelho
2019-02-20 12:35 ` [PATCH 00/20] iwlwifi: updates intended for v5.1 2019-02-15 Kalle Valo
2019-02-20 12:43   ` Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190215114924.2545-18-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).