git: 18df65561983 - stable/13 - net80211 amdpu: Simplify a few loops that drain an mbufq

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 18 Jan 2024 22:39:48 UTC
The branch stable/13 has been updated by jhb:

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

commit 18df65561983f3092268f841b3b6df9146e36845
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-01-09 18:59:48 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-18 22:37:09 +0000

    net80211 amdpu: Simplify a few loops that drain an mbufq
    
    These loops already handled a NULL return from mbufq_dequeue when the
    queue was empty, so remove a redundant check of mbufq_len before
    dequeueing.
    
    Reviewed by:    bz
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D43336
    
    (cherry picked from commit 6977311633c73f594ff3dae150d6d1fe06105a8f)
---
 sys/net80211/ieee80211_ht.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
index 626f6386865c..e4d1ae223353 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -521,7 +521,7 @@ ampdu_rx_purge_slot(struct ieee80211_rx_ampdu *rap, int i)
 	struct mbuf *m;
 
 	/* Walk the queue, removing frames as appropriate */
-	while (mbufq_len(&rap->rxa_mq[i]) != 0) {
+	for (;;) {
 		m = mbufq_dequeue(&rap->rxa_mq[i]);
 		if (m == NULL)
 			break;
@@ -816,7 +816,7 @@ ampdu_dispatch_slot(struct ieee80211_rx_ampdu *rap, struct ieee80211_node *ni,
 	struct mbuf *m;
 	int n = 0;
 
-	while (mbufq_len(&rap->rxa_mq[i]) != 0) {
+	for (;;) {
 		m = mbufq_dequeue(&rap->rxa_mq[i]);
 		if (m == NULL)
 			break;