Linux wireless drivers development
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
	Liad Kaufman <liad.kaufman@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 07/16] iwlwifi: mvm: limit TLC according to our HE capabilities
Date: Tue, 23 Apr 2019 12:10:34 +0300	[thread overview]
Message-ID: <20190423091043.7156-8-luca@coelho.fi> (raw)
In-Reply-To: <20190423091043.7156-1-luca@coelho.fi>

From: Liad Kaufman <liad.kaufman@intel.com>

Instead of setting the TLC config command according to the
rates the peer supports, make sure that we aren't also
limited by our own rates, so take the minimum between the
peer's supported RX rates and our supported TX rates.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    | 34 ++++++++++++++++---
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index 3ffdbfdb37c0..659e21b2d4e7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -230,19 +230,43 @@ static u16 rs_fw_he_ieee80211_mcs_to_rs_mcs(u16 mcs)
 
 static void
 rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
-			   const struct ieee80211_sta_he_cap *he_cap,
+			   struct ieee80211_supported_band *sband,
 			   struct iwl_tlc_config_cmd *cmd)
 {
-	u16 mcs_160 = le16_to_cpu(sta->he_cap.he_mcs_nss_supp.rx_mcs_160);
-	u16 mcs_80 = le16_to_cpu(sta->he_cap.he_mcs_nss_supp.rx_mcs_80);
+	const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
+	u16 mcs_160 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160);
+	u16 mcs_80 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80);
+	u16 tx_mcs_80 =
+		le16_to_cpu(sband->iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80);
+	u16 tx_mcs_160 =
+		le16_to_cpu(sband->iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160);
 	int i;
 
 	for (i = 0; i < sta->rx_nss && i < MAX_NSS; i++) {
 		u16 _mcs_160 = (mcs_160 >> (2 * i)) & 0x3;
 		u16 _mcs_80 = (mcs_80 >> (2 * i)) & 0x3;
-
+		u16 _tx_mcs_160 = (tx_mcs_160 >> (2 * i)) & 0x3;
+		u16 _tx_mcs_80 = (tx_mcs_80 >> (2 * i)) & 0x3;
+
+		/* If one side doesn't support - mark both as not supporting */
+		if (_mcs_80 == IEEE80211_HE_MCS_NOT_SUPPORTED ||
+		    _tx_mcs_80 == IEEE80211_HE_MCS_NOT_SUPPORTED) {
+			_mcs_80 = IEEE80211_HE_MCS_NOT_SUPPORTED;
+			_tx_mcs_80 = IEEE80211_HE_MCS_NOT_SUPPORTED;
+		}
+		if (_mcs_80 > _tx_mcs_80)
+			_mcs_80 = _tx_mcs_80;
 		cmd->ht_rates[i][0] =
 			cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_80));
+
+		/* If one side doesn't support - mark both as not supporting */
+		if (_mcs_160 == IEEE80211_HE_MCS_NOT_SUPPORTED ||
+		    _tx_mcs_160 == IEEE80211_HE_MCS_NOT_SUPPORTED) {
+			_mcs_160 = IEEE80211_HE_MCS_NOT_SUPPORTED;
+			_tx_mcs_160 = IEEE80211_HE_MCS_NOT_SUPPORTED;
+		}
+		if (_mcs_160 > _tx_mcs_160)
+			_mcs_160 = _tx_mcs_160;
 		cmd->ht_rates[i][1] =
 			cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_160));
 	}
@@ -271,7 +295,7 @@ static void rs_fw_set_supp_rates(struct ieee80211_sta *sta,
 	/* HT/VHT rates */
 	if (he_cap && he_cap->has_he) {
 		cmd->mode = IWL_TLC_MNG_MODE_HE;
-		rs_fw_he_set_enabled_rates(sta, he_cap, cmd);
+		rs_fw_he_set_enabled_rates(sta, sband, cmd);
 	} else if (vht_cap && vht_cap->vht_supported) {
 		cmd->mode = IWL_TLC_MNG_MODE_VHT;
 		rs_fw_vht_set_enabled_rates(sta, vht_cap, cmd);
-- 
2.20.1


  parent reply	other threads:[~2019-04-23  9:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23  9:10 [PATCH 00/16] iwlwifi: updates intended for v5.2 2019-04-23 (new try) Luca Coelho
2019-04-23  9:10 ` [PATCH 01/16] iwlwifi: Use correct channel_profile iniwl_get_nvm Luca Coelho
2019-04-23  9:10 ` [PATCH 02/16] iwlwifi: pcie: initialize debug_rfkill to -1 Luca Coelho
2019-04-23  9:10 ` [PATCH 03/16] iwlwifi: pcie: don't crash on invalid RX interrupt Luca Coelho
2019-04-23  9:10 ` [PATCH 04/16] iwlwifi: mvm: support v2 of the WoWLAN patterns command Luca Coelho
2019-04-23  9:10 ` [PATCH 05/16] iwlwifi: mvm: report FTM start time TSF when applicable Luca Coelho
2019-04-23  9:10 ` [PATCH 06/16] iwlwifi: support fseq tlv and print fseq version Luca Coelho
2019-04-23  9:10 ` Luca Coelho [this message]
2019-04-23  9:10 ` [PATCH 08/16] iwlwifi: bump FW API to 48 for 22000 series Luca Coelho
2019-04-23  9:10 ` [PATCH 09/16] iwlwifi: mvm: Don't sleep in RX path Luca Coelho
2019-04-23  9:10 ` [PATCH 10/16] iwlwifi: pcie: remove stray character in iwl_pcie_rx_alloc_page() Luca Coelho
2019-04-23  9:10 ` [PATCH 11/16] iwlwifi: parse command version TLV Luca Coelho
2019-04-23  9:10 ` [PATCH 12/16] iwlwifi: dbg_ini: add lmac and umac error tables dumping support Luca Coelho
2019-04-23  9:10 ` [PATCH 13/16] iwlwifi: dbg_ini: add periodic trigger support Luca Coelho
2019-04-23  9:10 ` [PATCH 14/16] iwlwifi: dbg: replace dump info device family with HW type Luca Coelho
2019-04-23  9:10 ` [PATCH 15/16] iwlwifi: avoid allocating memory for region with disabled domain Luca Coelho
2019-04-23  9:10 ` [PATCH 16/16] iwlwifi: dbg_ini: check for valid region type during regions parsing 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=20190423091043.7156-8-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=liad.kaufman@intel.com \
    --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