All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: HE: add Spatial Reuse IE parsing support
@ 2019-03-25  8:20 John Crispin
  2019-03-25  8:49 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: John Crispin @ 2019-03-25  8:20 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, John Crispin

Add support to mac80211 for parsing SPR IEs as per
P802.11ax_D3.0 section 9.4.2.241.

Signed-off-by: John Crispin <john@phrozen.org>
---
 include/linux/ieee80211.h  | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/ieee80211_i.h |  1 +
 net/mac80211/util.c        |  4 ++++
 3 files changed, 54 insertions(+)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48703ec60d06..9e4ca3053ab1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1629,6 +1629,18 @@ struct ieee80211_he_operation {
 } __packed;
 
 /**
+ * struct ieee80211_he_spr - HE spatial reuse element
+ *
+ * This structure is the "HE spatial reuse element" element as
+ * described in P802.11ax_D3.0 section 9.4.2.241
+ */
+struct ieee80211_he_spr {
+	u8 he_sr_control;
+	/* Optional 0 to 19 bytes: depends on @he_sr_control */
+	u8 optional[0];
+} __packed;
+
+/**
  * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field
  *
  * This structure is the "MU AC Parameter Record" fields as
@@ -2063,6 +2075,42 @@ ieee80211_he_oper_size(const u8 *he_oper_ie)
 	return oper_len;
 }
 
+/* HE Spatial Reuse defines */
+#define IEEE80211_HE_SPR_NONE_SRG_OFFSET_PRESENT		0x4
+#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT		0x8
+
+/*
+ * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size
+ * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the the byte
+ *	after the ext ID byte. It is assumed that he_spr_ie has at least
+ *	sizeof(struct ieee80211_he_spr) bytes, checked already in
+ *	ieee802_11_parse_elems_crc()
+ * @return the actual size of the IE data (not including header), or 0 on error
+ */
+static inline u8
+ieee80211_he_spr_size(const u8 *he_spr_ie)
+{
+	struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;
+	u8 spr_len = sizeof(struct ieee80211_he_spr);
+	u32 he_spr_params;
+
+	/* Make sure the input is not NULL */
+	if (!he_spr_ie)
+		return 0;
+
+	/* Calc required length */
+	he_spr_params = le32_to_cpu(he_spr->he_sr_control);
+	if (he_spr_params & IEEE80211_HE_SPR_NONE_SRG_OFFSET_PRESENT)
+		spr_len++;
+	if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
+		spr_len += 2;
+
+	/* Add the first byte (extension ID) to the total length */
+	spr_len++;
+
+	return spr_len;
+}
+
 /* Authentication algorithms */
 #define WLAN_AUTH_OPEN 0
 #define WLAN_AUTH_SHARED_KEY 1
@@ -2485,6 +2533,7 @@ enum ieee80211_eid_ext {
 	WLAN_EID_EXT_HE_OPERATION = 36,
 	WLAN_EID_EXT_UORA = 37,
 	WLAN_EID_EXT_HE_MU_EDCA = 38,
+	WLAN_EID_EXT_HE_SPR = 39,
 	WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME = 52,
 	WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION = 55,
 };
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index e170f986d226..5c455681d1b8 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1482,6 +1482,7 @@ struct ieee802_11_elems {
 	const struct ieee80211_meshconf_ie *mesh_config;
 	const u8 *he_cap;
 	const struct ieee80211_he_operation *he_operation;
+	const struct ieee80211_he_spr *he_spr;
 	const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
 	const u8 *uora_element;
 	const u8 *mesh_id;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 4c1655972565..1b7076d24c18 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1282,6 +1282,10 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
 				   WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION &&
 				   elen == 3) {
 				elems->mbssid_config_ie = (void *)&pos[1];
+			} else if (pos[0] == WLAN_EID_EXT_HE_SPR &&
+				   elen >= sizeof(*elems->he_spr) &&
+				   elen >= ieee80211_he_spr_size(&pos[1])) {
+				elems->he_spr = (void *)&pos[1];
 			}
 			break;
 		default:
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: HE: add Spatial Reuse IE parsing support
  2019-03-25  8:20 [PATCH] mac80211: HE: add Spatial Reuse IE parsing support John Crispin
@ 2019-03-25  8:49 ` Johannes Berg
  2019-03-25  9:32   ` John Crispin
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2019-03-25  8:49 UTC (permalink / raw)
  To: John Crispin; +Cc: linux-wireless

On Mon, 2019-03-25 at 09:20 +0100, John Crispin wrote:
> Add support to mac80211 for parsing SPR IEs as per
> P802.11ax_D3.0 section 9.4.2.241.

Hmm, if you're not going to use it, why parse it? Am I missing a follow-
up patch?

Also, consider checking against D4.0, Luca just sent a patch to update
to that for all the rest of the code.

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: HE: add Spatial Reuse IE parsing support
  2019-03-25  8:49 ` Johannes Berg
@ 2019-03-25  9:32   ` John Crispin
  0 siblings, 0 replies; 3+ messages in thread
From: John Crispin @ 2019-03-25  9:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless


On 25/03/2019 09:49, Johannes Berg wrote:
> On Mon, 2019-03-25 at 09:20 +0100, John Crispin wrote:
>> Add support to mac80211 for parsing SPR IEs as per
>> P802.11ax_D3.0 section 9.4.2.241.
> Hmm, if you're not going to use it, why parse it? Am I missing a follow-
> up patch?
>
> Also, consider checking against D4.0, Luca just sent a patch to update
> to that for all the rest of the code.
>
> johannes
>
Hi Johannes,

This patch is in preparation for the upcoming OBBS PD support inside 
Kalle's ath11k-bringup tree. Forgot to mention that sorry.

I'll also check against D4.0.

     John


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-25  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25  8:20 [PATCH] mac80211: HE: add Spatial Reuse IE parsing support John Crispin
2019-03-25  8:49 ` Johannes Berg
2019-03-25  9:32   ` John Crispin

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.