Index: sys/net/iflib.c =================================================================== --- sys/net/iflib.c +++ sys/net/iflib.c @@ -3412,6 +3412,7 @@ struct ifnet *ifp = ctx->ifc_ifp; struct mbuf **mp, *m; int i, count, consumed, pkt_sent, bytes_sent, mcast_sent, avail; + int max_bytes; int reclaimed, err, in_use_prev, desc_used; bool do_prefetch, ring, rang; @@ -3444,7 +3445,8 @@ if (reclaimed) txq->ift_qstatus = IFLIB_QUEUE_IDLE; consumed = mcast_sent = bytes_sent = pkt_sent = 0; - count = MIN(avail, TX_BATCH_SIZE); + count = avail; + max_bytes = min(TX_BATCH_SIZE * if_getmtu(ifp), ctx->ifc_softc_ctx.isc_txrx_budget_bytes_max); #ifdef INVARIANTS if (iflib_verbose_debug) printf("%s avail=%d ifc_flags=%x txq_avail=%d ", __FUNCTION__, @@ -3453,7 +3455,7 @@ do_prefetch = (ctx->ifc_flags & IFC_PREFETCH); avail = TXQ_AVAIL(txq); err = 0; - for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2; i++) { + for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2 && bytes_sent < max_bytes; i++) { int rem = do_prefetch ? count - i : 0; mp = _ring_peek_one(r, cidx, i, rem);