All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aloka Dixit <quic_alokad@quicinc.com>
To: <johannes@sipsolutions.net>, <linux-wireless@vger.kernel.org>,
	<ath11k@lists.infradead.org>
Cc: Aloka Dixit <quic_alokad@quicinc.com>
Subject: [PATCH 9/9] ath11k: configure WPA and RSN parameters for nontransmitting interface
Date: Sun, 22 May 2022 23:01:08 -0700	[thread overview]
Message-ID: <20220523060108.23982-10-quic_alokad@quicinc.com> (raw)
In-Reply-To: <20220523060108.23982-1-quic_alokad@quicinc.com>

Set rsnie_present and wpaie_present fields for the non-transmitting
interfaces when MBSSID is enabled.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 99 ++++++++++++++++++++++++++-
 1 file changed, 98 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 4ead94554724..cee505a1bada 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1373,6 +1373,89 @@ static void ath11k_mac_setup_bcn_tmpl_vif_params(struct ath11k_vif *arvif,
 		arvif->wpaie_present = false;
 }
 
+static void ath11k_mac_setup_bcn_tmpl_nontx_vif_rsnie(struct ath11k_vif *arvif,
+						      bool tx_arvif_rsnie_present,
+						      const u8 *profile,
+						      u8 profile_len)
+{
+	if (cfg80211_find_ie(WLAN_EID_RSN, profile, profile_len)) {
+		arvif->rsnie_present = true;
+	} else if (tx_arvif_rsnie_present) {
+		int i;
+		u8 nie_len;
+		const u8 *nie = cfg80211_find_ext_ie(WLAN_EID_EXT_NON_INHERITANCE,
+						     profile, profile_len);
+		if (!nie)
+			return;
+
+		nie_len = nie[1];
+		nie += 2;
+		for (i = 0; i < nie_len; i++) {
+			if (nie[i] == WLAN_EID_RSN) {
+				arvif->rsnie_present = false;
+				break;
+			}
+		}
+	}
+}
+
+static bool ath11k_mac_setup_bcn_tmpl_nontx_vif_params(struct ath11k_vif *tx_arvif,
+						       struct ath11k_vif *arvif,
+						       struct sk_buff *bcn)
+{
+	struct ieee80211_mgmt *mgmt;
+	const u8 *ies, *profile, *next_profile;
+	int ies_len;
+
+	if (arvif == tx_arvif)
+		return true;
+
+	arvif->rsnie_present = tx_arvif->rsnie_present;
+
+	ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn);
+	mgmt = (struct ieee80211_mgmt *)bcn->data;
+	ies += sizeof(mgmt->u.beacon);
+	ies_len = skb_tail_pointer(bcn) - ies;
+
+	ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ies, ies_len);
+
+	while (ies) {
+		u8 mbssid_len;
+
+		ies_len -= (2 + ies[1]);
+		mbssid_len = ies[1] - 1;
+		profile = &ies[3];
+
+		while (mbssid_len) {
+			u8 profile_len;
+
+			profile_len = profile[1];
+			next_profile = profile + (2 + profile_len);
+			mbssid_len -= (2 + profile_len);
+
+			profile += 2;
+			profile_len -= (2 + profile[1]);
+			profile += (2 + profile[1]); /* nontx capabilities */
+			profile_len -= (2 + profile[1]);
+			profile += (2 + profile[1]); /* SSID */
+			if (profile[2] == arvif->vif->bss_conf.bssid_index) {
+				profile_len -= 5;
+				profile = profile + 5;
+				ath11k_mac_setup_bcn_tmpl_nontx_vif_rsnie(arvif,
+									  tx_arvif->rsnie_present,
+									  profile,
+									  profile_len);
+				return true;
+			}
+			profile = next_profile;
+		}
+		ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, profile,
+				       ies_len);
+	}
+
+	return false;
+}
+
 static int __ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif,
 				       struct sk_buff *bcn,
 				       struct ieee80211_mutable_offsets offs,
@@ -1399,6 +1482,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
 	struct ieee80211_ema_beacons *beacons;
 	u8 i = 0;
 	int ret = 0;
+	bool found_vdev = false;
 
 	if (!arvif->vif->mbssid_tx_vif)
 		return -1;
@@ -1412,11 +1496,21 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
 		return -EPERM;
 	}
 
-	if (tx_arvif == arvif)
+	if (tx_arvif == arvif) {
 		ath11k_mac_setup_bcn_tmpl_vif_params(tx_arvif,
 						     beacons->bcn[0].skb);
+		found_vdev = true;
+	} else {
+		arvif->wpaie_present = tx_arvif->wpaie_present;
+	}
 
 	for (i = 0; i < beacons->cnt; i++) {
+		if (!found_vdev)
+			found_vdev =
+				ath11k_mac_setup_bcn_tmpl_nontx_vif_params(tx_arvif,
+									   arvif,
+									   beacons->bcn[i].skb);
+
 		ret = __ath11k_mac_setup_bcn_tmpl(tx_arvif, beacons->bcn[i].skb,
 						  beacons->bcn[i].offs,
 						  i, beacons->cnt);
@@ -1452,6 +1546,9 @@ static int ath11k_mac_setup_bcn_tmpl_non_ema(struct ath11k_vif *arvif)
 
 	if (tx_arvif == arvif)
 		ath11k_mac_setup_bcn_tmpl_vif_params(tx_arvif, bcn);
+	else
+		(void)ath11k_mac_setup_bcn_tmpl_nontx_vif_params(tx_arvif,
+								 arvif, bcn);
 
 	ret = __ath11k_mac_setup_bcn_tmpl(tx_arvif, bcn, offs, 0, 0);
 	if (ret)
-- 
2.31.1


WARNING: multiple messages have this Message-ID (diff)
From: Aloka Dixit <quic_alokad@quicinc.com>
To: <johannes@sipsolutions.net>, <linux-wireless@vger.kernel.org>,
	<ath11k@lists.infradead.org>
Cc: Aloka Dixit <quic_alokad@quicinc.com>
Subject: [PATCH 9/9] ath11k: configure WPA and RSN parameters for nontransmitting interface
Date: Sun, 22 May 2022 23:01:08 -0700	[thread overview]
Message-ID: <20220523060108.23982-10-quic_alokad@quicinc.com> (raw)
In-Reply-To: <20220523060108.23982-1-quic_alokad@quicinc.com>

Set rsnie_present and wpaie_present fields for the non-transmitting
interfaces when MBSSID is enabled.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 99 ++++++++++++++++++++++++++-
 1 file changed, 98 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 4ead94554724..cee505a1bada 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1373,6 +1373,89 @@ static void ath11k_mac_setup_bcn_tmpl_vif_params(struct ath11k_vif *arvif,
 		arvif->wpaie_present = false;
 }
 
+static void ath11k_mac_setup_bcn_tmpl_nontx_vif_rsnie(struct ath11k_vif *arvif,
+						      bool tx_arvif_rsnie_present,
+						      const u8 *profile,
+						      u8 profile_len)
+{
+	if (cfg80211_find_ie(WLAN_EID_RSN, profile, profile_len)) {
+		arvif->rsnie_present = true;
+	} else if (tx_arvif_rsnie_present) {
+		int i;
+		u8 nie_len;
+		const u8 *nie = cfg80211_find_ext_ie(WLAN_EID_EXT_NON_INHERITANCE,
+						     profile, profile_len);
+		if (!nie)
+			return;
+
+		nie_len = nie[1];
+		nie += 2;
+		for (i = 0; i < nie_len; i++) {
+			if (nie[i] == WLAN_EID_RSN) {
+				arvif->rsnie_present = false;
+				break;
+			}
+		}
+	}
+}
+
+static bool ath11k_mac_setup_bcn_tmpl_nontx_vif_params(struct ath11k_vif *tx_arvif,
+						       struct ath11k_vif *arvif,
+						       struct sk_buff *bcn)
+{
+	struct ieee80211_mgmt *mgmt;
+	const u8 *ies, *profile, *next_profile;
+	int ies_len;
+
+	if (arvif == tx_arvif)
+		return true;
+
+	arvif->rsnie_present = tx_arvif->rsnie_present;
+
+	ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn);
+	mgmt = (struct ieee80211_mgmt *)bcn->data;
+	ies += sizeof(mgmt->u.beacon);
+	ies_len = skb_tail_pointer(bcn) - ies;
+
+	ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ies, ies_len);
+
+	while (ies) {
+		u8 mbssid_len;
+
+		ies_len -= (2 + ies[1]);
+		mbssid_len = ies[1] - 1;
+		profile = &ies[3];
+
+		while (mbssid_len) {
+			u8 profile_len;
+
+			profile_len = profile[1];
+			next_profile = profile + (2 + profile_len);
+			mbssid_len -= (2 + profile_len);
+
+			profile += 2;
+			profile_len -= (2 + profile[1]);
+			profile += (2 + profile[1]); /* nontx capabilities */
+			profile_len -= (2 + profile[1]);
+			profile += (2 + profile[1]); /* SSID */
+			if (profile[2] == arvif->vif->bss_conf.bssid_index) {
+				profile_len -= 5;
+				profile = profile + 5;
+				ath11k_mac_setup_bcn_tmpl_nontx_vif_rsnie(arvif,
+									  tx_arvif->rsnie_present,
+									  profile,
+									  profile_len);
+				return true;
+			}
+			profile = next_profile;
+		}
+		ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, profile,
+				       ies_len);
+	}
+
+	return false;
+}
+
 static int __ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif,
 				       struct sk_buff *bcn,
 				       struct ieee80211_mutable_offsets offs,
@@ -1399,6 +1482,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
 	struct ieee80211_ema_beacons *beacons;
 	u8 i = 0;
 	int ret = 0;
+	bool found_vdev = false;
 
 	if (!arvif->vif->mbssid_tx_vif)
 		return -1;
@@ -1412,11 +1496,21 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
 		return -EPERM;
 	}
 
-	if (tx_arvif == arvif)
+	if (tx_arvif == arvif) {
 		ath11k_mac_setup_bcn_tmpl_vif_params(tx_arvif,
 						     beacons->bcn[0].skb);
+		found_vdev = true;
+	} else {
+		arvif->wpaie_present = tx_arvif->wpaie_present;
+	}
 
 	for (i = 0; i < beacons->cnt; i++) {
+		if (!found_vdev)
+			found_vdev =
+				ath11k_mac_setup_bcn_tmpl_nontx_vif_params(tx_arvif,
+									   arvif,
+									   beacons->bcn[i].skb);
+
 		ret = __ath11k_mac_setup_bcn_tmpl(tx_arvif, beacons->bcn[i].skb,
 						  beacons->bcn[i].offs,
 						  i, beacons->cnt);
@@ -1452,6 +1546,9 @@ static int ath11k_mac_setup_bcn_tmpl_non_ema(struct ath11k_vif *arvif)
 
 	if (tx_arvif == arvif)
 		ath11k_mac_setup_bcn_tmpl_vif_params(tx_arvif, bcn);
+	else
+		(void)ath11k_mac_setup_bcn_tmpl_nontx_vif_params(tx_arvif,
+								 arvif, bcn);
 
 	ret = __ath11k_mac_setup_bcn_tmpl(tx_arvif, bcn, offs, 0, 0);
 	if (ret)
-- 
2.31.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

  parent reply	other threads:[~2022-05-23  7:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23  6:00 [PATCH 0/9] MBSSID and EMA support in AP mode Aloka Dixit
2022-05-23  6:00 ` Aloka Dixit
2022-05-23  6:01 ` [PATCH 1/9] mac80211: generate EMA beacons " Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-07-01  8:59   ` Johannes Berg
2022-07-01  8:59     ` Johannes Berg
2022-05-23  6:01 ` [PATCH 2/9] ath11k: add WMI resource config for EMA Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-05-23  6:01 ` [PATCH 3/9] ath11k: set MBSSID and EMA driver capabilities Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-05-23  6:01 ` [PATCH 4/9] ath11k: MBSSID configuration during vdev create/start Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-05-23  6:01 ` [PATCH 5/9] ath11k: create a structure for WMI vdev up parameters Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-05-24 19:30   ` Jeff Johnson
2022-05-24 19:30     ` Jeff Johnson
2022-05-23  6:01 ` [PATCH 6/9] ath11k: configure MBSSID device parameters Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-05-23  6:01 ` [PATCH 7/9] ath11k: move vif parameter setting in a different function Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-05-23  6:01 ` [PATCH 8/9] ath11k: EMA beacon support Aloka Dixit
2022-05-23  6:01   ` Aloka Dixit
2022-05-23  6:01 ` Aloka Dixit [this message]
2022-05-23  6:01   ` [PATCH 9/9] ath11k: configure WPA and RSN parameters for nontransmitting interface Aloka Dixit

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=20220523060108.23982-10-quic_alokad@quicinc.com \
    --to=quic_alokad@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --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.