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
This commit is contained in:
Adrian Chadd 2025-06-04 17:17:45 -07:00
parent 2b35b71718
commit eabcd1773f
2 changed files with 24 additions and 9 deletions

View file

@ -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

View file

@ -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? */