git: 596167005078 - stable/13 - LinuxKPI: 802.11: fill in two more TODOs

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 04 May 2022 15:18:13 UTC
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=5961670050788ecfe208f455b32becf5e1bbfaeb

commit 5961670050788ecfe208f455b32becf5e1bbfaeb
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-04-30 08:00:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-05-04 13:13:11 +0000

    LinuxKPI: 802.11: fill in two more TODOs
    
    Implement ieee80211_is_data_present() and a subset of
    ieee80211_is_bufferable_mmpdu() which hopefully is good enough in
    the compat code for now.
    This is partly in preparation for some TXQ changes coming up soon.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 00614c9c2ddc34f3f9061e87542efb4edbd936a9)
---
 sys/compat/linuxkpi/common/include/net/mac80211.h | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index c62ab1fbaa72..857fa0a9bb03 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -1102,8 +1102,13 @@ ieee80211_is_disassoc(__le16 fc)
 static __inline bool
 ieee80211_is_data_present(__le16 fc)
 {
-	TODO();
-	return (false);
+	__le16 v;
+
+	/* If it is a data frame and NODATA is not present. */
+	fc &= htole16(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_NODATA);
+	v = htole16(IEEE80211_FC0_TYPE_DATA);
+
+	return (fc == v);
 }
 
 static __inline bool
@@ -1166,7 +1171,19 @@ ieee80211_is_back_req(__le16 fc)
 static __inline bool
 ieee80211_is_bufferable_mmpdu(__le16 fc)
 {
-	TODO();
+
+	/* 11.2.2 Bufferable MMPDUs, 80211-2020. */
+	/* XXX we do not care about IBSS yet. */
+
+	if (!ieee80211_is_mgmt(fc))
+		return (false);
+	if (ieee80211_is_action(fc))		/* XXX FTM? */
+		return (true);
+	if (ieee80211_is_disassoc(fc))
+		return (true);
+	if (ieee80211_is_deauth(fc))
+		return (true);
+
 	return (false);
 }