Linux wireless drivers development
 help / color / mirror / Atom feed
From: Kieran Frewen <kieran.frewen@morsemicro.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, quic_jjohnson@quicinc.com,
	Kieran Frewen <kieran.frewen@morsemicro.com>
Subject: [PATCH v2 06/12] mac80211: support ieee80211_ext format
Date: Tue, 30 Aug 2022 02:20:11 +0000	[thread overview]
Message-ID: <20220830022017.51017-7-kieran.frewen@morsemicro.com> (raw)
In-Reply-To: <20220830022017.51017-1-kieran.frewen@morsemicro.com>

Ensure S1G beacons use the new ieee80211_ext format when required.

Signed-off-by: Kieran Frewen <kieran.frewen@morsemicro.com>
---
 net/mac80211/rx.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 57df21e2170a..d46eeebedb4b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -4895,6 +4895,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
 	struct ieee80211_local *local = hw_to_local(hw);
 	struct ieee80211_sub_if_data *sdata;
 	struct ieee80211_hdr *hdr;
+	struct ieee80211_ext *ext_hdr;
 	__le16 fc;
 	struct ieee80211_rx_data rx;
 	struct ieee80211_sub_if_data *prev;
@@ -4911,7 +4912,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
 	if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))
 		I802_DEBUG_INC(local->dot11ReceivedFragmentCount);
 
-	if (ieee80211_is_mgmt(fc)) {
+	if (ieee80211_is_mgmt(fc) || ieee80211_is_s1g_beacon(fc)) {
 		/* drop frame if too short for header */
 		if (skb->len < ieee80211_hdrlen(fc))
 			err = -ENOBUFS;
@@ -4926,13 +4927,17 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
 		return;
 	}
 
-	hdr = (struct ieee80211_hdr *)skb->data;
+	if (ieee80211_is_s1g_beacon(fc))
+		ext_hdr = (struct ieee80211_ext *)skb->data;
+	else
+		hdr = (struct ieee80211_hdr *)skb->data;
+
 	ieee80211_parse_qos(&rx);
 	ieee80211_verify_alignment(&rx);
 
-	if (unlikely(ieee80211_is_probe_resp(hdr->frame_control) ||
-		     ieee80211_is_beacon(hdr->frame_control) ||
-		     ieee80211_is_s1g_beacon(hdr->frame_control)))
+	if (unlikely(ieee80211_is_probe_resp(fc) ||
+		     ieee80211_is_beacon(fc) ||
+		     ieee80211_is_s1g_beacon(fc)))
 		ieee80211_scan_rx(local, skb);
 
 	if (ieee80211_is_data(fc)) {
@@ -4991,7 +4996,10 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
 			prev = sdata;
 			continue;
 		}
-
+		if (ieee80211_is_s1g_beacon(fc))
+			rx.sta = sta_info_get_bss(prev, ext_hdr->u.s1g_beacon.sa);
+		else
+			rx.sta = sta_info_get_bss(prev, hdr->addr2);
 		rx.sdata = prev;
 		ieee80211_rx_for_interface(&rx, skb, false);
 
@@ -4999,6 +5007,10 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
 	}
 
 	if (prev) {
+		if (ieee80211_is_s1g_beacon(fc))
+			rx.sta = sta_info_get_bss(prev, ext_hdr->u.s1g_beacon.sa);
+		else
+			rx.sta = sta_info_get_bss(prev, hdr->addr2);
 		rx.sdata = prev;
 
 		if (ieee80211_rx_for_interface(&rx, skb, true))
-- 
2.25.1


  parent reply	other threads:[~2022-08-30  2:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30  2:20 [PATCH v2 00/12] Additional Support for 802.11ah (S1G) Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 01/12] cfg80211: regulatory: extend regulatory support for S1G Kieran Frewen
2022-08-30  4:52   ` kernel test robot
2022-08-30  9:31   ` kernel test robot
2022-09-02  8:44   ` Dan Carpenter
2022-08-30  2:20 ` [PATCH v2 02/12] mac80211: update TIM for S1G specification changes Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 03/12] mac80211: S1G beacon/short beacon support Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 04/12] nl80211: support setting S1G short beacon period Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 05/12] nl80211: support advertising S1G capabilities Kieran Frewen
2022-08-30  2:20 ` Kieran Frewen [this message]
2022-08-30  2:20 ` [PATCH v2 07/12] mac80211: S1G capabilities information element in probe request Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 08/12] cfg80211: S1G rate flags Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 09/12] nl80211: support advertising S1G rate information Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 10/12] mac80211: support S1G rate encoding Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 11/12] cfg80211: support for calculating S1G bitrates Kieran Frewen
2022-08-30  2:20 ` [PATCH v2 12/12] mac80211_hwsim: support for S1G rate information Kieran Frewen

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=20220830022017.51017-7-kieran.frewen@morsemicro.com \
    --to=kieran.frewen@morsemicro.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_jjohnson@quicinc.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox