From nobody Tue Jul 8 19:37:26 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bcBFz0kkKz61QJV; Tue, 08 Jul 2025 19:37:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bcBFy67gsz4DMv; Tue, 08 Jul 2025 19:37:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752003446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pzeNIXdHLzSnTS3vfqdJJWZy259PHBgvDZkIV2CgpxU=; b=sGWiKDx6sKR7t5CciNvCdCRwUhCb43Eg4LesNCB1S1prNuf30817KKkt9H2VbZ2AA3AOM9 73AGYk4n3zIeMcfrSDtZ7RoDOFABDm+C69odAlEJfMQDOwalRfOjDbC28j3yhoEfPQcSEX YyxzhuAjjyrRZ1PukH0IQH+Nwa/vzj07aTzJQorE7+8qZNk+a3KigTdvRSm55HFXVIMZBg AsC4YeCo4dWNchIiAEwKntcnsF9iWTwaXVuEbJkLGjQnPeeYHpEubGY2exwNkRhtmIVuxq Ly9D54zmOAAk5iHax6QfOYy0FaQYd6yGG1YlR97iy5+k9YtdcvYbS/x+Eok6Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752003446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pzeNIXdHLzSnTS3vfqdJJWZy259PHBgvDZkIV2CgpxU=; b=kqYJUhcYpnd04XLlClWiuOtYtMDMLlDXrpg6JTEmxmuPaIcA3ePSRyDOOgiPR04aqQy65i jkcduulhoT4xArYo4X05jFNHDckfs3FKvRgYoGna9oalCGWYQWNaNBgzsRQjnPaYLW3jbU RNUyYQj+nh1HX1Z35NhmJZdotEA7xegglfAWdsJiyfSkOjP1XiUMACfvE/PE2uXo69OCHU Ox2rcVWPyHmizJuD10u76MB/EAObU1Mu5SAf/SqDEL8qxeLnID2q9NibqFrzfyhIxANnWY W2HLhyHuWDpWhCBP66q4Py93bb90aqE4mMEnA6Lu62ZGE86TtalU1/9+jJhjkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752003446; a=rsa-sha256; cv=none; b=LFZpAuqxl+EAJz+Ixr+eK2CUhy5mJ5OSCGTQNS36oEmgDd/uMVbOaEPkO0XCbzfPbN+Ka9 hujoL7Rh+6NK7LaQYAFZCFEryx3is3aQcsr8Xe28It6frvhI8YfsO88LgcyN9qCvvIhsVi 1K/Z7MBvM5W4m0Qd3VCdFhp4TtvEstILtunsiUXVC5VlpDd/WGaVA6o5NS4KXVZf/hQDIp 6ezAm3dcTQqVyAhbKtHAdG9oTrh1zeF6Kpy1exV8FNbZYcKWEDXI4KbzuBiC2qM+2p8NPB q4tvpPkf8y01Ugj6ED5rnIGl3CTHHmKm9toIEEp2ez3unxAblcnaflOzl1dqIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bcBFy5Hglzr4v; Tue, 08 Jul 2025 19:37:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 568JbQ87040270; Tue, 8 Jul 2025 19:37:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 568JbQN0040267; Tue, 8 Jul 2025 19:37:26 GMT (envelope-from git) Date: Tue, 8 Jul 2025 19:37:26 GMT Message-Id: <202507081937.568JbQN0040267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: dcd47304acb1 - main - net80211: update ieee80211_output_seqno_assign() to 802.11-2020 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dcd47304acb1f1713a27f407a153e2bb54c574ba Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=dcd47304acb1f1713a27f407a153e2bb54c574ba commit dcd47304acb1f1713a27f407a153e2bb54c574ba Author: Adrian Chadd AuthorDate: 2025-06-04 21:48:23 +0000 Commit: Adrian Chadd CommitDate: 2025-07-08 19:37:03 +0000 net80211: update ieee80211_output_seqno_assign() to 802.11-2020 Update ieee80211_output_seqno_assign() to support the transmitter sequence number assignment outlined in 802.11-2020 10.3.2.14.2 (Transmitter Requirements). Notably this correctly assigns the QoS NULL frames a seqno outside of the TID seqno space. Leave stub comments for the currently supported sequence number decisions. Add two new functions to access and increment the sequence number space, which will ensure that things wrap correctly. This should simplify drivers needing to constantly invent their own methods of fetching and incrementing the sequence number space. Differential Revision: https://reviews.freebsd.org/D50691 Reviewed by: bz --- sys/net80211/ieee80211_node.c | 30 ++++++++++++++++++++++++++++ sys/net80211/ieee80211_node.h | 6 ++++++ sys/net80211/ieee80211_output.c | 44 ++++++++++++++++++++++++++--------------- 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index ad17af6778a1..a201d1b278f0 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -3137,6 +3137,36 @@ ieee80211_getsignal(struct ieee80211vap *vap, int8_t *rssi, int8_t *noise) *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_node.h b/sys/net80211/ieee80211_node.h index c83eee04a8dc..ef25fa0d7fdd 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -531,6 +531,12 @@ void ieee80211_node_leave(struct ieee80211_node *); 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_output.c b/sys/net80211/ieee80211_output.c index a4151f807882..afe83ea0805c 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -4195,17 +4195,15 @@ ieee80211_tx_complete(struct ieee80211_node *ni, struct mbuf *m, int status) * 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,30 @@ ieee80211_output_seqno_assign(struct ieee80211_node *ni, int arg_tid, "%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) && + !IEEE80211_IS_MULTICAST(wh->i_addr1)) + 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 +4288,7 @@ ieee80211_output_beacon_seqno_assign(struct ieee80211_node *ni, struct mbuf *m) 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);