Page MenuHomeFreeBSD

D50691.id156682.diff
No OneTemporary

D50691.id156682.diff

diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h
--- a/sys/net80211/ieee80211_node.h
+++ b/sys/net80211/ieee80211_node.h
@@ -531,6 +531,12 @@
int8_t ieee80211_getrssi(struct ieee80211vap *);
void ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *);
+/* TX sequence space related routines */
+ieee80211_seq ieee80211_tx_seqno_fetch_incr(struct ieee80211_node *,
+ uint8_t);
+ieee80211_seq ieee80211_tx_seqno_fetch(const struct ieee80211_node *,
+ uint8_t);
+
/*
* Node transmit rate specific manipulation.
*
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -3137,6 +3137,36 @@
*rssi = ieee80211_getrssi(vap);
}
+/**
+ * @brief Increment the given TID TX sequence, return the current one.
+ *
+ * @param ni ieee80211_node to operate on
+ * @param tid TID, or IEEE80211_NONQOS_TID
+ * @returns sequence number, from 0 .. 4095 inclusive, post increments
+ */
+ieee80211_seq ieee80211_tx_seqno_fetch_incr(struct ieee80211_node *ni,
+ uint8_t tid)
+{
+ ieee80211_seq seq;
+
+ seq = ni->ni_txseqs[tid];
+ ni->ni_txseqs[tid] = (ni->ni_txseqs[tid] + 1) % IEEE80211_SEQ_RANGE;
+ return (seq);
+}
+
+/**
+ * @brief Return the current sequence number for the given TID
+ *
+ * @param ni ieee80211_node to operate on
+ * @param tid TID, or IEEE80211_NONQOS_TID
+ * @returns sequence number, from 0 .. 4095 inclusive
+ */
+ieee80211_seq ieee80211_tx_seqno_fetch(const struct ieee80211_node *ni,
+ uint8_t tid)
+{
+ return (ni->ni_txseqs[tid]);
+}
+
/**
* @brief return a dot11rate / ratecode representing the current transmit rate
*
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -4195,17 +4195,15 @@
* Check the frame type and TID and assign a suitable sequence number
* from the correct sequence number space.
*
+ * This implements the components of 802.11-2020 10.3.2.14.2
+ * (Transmitter Requirements) that net80211 currently supports.
+ *
* It assumes the mbuf has been encapsulated, and has the TID assigned
* if it is a QoS frame.
*
* Note this also clears any existing fragment ID in the header, so it
* must be called first before assigning fragment IDs.
*
- * For now this implements parts of 802.11-2012; it doesn't do all of
- * the needed checks for full compliance (notably QoS-Data NULL frames).
- *
- * TODO: update to 802.11-2020 10.3.2.14.2 (Transmitter Requirements)
- *
* @param ni ieee80211_node this frame will be transmitted to
* @param arg_tid A temporary check, existing callers may set
* this to a TID variable they were using, and this routine
@@ -4239,16 +4237,29 @@
"%s: called; TID mismatch; tid=%u, arg_tid=%d\n",
__func__, tid, arg_tid);
- if (IEEE80211_HAS_SEQ(type, subtype)) {
- /*
- * 802.11-2012 9.3.2.10 - QoS multicast frames
- * come out of a different seqno space.
- */
- if (IEEE80211_IS_MULTICAST(wh->i_addr1))
- seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++;
- else
- seqno = ni->ni_txseqs[tid]++;
- } else
+
+ /* 802.11-2020 10.3.2.14.2 (Transmitter Requirements) sections */
+
+ /* SNS7 - unicast PV1 management frame */
+
+ /* SNS6 - unicast PV1 data frame */
+
+ /* SNS5 - QoS NULL frames */
+ if (IEEE80211_QOS_HAS_SEQ(wh) && IEEE80211_IS_QOS_NULL(wh))
+ seqno = ieee80211_tx_seqno_fetch_incr(ni, IEEE80211_NONQOS_TID);
+
+ /* SNS4 - QMF STA transmitting a QMF */
+
+ /* SNS3 - QoS STA; Time Priority Management frame */
+
+ /* SNS2 - unicast QoS STA, data frame, excluding SNS5 */
+ else if (IEEE80211_QOS_HAS_SEQ(wh))
+ seqno = ieee80211_tx_seqno_fetch_incr(ni, tid);
+
+ /* SNS1 - Baseline (everything else) */
+ else if (IEEE80211_HAS_SEQ(type, subtype))
+ seqno = ieee80211_tx_seqno_fetch_incr(ni, IEEE80211_NONQOS_TID);
+ else
seqno = 0;
/*
@@ -4276,7 +4287,7 @@
wh = mtod(m, struct ieee80211_frame *);
- seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++;
+ seqno = ieee80211_tx_seqno_fetch_incr(ni, IEEE80211_NONQOS_TID);
*(uint16_t *)&wh->i_seq[0] =
htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT);
M_SEQNO_SET(m, seqno);

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 23, 11:07 PM (13 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27891075
Default Alt Text
D50691.id156682.diff (4 KB)

Event Timeline