The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8cb9b68f5821e45c63ee08d8ee3029ca523ac174

commit 8cb9b68f5821e45c63ee08d8ee3029ca523ac174
Author:     John Baldwin <j...@freebsd.org>
AuthorDate: 2024-01-09 19:00:46 +0000
Commit:     John Baldwin <j...@freebsd.org>
CommitDate: 2024-01-09 19:00:46 +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
---
 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 aa90100a328c..edd2423c59b5 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -3346,7 +3346,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 5297b741d9b9..c747d29735a6 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -567,7 +567,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]));
        }
 
@@ -597,7 +597,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,
@@ -1075,7 +1075,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 74cf7a557d9a..1655963e6cff 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -3383,7 +3383,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 3c07d6fa1d6b..5dd192a69fa9 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -2993,7 +2993,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;

Reply via email to