git: 585388f9d986 - main - net80211: add IEEE80211_CONF_AMPDU_OFFLOAD for AMPDU[-TX] offload

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Tue, 22 Apr 2025 20:03:53 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=585388f9d986151045aaedcde1d29f89e62975c3

commit 585388f9d986151045aaedcde1d29f89e62975c3
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-04-14 18:19:28 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-04-22 20:03:31 +0000

    net80211: add IEEE80211_CONF_AMPDU_OFFLOAD for AMPDU[-TX] offload
    
    Drivers will set IEEE80211_FEXT_AMPDU_OFFLOAD to indicate to
    net80211 that the driver or the firmware will handle AMPDU[-TX]
    entirely on their own and net80211 should not do anything.
    
    Following the IEEE80211_CONF_FRAG_OFFLOAD() example add a
    IEEE80211_CONF_AMPDU_OFFLOAD() check in net80211 to handle the
    condition.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D49829
---
 sys/net80211/ieee80211_output.c | 2 +-
 sys/net80211/ieee80211_var.h    | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index f2f89d2d9d7c..e3cd73cd22d6 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -214,7 +214,7 @@ ieee80211_vap_pkt_send_dest(struct ieee80211vap *vap, struct mbuf *m,
 	 * frames will always have sequence numbers allocated from the NON_QOS
 	 * TID.
 	 */
-	if (do_ampdu) {
+	if (!IEEE80211_CONF_AMPDU_OFFLOAD(ic) && do_ampdu) {
 		if ((m->m_flags & M_EAPOL) == 0 && (! mcast)) {
 			int tid = WME_AC_TO_TID(M_WME_GETAC(m));
 			struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid];
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index 6c52fd22f29e..e011d2dd32ed 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -100,6 +100,8 @@
 	    ((ic)->ic_flags_ext & IEEE80211_FEXT_SEQNO_OFFLOAD)
 #define	IEEE80211_CONF_FRAG_OFFLOAD(ic)	\
 	    ((ic)->ic_flags_ext & IEEE80211_FEXT_FRAG_OFFLOAD)
+#define	IEEE80211_CONF_AMPDU_OFFLOAD(ic)	\
+	    ((ic)->ic_flags_ext & IEEE80211_FEXT_AMPDU_OFFLOAD)
 
 /*
  * 802.11 control state is split into a common portion that maps
@@ -697,13 +699,14 @@ MALLOC_DECLARE(M_80211_VAP);
 #define	IEEE80211_FEXT_VHT	0x00400000	/* CONF: VHT support */
 #define	IEEE80211_FEXT_QUIET_IE	0x00800000	/* STATUS: quiet IE in a beacon has been added */
 #define	IEEE80211_FEXT_UAPSD	0x01000000	/* CONF: enable U-APSD */
+#define	IEEE80211_FEXT_AMPDU_OFFLOAD	0x02000000	/* CONF: driver/fw handles AMPDU[-TX] itself */
 
 #define	IEEE80211_FEXT_BITS \
 	"\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \
 	"\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \
 	"\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD" \
 	    "\26FRAG_OFFLOAD\27VHT" \
-	"\30QUIET_IE\31UAPSD"
+	"\30QUIET_IE\31UAPSD\32AMPDU_OFFLOAD"
 
 /* ic_flags_ht/iv_flags_ht */
 #define	IEEE80211_FHT_NONHT_PR	 0x00000001	/* STATUS: non-HT sta present */