git: 7a5288a023ba - main - net80211: clean up time comparison in HT code

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Wed, 11 Feb 2026 06:05:17 UTC
The branch main has been updated by adrian:

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

commit 7a5288a023baeac2f0c3128506178f89fda3cc0d
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2025-12-15 03:45:36 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-02-11 06:02:49 +0000

    net80211: clean up time comparison in HT code
    
    There's at least one place where the time comparison is wrong, leading
    to some bad beahaviour around deciding to try and establish/reestablish
    AMPDU TX sessions.
    
    Start addressing these!
    
    Differential Revision:  https://reviews.freebsd.org/D54390
---
 sys/net80211/ieee80211_ht.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
index 88e614e266a1..38568674a792 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -1130,7 +1130,8 @@ again:
 		 */
 		if (rap->rxa_qframes != 0) {
 			/* XXX honor batimeout? */
-			if (ticks - rap->rxa_age > ieee80211_ampdu_age) {
+			if (ieee80211_time_after(ticks - rap->rxa_age,
+			    ieee80211_ampdu_age)) {
 				/*
 				 * Too long since we received the first
 				 * frame; flush the reorder buffer.
@@ -1392,7 +1393,8 @@ ieee80211_ht_node_age(struct ieee80211_node *ni)
 		 * See above for more details on what's happening here.
 		 */
 		/* XXX honor batimeout? */
-		if (ticks - rap->rxa_age > ieee80211_ampdu_age) {
+		if (ieee80211_time_after(ticks - rap->rxa_age,
+		    ieee80211_ampdu_age)) {
 			/*
 			 * Too long since we received the first
 			 * frame; flush the reorder buffer.
@@ -2824,7 +2826,7 @@ ieee80211_ampdu_request(struct ieee80211_node *ni,
 		/* defer next try so we don't slam the driver with requests */
 		tap->txa_attempts = ieee80211_addba_maxtries;
 		/* NB: check in case driver wants to override */
-		if (tap->txa_nextrequest <= ticks)
+		if (ieee80211_time_before_eq(tap->txa_nextrequest, ticks))
 			tap->txa_nextrequest = ticks + ieee80211_addba_backoff;
 		return 0;
 	}