All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: johannes@sipsolutions.net
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 25/31] mac80211: remove use of ieee80211_get_he_sta_cap()
Date: Fri, 18 Jun 2021 13:41:50 +0300	[thread overview]
Message-ID: <iwlwifi.20210618133832.ede114bc8b46.Ibcd9a5d98430e936344eb6d242ef8a65c2f59b74@changeid> (raw)
In-Reply-To: <20210618104156.747775-1-luca@coelho.fi>

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

All uses of ieee80211_get_he_sta_cap() were actually wrong,
in net/mac80211/mlme.c they were wrong because that code is
also used for P2P (which is a different interface type), in
net/mac80211/main.c that should check all interface types.
Fix all that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/mac80211/main.c |  9 +++++++--
 net/mac80211/mlme.c | 23 +++++++++++++++--------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index da3e0ca6aa31..2e3f8a479f83 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1008,8 +1008,13 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 		supp_ht = supp_ht || sband->ht_cap.ht_supported;
 		supp_vht = supp_vht || sband->vht_cap.vht_supported;
 
-		if (!supp_he)
-			supp_he = !!ieee80211_get_he_sta_cap(sband);
+		for (i = 0; i < sband->n_iftype_data; i++) {
+			const struct ieee80211_sband_iftype_data *iftd;
+
+			iftd = &sband->iftype_data[i];
+
+			supp_he = supp_he || (iftd && iftd->he_cap.has_he);
+		}
 
 		/* HT, VHT, HE require QoS, thus >= 4 queues */
 		if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a0d77539d1d9..a5d0f62de5c3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -384,7 +384,9 @@ static int ieee80211_config_bw(struct ieee80211_sub_if_data *sdata,
 
 	/* don't check HE if we associated as non-HE station */
 	if (ifmgd->flags & IEEE80211_STA_DISABLE_HE ||
-	    !ieee80211_get_he_sta_cap(sband))
+	    !ieee80211_get_he_iftype_cap(sband,
+					 ieee80211_vif_type_p2p(&sdata->vif)))
+
 		he_oper = NULL;
 
 	if (WARN_ON_ONCE(!sta))
@@ -642,7 +644,8 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata,
 
 	rcu_read_unlock();
 
-	he_cap = ieee80211_get_he_sta_cap(sband);
+	he_cap = ieee80211_get_he_iftype_cap(sband,
+					     ieee80211_vif_type_p2p(&sdata->vif));
 	if (!he_cap || !reg_cap)
 		return;
 
@@ -3227,12 +3230,14 @@ static int ieee80211_recalc_twt_req(struct ieee80211_sub_if_data *sdata,
 	return 0;
 }
 
-static bool ieee80211_twt_bcast_support(struct ieee80211_bss_conf *bss_conf,
+static bool ieee80211_twt_bcast_support(struct ieee80211_sub_if_data *sdata,
+					struct ieee80211_bss_conf *bss_conf,
 					struct ieee80211_supported_band *sband,
 					struct sta_info *sta)
 {
 	const struct ieee80211_sta_he_cap *own_he_cap =
-		ieee80211_get_he_sta_cap(sband);
+		ieee80211_get_he_iftype_cap(sband,
+					    ieee80211_vif_type_p2p(&sdata->vif));
 
 	return bss_conf->he_support &&
 		(sta->sta.he_cap.he_cap_elem.mac_cap_info[2] &
@@ -3458,7 +3463,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 	}
 
 	bss_conf->twt_broadcast =
-		ieee80211_twt_bcast_support(bss_conf, sband, sta);
+		ieee80211_twt_bcast_support(sdata, bss_conf, sband, sta);
 
 	if (bss_conf->he_support) {
 		bss_conf->he_bss_color.color =
@@ -4860,11 +4865,13 @@ static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata,
 }
 
 static bool
-ieee80211_verify_sta_he_mcs_support(struct ieee80211_supported_band *sband,
+ieee80211_verify_sta_he_mcs_support(struct ieee80211_sub_if_data *sdata,
+				    struct ieee80211_supported_band *sband,
 				    const struct ieee80211_he_operation *he_op)
 {
 	const struct ieee80211_sta_he_cap *sta_he_cap =
-		ieee80211_get_he_sta_cap(sband);
+		ieee80211_get_he_iftype_cap(sband,
+					    ieee80211_vif_type_p2p(&sdata->vif));
 	u16 ap_min_req_set;
 	int i;
 
@@ -5017,7 +5024,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
 		else
 			he_oper = NULL;
 
-		if (!ieee80211_verify_sta_he_mcs_support(sband, he_oper))
+		if (!ieee80211_verify_sta_he_mcs_support(sdata, sband, he_oper))
 			ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
 	}
 
-- 
2.32.0


  parent reply	other threads:[~2021-06-18 11:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 10:41 [PATCH 00/31] cfg80211/mac80211 patches from our internal tree 2021-06-18 Luca Coelho
2021-06-18 10:41 ` [PATCH 01/31] mac80211: add HE 6GHz cap IE in 6GHz band only Luca Coelho
2021-06-18 10:41 ` [PATCH 02/31] mac80211: do not add twice the HE 6GHz cap IE Luca Coelho
2021-06-18 17:14   ` Florian Fainelli
2021-06-18 20:17     ` Luca Coelho
2021-06-23 11:04       ` Luca Coelho
2021-06-18 10:41 ` [PATCH 03/31] ieee80211: define timing measurement in extended capabilities IE Luca Coelho
2021-06-18 10:41 ` [PATCH 04/31] cfg80211: make certificate generation more robust Luca Coelho
2021-06-18 10:41 ` [PATCH 05/31] mac80211: handle rate control (RC) racing with chanctx definition Luca Coelho
2021-06-18 10:41 ` [PATCH 06/31] cfg80211: avoid double free of PMSR request Luca Coelho
2021-06-18 10:41 ` [PATCH 07/31] mac80211: allow SMPS requests only in client mode Luca Coelho
2021-06-18 10:41 ` [PATCH 08/31] mac80211: free skb in WEP error case Luca Coelho
2021-06-18 10:41 ` [PATCH 09/31] mac80211: move SMPS mode setting after ieee80211_prep_connection Luca Coelho
2021-06-18 10:41 ` [PATCH 10/31] mac80211: add to bss_conf if broadcast TWT is supported Luca Coelho
2021-06-18 10:41 ` [PATCH 11/31] nl80211/cfg80211: add BSS color to NDP ranging parameters Luca Coelho
2021-06-18 10:41 ` [PATCH 12/31] mac80211: Properly WARN on HW scan before restart Luca Coelho
2021-06-18 10:41 ` [PATCH 13/31] ieee80211: add defines for HE PHY cap byte 10 Luca Coelho
2021-06-18 10:41 ` [PATCH 14/31] cfg80211: add cfg80211_any_usable_channels() Luca Coelho
2021-06-18 10:41 ` [PATCH 15/31] mac80211: conditionally advertise HE in probe requests Luca Coelho
2021-06-18 10:41 ` [PATCH 16/31] cfg80211: Support hidden AP discovery over 6GHz band Luca Coelho
2021-06-18 10:41 ` [PATCH 17/31] mac80211: always include HE 6GHz capability in probe request Luca Coelho
2021-06-18 10:41 ` [PATCH 18/31] mac80211: always include HE 6GHz capability in assoc request Luca Coelho
2021-06-18 10:41 ` [PATCH 19/31] mac80211: rearrange struct txq_info for fewer holes Luca Coelho
2021-06-18 10:41 ` [PATCH 20/31] mac80211: handle various extensible elements correctly Luca Coelho
2021-06-18 10:41 ` [PATCH 21/31] cfg80211: set custom regdomain after wiphy registration Luca Coelho
2021-06-18 10:41 ` [PATCH 22/31] mac80211: improve AP disconnect message Luca Coelho
2021-06-18 10:41 ` [PATCH 23/31] cfg80211: trace more information in assoc trace event Luca Coelho
2021-06-18 10:41 ` [PATCH 24/31] mac80211: reset profile_periodicity/ema_ap Luca Coelho
2021-06-18 10:41 ` Luca Coelho [this message]
2021-06-18 10:41 ` [PATCH 26/31] cfg80211: remove ieee80211_get_he_sta_cap() Luca Coelho
2021-06-18 10:41 ` [PATCH 27/31] cfg80211: allow advertising vendor-specific capabilities Luca Coelho
2021-06-18 10:41 ` [PATCH 28/31] mac80211: add vendor-specific capabilities to assoc request Luca Coelho
2021-06-18 10:41 ` [PATCH 29/31] mac8021: Allow probe request injection on passive non radar channels Luca Coelho
2021-06-18 10:41 ` [PATCH 30/31] mac80211: notify driver on mgd TX completion Luca Coelho
2021-06-18 10:41 ` [PATCH 31/31] cfg80211: reg: improve bad regulatory warning 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=iwlwifi.20210618133832.ede114bc8b46.Ibcd9a5d98430e936344eb6d242ef8a65c2f59b74@changeid \
    --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.