Skip to contentSkip to conversation

wifi: mac80211: support ieee80211_ext format

PATCH In review Gilad Itzkovitch 2 participants 2 messages Apr 19, 2023 – Sep 13, 2023 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mac80211: support ieee80211_ext format

From: Kieran Frewen <[email protected]>

Ensure S1G beacons use the new ieee80211_ext format when required.

---
 net/mac80211/rx.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
net/mac80211/rx.c +12 -3
index db3451f5f2fb..74027486a6b9 100644
@@ -5048,6 +5048,15 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx,
 	struct ieee80211_hdr *hdr = (void *)skb->data;
 	struct sta_info *sta;
 	int link_id = -1;
+	const u8 *addr;
+
+	if (ieee80211_is_s1g_beacon(hdr->frame_control)) {
+		struct ieee80211_ext *ext_hdr = (struct ieee80211_ext *)skb->data;
+
+		addr = ext_hdr->u.s1g_beacon.sa;
+	} else {
+		addr = hdr->addr2;
+	}
 
 	/*
 	 * Look up link station first, in case there's a
@@ -5055,14 +5064,14 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx,
 	 * is identical to the MLD address, that way we'll
 	 * have the link information if needed.
 	 */
-	link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);
+	link_sta = link_sta_info_get_bss(rx->sdata, addr);
 	if (link_sta) {
 		sta = link_sta->sta;
 		link_id = link_sta->link_id;
 	} else {
 		struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
 
-		sta = sta_info_get_bss(rx->sdata, hdr->addr2);
+		sta = sta_info_get_bss(rx->sdata, addr);
 		if (status->link_valid)
 			link_id = status->link_id;
 	}
@@ -5102,7 +5111,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_ext(fc)) {
 		/* drop frame if too short for header */
 		if (skb->len < ieee80211_hdrlen(fc))
 			err = -ENOBUFS;

base-commit: 9ae708f00161e1d789268fa9cc05bf6bec2af474

Signature · 1 line
2.34.1
maintainer
#1 lore raw

Going through all the old patches ...

net/mac80211/rx.c static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx, · line 5054

Quoted 4 lines
net/mac80211/rx.c +4 -0
+	const u8 *addr;
+
+	if (ieee80211_is_s1g_beacon(hdr->frame_control)) {
+		struct ieee80211_ext *ext_hdr = (struct ieee80211_ext *)skb->data;

nit: can just use void * cast.

for reference below:

net/mac80211/rx.c static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · line 5116

Quoted 8 lines
net/mac80211/rx.c +2 -1
+		addr = ext_hdr->u.s1g_beacon.sa;
 
 
-	if (ieee80211_is_mgmt(fc)) {
+	if (ieee80211_is_mgmt(fc) || ieee80211_is_ext(fc)) {
 		/* drop frame if too short for header */
 		if (skb->len < ieee80211_hdrlen(fc))

I don't understand the addition of this check in this patch.

ieee80211_hdrlen() just ensures that you have _four_ bytes header for an ext frame. So maybe that makes sense on its own, but above you're casting to struct ieee80211_ext * and then using the u.s1g_beacon thing, so you need to ensure many more bytes are present _somewhere_?

johannes