All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.greenman@intel.com
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Gregory Greenman <gregory.greenman@intel.com>
Subject: [PATCH 13/15] wifi: mac80211: take MBSSID/EHT data also from probe resp
Date: Sun, 27 Aug 2023 14:05:30 +0300	[thread overview]
Message-ID: <20230827135854.3c7e52d49482.Iba6b672f6dc74b45bba26bc497e953e27da43ef9@changeid> (raw)
In-Reply-To: <20230827110532.348304-1-gregory.greenman@intel.com>

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

The code that sets up the assoc link will currently take the BSS
element data from the beacon only. This is correct for some of
the data, notably the timing and the "have_beacon", but all the
data about MBSSID and EHT really doesn't need to be taken from
there, and if the EHT puncturing is misconfigured on the AP but
we didn't receive a beacon yet, this causes us to connect but
immediately disconnect upon receiving the first beacon, rather
than connecting without EHT in the first place.

Change the code to take MBSSID and EHT data also from the probe
response, for a better picture of what the BSS capabilities are
and to avoid that EHT puncturing problem.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 net/mac80211/mlme.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a93fbed69a70..8abd4301f278 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -7262,7 +7262,7 @@ ieee80211_setup_assoc_link(struct ieee80211_sub_if_data *sdata,
 			   unsigned int link_id)
 {
 	struct ieee80211_local *local = sdata->local;
-	const struct cfg80211_bss_ies *beacon_ies;
+	const struct cfg80211_bss_ies *bss_ies;
 	struct ieee80211_supported_band *sband;
 	const struct element *ht_elem, *vht_elem;
 	struct ieee80211_link_data *link;
@@ -7337,32 +7337,37 @@ ieee80211_setup_assoc_link(struct ieee80211_sub_if_data *sdata,
 	link->conf->eht_puncturing = 0;
 
 	rcu_read_lock();
-	beacon_ies = rcu_dereference(cbss->beacon_ies);
-	if (beacon_ies) {
-		const struct ieee80211_eht_operation *eht_oper;
-		const struct element *elem;
+	bss_ies = rcu_dereference(cbss->beacon_ies);
+	if (bss_ies) {
 		u8 dtim_count = 0;
 
-		ieee80211_get_dtim(beacon_ies, &dtim_count,
+		ieee80211_get_dtim(bss_ies, &dtim_count,
 				   &link->u.mgd.dtim_period);
 
 		sdata->deflink.u.mgd.have_beacon = true;
 
 		if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) {
-			link->conf->sync_tsf = beacon_ies->tsf;
+			link->conf->sync_tsf = bss_ies->tsf;
 			link->conf->sync_device_ts = bss->device_ts_beacon;
 			link->conf->sync_dtim_count = dtim_count;
 		}
+	} else {
+		bss_ies = rcu_dereference(cbss->ies);
+	}
+
+	if (bss_ies) {
+		const struct ieee80211_eht_operation *eht_oper;
+		const struct element *elem;
 
 		elem = cfg80211_find_ext_elem(WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION,
-					      beacon_ies->data, beacon_ies->len);
+					      bss_ies->data, bss_ies->len);
 		if (elem && elem->datalen >= 3)
 			link->conf->profile_periodicity = elem->data[2];
 		else
 			link->conf->profile_periodicity = 0;
 
 		elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY,
-					  beacon_ies->data, beacon_ies->len);
+					  bss_ies->data, bss_ies->len);
 		if (elem && elem->datalen >= 11 &&
 		    (elem->data[10] & WLAN_EXT_CAPA11_EMA_SUPPORT))
 			link->conf->ema_ap = true;
@@ -7370,7 +7375,7 @@ ieee80211_setup_assoc_link(struct ieee80211_sub_if_data *sdata,
 			link->conf->ema_ap = false;
 
 		elem = cfg80211_find_ext_elem(WLAN_EID_EXT_EHT_OPERATION,
-					      beacon_ies->data, beacon_ies->len);
+					      bss_ies->data, bss_ies->len);
 		eht_oper = (const void *)(elem->data + 1);
 
 		if (elem &&
-- 
2.38.1


  parent reply	other threads:[~2023-08-27 11:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 11:05 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2023-08-27 gregory.greenman
2023-08-27 11:05 ` [PATCH 01/15] wifi: mac80211: add support for mld in ieee80211_chswitch_done gregory.greenman
2023-08-27 16:43   ` Jeff Johnson
2023-08-27 16:50     ` Grumbach, Emmanuel
2023-08-27 11:05 ` [PATCH 02/15] wifi: cfg80211: fix off-by-one in element defrag gregory.greenman
2023-08-27 11:05 ` [PATCH 03/15] wifi: cfg80211: add first kunit tests, for " gregory.greenman
2023-08-27 11:05 ` [PATCH 04/15] wifi: mac80211: add an element parsing unit test gregory.greenman
2023-09-04 15:23   ` Kalle Valo
2023-08-27 11:05 ` [PATCH 05/15] wifi: cfg80211: add ieee80211_fragment_element to public API gregory.greenman
2023-08-27 11:05 ` [PATCH 06/15] wifi: mac80211: add more warnings about inserting sta info gregory.greenman
2023-08-27 11:05 ` [PATCH 07/15] wifi: mac80211: remove unnecessary struct forward declaration gregory.greenman
2023-08-27 11:05 ` [PATCH 08/15] wifi: mac80211: fix various kernel-doc issues gregory.greenman
2023-08-27 11:05 ` [PATCH 09/15] wifi: cfg80211: reg: " gregory.greenman
2023-08-27 11:05 ` [PATCH 10/15] wifi: mac80211_hwsim: clean up kernel-doc gregory.greenman
2023-08-27 11:05 ` [PATCH 11/15] wifi: mac80211: fix # of MSDU in A-MSDU calculation gregory.greenman
2023-08-27 11:05 ` [PATCH 12/15] wifi: mac80211: Print local link address during authentication gregory.greenman
2023-08-28 10:37   ` Wen Gong
2023-08-27 11:05 ` gregory.greenman [this message]
2023-08-27 11:05 ` [PATCH 14/15] wifi: mac80211: Do not force off-channel for management Tx with MLO gregory.greenman
2023-08-27 11:05 ` [PATCH 15/15] wifi: mac80211: fix channel switch link data gregory.greenman

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=20230827135854.3c7e52d49482.Iba6b672f6dc74b45bba26bc497e953e27da43ef9@changeid \
    --to=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --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.