git: 16dc23caf17f - stable/13 - LinuxKPI: 802.11: implement ieee80211_is_pspoll()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 17 Feb 2023 23:44:56 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=16dc23caf17f8ffa21e365a1f2fe1a72d7fecbe8

commit 16dc23caf17f8ffa21e365a1f2fe1a72d7fecbe8
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-01-31 16:36:24 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-02-17 23:42:15 +0000

    LinuxKPI: 802.11: implement ieee80211_is_pspoll()
    
    Implement ieee80211_is_pspoll() and move it up to the set of implemented
    ieee80211_is_*() functions.
    
    There are no further changes (git diff just looks weird).
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    
    (cherry picked from commit ff76cbc81d57ffc4bbc9bc20fd22325b2a8c2028)
    (cherry picked from commit 2336248a8ba9763ad38074db40f32e117edd86f5)
---
 sys/compat/linuxkpi/common/include/net/mac80211.h | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 2b3f6b8e3ab1..b7c6c2d37b90 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -1342,29 +1342,33 @@ ieee80211_is_any_nullfunc(__le16 fc)
 	return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc));
 }
 
-static __inline bool
-ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
+static inline bool
+ieee80211_is_pspoll(__le16 fc)
 {
-	TODO();
-	return (false);
+	__le16 v;
+
+	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
+	v = htole16(IEEE80211_FC0_SUBTYPE_PS_POLL | IEEE80211_FC0_TYPE_CTL);
+
+	return (fc == v);
 }
 
 static __inline bool
-ieee80211_is_frag(struct ieee80211_hdr *hdr)
+ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
 {
 	TODO();
 	return (false);
 }
 
 static __inline bool
-ieee80211_is_first_frag(__le16 fc)
+ieee80211_is_frag(struct ieee80211_hdr *hdr)
 {
 	TODO();
 	return (false);
 }
 
 static __inline bool
-ieee80211_is_pspoll(__le16 fc)
+ieee80211_is_first_frag(__le16 fc)
 {
 	TODO();
 	return (false);