linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 08/23] mac80211: he: set rx nss
Date: Fri, 31 Jan 2020 13:12:45 +0200	[thread overview]
Message-ID: <20200131111300.891737-9-luca@coelho.fi> (raw)
In-Reply-To: <20200131111300.891737-1-luca@coelho.fi>

From: Tova Mussai <tova.mussai@intel.com>

In case of HE, the rx nss is taken from the HE capabilities.
If the supported nss capabilities that are reported by AP for the 11ax
mode in the HE Capabilities element are different from the nss
capabilities that are reported by AP for the vht mode in the vht
Capabilities element, need to use the lowest supported nss.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/mac80211/vht.c | 35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index a7cd22594a14..632f07401850 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -481,12 +481,40 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta)
 
 void ieee80211_sta_set_rx_nss(struct sta_info *sta)
 {
-	u8 ht_rx_nss = 0, vht_rx_nss = 0;
+	u8 ht_rx_nss = 0, vht_rx_nss = 0, he_rx_nss = 0, rx_nss;
 
 	/* if we received a notification already don't overwrite it */
 	if (sta->sta.rx_nss)
 		return;
 
+	if (sta->sta.he_cap.has_he) {
+		int i;
+		u8 rx_mcs_80 = 0, rx_mcs_160 = 0;
+		const struct ieee80211_sta_he_cap *he_cap = &sta->sta.he_cap;
+		u16 mcs_160_map =
+			le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160);
+		u16 mcs_80_map = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80);
+
+		for (i = 7; i >= 0; i--) {
+			u8 mcs_160 = (mcs_160_map >> (2 * i)) & 3;
+
+			if (mcs_160 != IEEE80211_VHT_MCS_NOT_SUPPORTED) {
+				rx_mcs_160 = i + 1;
+				break;
+			}
+		}
+		for (i = 7; i >= 0; i--) {
+			u8 mcs_80 = (mcs_80_map >> (2 * i)) & 3;
+
+			if (mcs_80 != IEEE80211_VHT_MCS_NOT_SUPPORTED) {
+				rx_mcs_80 = i + 1;
+				break;
+			}
+		}
+
+		he_rx_nss = min(rx_mcs_80, rx_mcs_160);
+	}
+
 	if (sta->sta.ht_cap.ht_supported) {
 		if (sta->sta.ht_cap.mcs.rx_mask[0])
 			ht_rx_nss++;
@@ -516,8 +544,9 @@ void ieee80211_sta_set_rx_nss(struct sta_info *sta)
 		/* FIXME: consider rx_highest? */
 	}
 
-	ht_rx_nss = max(ht_rx_nss, vht_rx_nss);
-	sta->sta.rx_nss = max_t(u8, 1, ht_rx_nss);
+	rx_nss = max(vht_rx_nss, ht_rx_nss);
+	rx_nss = max(he_rx_nss, rx_nss);
+	sta->sta.rx_nss = max_t(u8, 1, rx_nss);
 }
 
 u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
-- 
2.24.1


  parent reply	other threads:[~2020-01-31 11:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 11:12 [PATCH 00/23] cfg80211/mac80211 patches from our internal tree 2020-01-31 Luca Coelho
2020-01-31 11:12 ` [PATCH 01/23] nl80211/cfg80211: add support for non EDCA based ranging measurement Luca Coelho
2020-01-31 11:12 ` [PATCH 02/23] mac80211: simplify and improve HT/VHT/HE disable code Luca Coelho
2020-01-31 11:12 ` [PATCH 03/23] mac80211: refactor extended element parsing Luca Coelho
2020-01-31 11:12 ` [PATCH 04/23] mac80211: set station bandwidth from HE capability Luca Coelho
2020-01-31 11:12 ` [PATCH 05/23] mac80211: remove some stray braces Luca Coelho
2020-01-31 11:12 ` [PATCH 06/23] cfg80211: add no HE indication to the channel flag Luca Coelho
2020-01-31 11:12 ` [PATCH 07/23] mac80211: check whether HE connection is allowed by the reg domain Luca Coelho
2020-01-31 11:12 ` Luca Coelho [this message]
2020-01-31 11:12 ` [PATCH 09/23] mac80211: allow changing TX-related netdev features Luca Coelho
2020-01-31 11:12 ` [PATCH 10/23] mac80211: make ieee80211_wep_init() return void Luca Coelho
2020-01-31 11:12 ` [PATCH 11/23] mac80211: update conditions for supported channels element Luca Coelho
2020-01-31 11:31   ` [PATCH v2] mac80211: remove supported channels element in 6 GHz if ECSA support Luca Coelho
2020-01-31 11:12 ` [PATCH 12/23] cfg80211: Limit the registration for authentication frames Luca Coelho
2020-01-31 11:45   ` [PATCH 12/23 v2] cfg80211/mac80211: Allow user space to register for station Rx authentication Luca Coelho
2020-01-31 11:12 ` [PATCH 13/23] mac80211: Accept broadcast probe responses on 6GHz band Luca Coelho
2020-01-31 11:12 ` [PATCH 14/23] mac80211: fix quiet mode activation in action frames Luca Coelho
2020-01-31 11:12 ` [PATCH 15/23] mac80211: update condition for HE disablement Luca Coelho
2020-01-31 11:12 ` [PATCH 16/23] mac80211: Handle SMPS mode changes only in AP mode Luca Coelho
2020-01-31 11:12 ` [PATCH 17/23] nl80211: he: pass to driver the HE operation IE Luca Coelho
2020-01-31 11:12 ` [PATCH 18/23] mac80211: he: set missing bss_conf fields in AP mode Luca Coelho
2020-01-31 11:12 ` [PATCH 19/23] mac80211: Remove support for changing AP SMPS mode Luca Coelho
2020-01-31 11:12 ` [PATCH 20/23] mac80211: parse also the RSNXE IE Luca Coelho
2020-01-31 11:12 ` [PATCH 21/23] mac80211: consider more elements in parsing CRC Luca Coelho
2020-01-31 11:12 ` [PATCH 22/23] nl80211: add PROTECTED_TWT nl80211 extended feature Luca Coelho
2020-01-31 11:13 ` [PATCH 23/23] mac80211: Properly set the SMPS mode for 6GHz station Luca Coelho
2020-02-14  9:06   ` Johannes Berg
2020-03-26  9:29     ` 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=20200131111300.891737-9-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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).