All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 16/23] mac80211: Handle SMPS mode changes only in AP mode
Date: Fri, 31 Jan 2020 13:12:53 +0200	[thread overview]
Message-ID: <20200131111300.891737-17-luca@coelho.fi> (raw)
In-Reply-To: <20200131111300.891737-1-luca@coelho.fi>

From: Ilan Peer <ilan.peer@intel.com>

According to IEEE802.11 specifications the SM power save field
in the HT capability IE and the HE extended capability IE is valid
only in (re)association frames and should be ignored otherwise.
Remove code paths that handled this also for non AP modes.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/mac80211/he.c |  2 +-
 net/mac80211/ht.c | 42 ++++++++++++++++++++++++------------------
 net/mac80211/rx.c |  6 +++++-
 3 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/net/mac80211/he.c b/net/mac80211/he.c
index 5245c19f39bf..1087f715338b 100644
--- a/net/mac80211/he.c
+++ b/net/mac80211/he.c
@@ -3,7 +3,7 @@
  * HE handling
  *
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright(c) 2019 Intel Corporation
+ * Copyright(c) 2019 - 2020 Intel Corporation
  */
 
 #include "ieee80211_i.h"
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index a2e4d6b8fd98..a8e144fd02f1 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -9,6 +9,7 @@
  * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  * Copyright 2007-2010, Intel Corporation
  * Copyright 2017	Intel Deutschland GmbH
+ * Copyright(c) 2020 Intel Corporation
  */
 
 #include <linux/ieee80211.h>
@@ -144,7 +145,6 @@ bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
 	int i, max_tx_streams;
 	bool changed;
 	enum ieee80211_sta_rx_bandwidth bw;
-	enum ieee80211_smps_mode smps_mode;
 
 	memset(&ht_cap, 0, sizeof(ht_cap));
 
@@ -270,24 +270,30 @@ bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
 		ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
 				IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;
 
-	switch ((ht_cap.cap & IEEE80211_HT_CAP_SM_PS)
-			>> IEEE80211_HT_CAP_SM_PS_SHIFT) {
-	case WLAN_HT_CAP_SM_PS_INVALID:
-	case WLAN_HT_CAP_SM_PS_STATIC:
-		smps_mode = IEEE80211_SMPS_STATIC;
-		break;
-	case WLAN_HT_CAP_SM_PS_DYNAMIC:
-		smps_mode = IEEE80211_SMPS_DYNAMIC;
-		break;
-	case WLAN_HT_CAP_SM_PS_DISABLED:
-		smps_mode = IEEE80211_SMPS_OFF;
-		break;
-	}
-
-	if (smps_mode != sta->sta.smps_mode)
-		changed = true;
-	sta->sta.smps_mode = smps_mode;
+	if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
+	    sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
+		enum ieee80211_smps_mode smps_mode;
+
+		switch ((ht_cap.cap & IEEE80211_HT_CAP_SM_PS)
+				>> IEEE80211_HT_CAP_SM_PS_SHIFT) {
+		case WLAN_HT_CAP_SM_PS_INVALID:
+		case WLAN_HT_CAP_SM_PS_STATIC:
+			smps_mode = IEEE80211_SMPS_STATIC;
+			break;
+		case WLAN_HT_CAP_SM_PS_DYNAMIC:
+			smps_mode = IEEE80211_SMPS_DYNAMIC;
+			break;
+		case WLAN_HT_CAP_SM_PS_DISABLED:
+			smps_mode = IEEE80211_SMPS_OFF;
+			break;
+		}
 
+		if (smps_mode != sta->sta.smps_mode)
+			changed = true;
+		sta->sta.smps_mode = smps_mode;
+	} else {
+		sta->sta.smps_mode = IEEE80211_SMPS_OFF;
+	}
 	return changed;
 }
 
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 619c223f1cde..ec3a04a1db20 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -6,7 +6,7 @@
  * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2019 Intel Corporation
+ * Copyright (C) 2018-2020 Intel Corporation
  */
 
 #include <linux/jiffies.h>
@@ -3082,6 +3082,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
 			enum ieee80211_smps_mode smps_mode;
 			struct sta_opmode_info sta_opmode = {};
 
+			if (sdata->vif.type != NL80211_IFTYPE_AP &&
+			    sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
+				goto handled;
+
 			/* convert to HT capability */
 			switch (mgmt->u.action.u.ht_smps.smps_control) {
 			case WLAN_HT_SMPS_CONTROL_DISABLED:
-- 
2.24.1


  parent reply	other threads:[~2020-01-31 11:20 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 ` [PATCH 08/23] mac80211: he: set rx nss Luca Coelho
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 ` Luca Coelho [this message]
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-17-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.