The branch main has been updated by adrian:

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

commit eabcd1773fa3e4bf12ee053540a90fad79a6f81b
Author:     Adrian Chadd <adr...@freebsd.org>
AuthorDate: 2025-06-05 00:17:45 +0000
Commit:     Adrian Chadd <adr...@freebsd.org>
CommitDate: 2025-08-24 19:43:27 +0000

    net80211: add support for sequence number offloading
    
    Add support for sequence number offloading -
    
    * Check IEEE80211_CONF_SEQNO_OFFLOAD() before doing TX lock
      manipulation;
    * Don't call ieee80211_output_seqno_assign() if
      IEEE80211_CONF_SEQNO_OFFLOAD() is true.
    
    TODO:
    
    * this doesn't yet do beacon sequence number allocation offloading;
      I'll tackle that later.
    
    Differential Revision:  https://reviews.freebsd.org/D50692
    Reviewed by:    bz
---
 sys/net80211/ieee80211_freebsd.h | 22 ++++++++++++++++------
 sys/net80211/ieee80211_output.c  | 11 ++++++++---
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h
index 141b13f9f740..3684fba52c5c 100644
--- a/sys/net80211/ieee80211_freebsd.h
+++ b/sys/net80211/ieee80211_freebsd.h
@@ -93,12 +93,22 @@ typedef struct {
 } while (0)
 #define        IEEE80211_TX_LOCK_OBJ(_ic)      (&(_ic)->ic_txlock.mtx)
 #define        IEEE80211_TX_LOCK_DESTROY(_ic) 
mtx_destroy(IEEE80211_TX_LOCK_OBJ(_ic))
-#define        IEEE80211_TX_LOCK(_ic)     mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic))
-#define        IEEE80211_TX_UNLOCK(_ic)           
mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic))
-#define        IEEE80211_TX_LOCK_ASSERT(_ic) \
-       mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED)
-#define        IEEE80211_TX_UNLOCK_ASSERT(_ic) \
-       mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED)
+#define        IEEE80211_TX_LOCK(_ic) do { \
+       if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \
+               mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic)); \
+       } while (0);
+#define        IEEE80211_TX_UNLOCK(_ic) do { \
+       if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \
+               mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic)); \
+       } while (0);
+#define        IEEE80211_TX_LOCK_ASSERT(_ic) do { \
+       if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \
+               mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED); \
+       } while (0)
+#define        IEEE80211_TX_UNLOCK_ASSERT(_ic) { \
+       if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \
+               mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED); \
+       } while (0)
 
 /*
  * Stageq / ni_tx_superg lock
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index afe83ea0805c..57fe687adffe 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -974,7 +974,7 @@ ieee80211_send_setup(
 
                /* NB: zero out i_seq field (for s/w encryption etc) */
                *(uint16_t *)&wh->i_seq[0] = 0;
-       } else
+       } else if (!IEEE80211_CONF_SEQNO_OFFLOAD(ni->ni_ic))
                ieee80211_output_seqno_assign(ni, tid, m);
 
        if (IEEE80211_IS_MULTICAST(wh->i_addr1))
@@ -1810,7 +1810,8 @@ ieee80211_encap(struct ieee80211vap *vap, struct 
ieee80211_node *ni,
                 * and we don't need the TX lock held.
                 */
                if ((m->m_flags & M_AMPDU_MPDU) == 0) {
-                       ieee80211_output_seqno_assign(ni, tid, m);
+                       if (!IEEE80211_CONF_SEQNO_OFFLOAD(ic))
+                               ieee80211_output_seqno_assign(ni, tid, m);
                } else {
                        /*
                         * NB: don't assign a sequence # to potential
@@ -1828,7 +1829,9 @@ ieee80211_encap(struct ieee80211vap *vap, struct 
ieee80211_node *ni,
                        *(uint16_t *)wh->i_seq = 0;
                }
        } else {
-               ieee80211_output_seqno_assign(ni, IEEE80211_NONQOS_TID, m);
+               if (!IEEE80211_CONF_SEQNO_OFFLOAD(ic))
+                       ieee80211_output_seqno_assign(ni, IEEE80211_NONQOS_TID,
+                           m);
                /*
                 * XXX TODO: we shouldn't allow EAPOL, etc that would
                 * be forced to be non-QoS traffic to be A-MSDU encapsulated.
@@ -3856,6 +3859,8 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct 
mbuf *m, int mcast)
         * If the driver identifies it does its own TX seqno management then
         * we can skip this (and still not do the TX seqno.)
         */
+
+       /* TODO: IEEE80211_CONF_SEQNO_OFFLOAD() */
        ieee80211_output_beacon_seqno_assign(ni, m);
 
        /* XXX faster to recalculate entirely or just changes? */

Reply via email to