1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00

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
This commit is contained in:
John Baldwin 2024-01-09 11:00:46 -08:00
parent 76f405ed63
commit 8cb9b68f58
8 changed files with 12 additions and 12 deletions

View File

@ -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. */

View File

@ -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) &&

View File

@ -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);

View File

@ -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 {

View File

@ -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,

View File

@ -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 @@ ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m,
/*
* 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;

View File

@ -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;

View File

@ -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;