Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2024 22:39:44 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9c50c9b776e3 - stable/14 - sys: Use mbufq_empty instead of comparing mbufq_len against 0
Message-ID:  <202401182239.40IMdiMQ009065@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=9c50c9b776e3023d4b24cce0a5a587a7813c6c54

commit 9c50c9b776e3023d4b24cce0a5a587a7813c6c54
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-01-09 19:00:46 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-18 22:37:29 +0000

    sys: Use mbufq_empty instead of comparing mbufq_len against 0
    
    Reviewed by:    bz, emaste
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D43338
    
    (cherry picked from commit 8cb9b68f5821e45c63ee08d8ee3029ca523ac174)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 2 +-
 sys/dev/cxgb/cxgb_sge.c                      | 4 ++--
 sys/dev/cxgbe/tom/t4_tom.c                   | 4 ++--
 sys/net/if_epair.c                           | 2 +-
 sys/net80211/ieee80211_ddb.c                 | 2 +-
 sys/net80211/ieee80211_ht.c                  | 6 +++---
 sys/netinet/igmp.c                           | 2 +-
 sys/netinet6/mld6.c                          | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 42fb7a60ce57..ffc28e2685de 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -3198,7 +3198,7 @@ lkpi_ic_node_free(struct ieee80211_node *ni)
 
 	/* Flush mbufq (make sure to release ni refs!). */
 #ifdef __notyet__
-	KASSERT(mbufq_len(&lsta->txq) == 0, ("%s: lsta %p has txq len %d != 0\n",
+	KASSERT(mbufq_empty(&lsta->txq), ("%s: lsta %p has txq len %d != 0\n",
 	    __func__, lsta, mbufq_len(&lsta->txq)));
 #endif
 	/* Drain taskq. */
diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c
index ca5ff3f1d417..f57494065aec 100644
--- a/sys/dev/cxgb/cxgb_sge.c
+++ b/sys/dev/cxgb/cxgb_sge.c
@@ -1838,7 +1838,7 @@ check_desc_avail(adapter_t *adap, struct sge_txq *q,
 	 * the control queue is only used for binding qsets which happens
 	 * at init time so we are guaranteed enough descriptors
 	 */
-	if (__predict_false(mbufq_len(&q->sendq))) {
+	if (__predict_false(!mbufq_empty(&q->sendq))) {
 addq_exit:	(void )mbufq_enqueue(&q->sendq, m);
 		return 1;
 	}
@@ -1954,7 +1954,7 @@ again:	reclaim_completed_tx_imm(q);
 		}
 		q->in_use++;
 	}
-	if (mbufq_len(&q->sendq)) {
+	if (!mbufq_empty(&q->sendq)) {
 		setbit(&qs->txq_stopped, TXQ_CTRL);
 
 		if (should_restart_tx(q) &&
diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c
index e5b173964451..77b6ba5d4032 100644
--- a/sys/dev/cxgbe/tom/t4_tom.c
+++ b/sys/dev/cxgbe/tom/t4_tom.c
@@ -323,8 +323,8 @@ release_offload_resources(struct toepcb *toep)
 	 * that a normal connection's socket's so_snd would have been purged or
 	 * drained.  Do _not_ clean up here.
 	 */
-	MPASS(mbufq_len(&toep->ulp_pduq) == 0);
-	MPASS(mbufq_len(&toep->ulp_pdu_reclaimq) == 0);
+	MPASS(mbufq_empty(&toep->ulp_pduq));
+	MPASS(mbufq_empty(&toep->ulp_pdu_reclaimq));
 #ifdef INVARIANTS
 	if (ulp_mode(toep) == ULP_MODE_TCPDDP)
 		ddp_assert_empty(toep);
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index 2fa016c8f35c..7bc218321f01 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -177,7 +177,7 @@ epair_tx_start_deferred(void *arg, int pending)
 	 * end up starving ourselves in a multi-epair routing configuration.
 	 */
 	mtx_lock(&q->mtx);
-	if (mbufq_len(&q->q) > 0) {
+	if (!mbufq_empty(&q->q)) {
 		resched = true;
 		q->state = EPAIR_QUEUE_WAKING;
 	} else {
diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c
index cd4a4f191745..0042d5d4aeb6 100644
--- a/sys/net80211/ieee80211_ddb.c
+++ b/sys/net80211/ieee80211_ddb.c
@@ -222,7 +222,7 @@ _db_show_rxampdu(const char *sep, int ix, const struct ieee80211_rx_ampdu *rap)
 	db_printf("%s  age %d nframes %d\n", sep,
 		rap->rxa_age, rap->rxa_nframes);
 	for (i = 0; i < IEEE80211_AGGR_BAWMAX; i++)
-		if (mbufq_len(&rap->rxa_mq[i]) > 0) {
+		if (!mbufq_empty(&rap->rxa_mq[i])) {
 			db_printf("%s  m[%2u:%4u] ", sep, i,
 			    IEEE80211_SEQ_ADD(rap->rxa_start, i));
 			STAILQ_FOREACH(m, &rap->rxa_mq[i].mq_head,
diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
index a322c21b4673..cb981014fdb9 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -571,7 +571,7 @@ ampdu_rx_add_slot(struct ieee80211_rx_ampdu *rap, int off, int tid,
 	/*
 	 * Get the rxs of the final mbuf in the slot, if one exists.
 	 */
-	if (mbufq_len(&rap->rxa_mq[off]) != 0) {
+	if (!mbufq_empty(&rap->rxa_mq[off])) {
 		rxs_final = ieee80211_get_rx_params_ptr(mbufq_last(&rap->rxa_mq[off]));
 	}
 
@@ -601,7 +601,7 @@ ampdu_rx_add_slot(struct ieee80211_rx_ampdu *rap, int off, int tid,
 	 * If the list is empty OR we have determined we can put more
 	 * driver decap'ed AMSDU frames in here, then insert.
 	 */
-	if ((mbufq_len(&rap->rxa_mq[off]) == 0) || (toss_dup == 0)) {
+	if (mbufq_empty(&rap->rxa_mq[off]) || (toss_dup == 0)) {
 		if (mbufq_enqueue(&rap->rxa_mq[off], m) != 0) {
 			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_11N,
 			    ni->ni_macaddr,
@@ -1079,7 +1079,7 @@ again:
 			/*
 			 * Dispatch as many packets as we can.
 			 */
-			KASSERT((mbufq_len(&rap->rxa_mq[0]) == 0), ("unexpected dup"));
+			KASSERT(mbufq_empty(&rap->rxa_mq[0]), ("unexpected dup"));
 			ampdu_dispatch(ni, m);
 			ampdu_rx_dispatch(rap, ni);
 			return CONSUMED;
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index c3dd0302fb39..3a60feadcdab 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -3381,7 +3381,7 @@ igmp_v3_dispatch_general_query(struct igmp_ifsoftc *igi)
 	 * many packets, we should finish sending them before starting of
 	 * queuing the new reply.
 	 */
-	if (mbufq_len(&igi->igi_gq) != 0)
+	if (!mbufq_empty(&igi->igi_gq))
 		goto send;
 
 	ifp = igi->igi_ifp;
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index 309c9d11204f..6a64d1830afd 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -2995,7 +2995,7 @@ mld_v2_dispatch_general_query(struct mld_ifsoftc *mli)
 	 * many packets, we should finish sending them before starting of
 	 * queuing the new reply.
 	 */
-	if (mbufq_len(&mli->mli_gq) != 0)
+	if (!mbufq_empty(&mli->mli_gq))
 		goto send;
 
 	ifp = mli->mli_ifp;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401182239.40IMdiMQ009065>