Author: marius
Date: Wed Jun 26 15:28:21 2019
New Revision: 349414
URL: https://svnweb.freebsd.org/changeset/base/349414

Log:
  o In iflib_txq_drain():
    - Remove desc_used, which is only ever written to.
    - Remove a dead store to reclaimed.
    - Don't recycle avail.
    - Sort variables according to style(9).
    These changes will make a subsequent commit easier to read.
  o In iflib_tx_credits_update(), don't bother checking whether the
    ift_txd_credits_update method pointer is NULL; _iflib_pre_assert()
    asserts upfront that this method has been assigned and functions
    like iflib_{fast_intr_rxtx,netmap_timer_adjust,txq_can_drain}()
    and _task_fn_tx() were already unconditionally relying on the
    method being callable.

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c        Wed Jun 26 15:16:23 2019        (r349413)
+++ head/sys/net/iflib.c        Wed Jun 26 15:28:21 2019        (r349414)
@@ -3580,10 +3580,10 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui
        iflib_txq_t txq = r->cookie;
        if_ctx_t ctx = txq->ift_ctx;
        if_t ifp = ctx->ifc_ifp;
-       struct mbuf **mp, *m;
-       int i, count, consumed, pkt_sent, bytes_sent, mcast_sent, avail;
-       int reclaimed, err, in_use_prev, desc_used;
-       bool do_prefetch, ring, rang;
+       struct mbuf *m, **mp;
+       int avail, bytes_sent, consumed, count, err, i, in_use_prev;
+       int mcast_sent, pkt_sent, reclaimed, txq_avail;
+       bool do_prefetch, rang, ring;
 
        if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING) ||
                            !LINK_ACTIVE(ctx))) {
@@ -3621,16 +3621,15 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui
                       avail, ctx->ifc_flags, TXQ_AVAIL(txq));
 #endif
        do_prefetch = (ctx->ifc_flags & IFC_PREFETCH);
-       avail = TXQ_AVAIL(txq);
+       txq_avail = TXQ_AVAIL(txq);
        err = 0;
-       for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2; i++) 
{
+       for (i = 0; i < count && txq_avail > MAX_TX_DESC(ctx) + 2; i++) {
                int rem = do_prefetch ? count - i : 0;
 
                mp = _ring_peek_one(r, cidx, i, rem);
                MPASS(mp != NULL && *mp != NULL);
                if (__predict_false(*mp == (struct mbuf *)txq)) {
                        consumed++;
-                       reclaimed++;
                        continue;
                }
                in_use_prev = txq->ift_in_use;
@@ -3649,10 +3648,9 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, ui
                DBG_COUNTER_INC(tx_sent);
                bytes_sent += m->m_pkthdr.len;
                mcast_sent += !!(m->m_flags & M_MCAST);
-               avail = TXQ_AVAIL(txq);
+               txq_avail = TXQ_AVAIL(txq);
 
                txq->ift_db_pending += (txq->ift_in_use - in_use_prev);
-               desc_used += (txq->ift_in_use - in_use_prev);
                ETHER_BPF_MTAP(ifp, m);
                if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING)))
                        break;
@@ -6154,9 +6152,6 @@ iflib_tx_credits_update(if_ctx_t ctx, iflib_txq_t txq)
 #ifdef INVARIANTS
        int credits_pre = txq->ift_cidx_processed;
 #endif
-
-       if (ctx->isc_txd_credits_update == NULL)
-               return (0);
 
        bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map,
            BUS_DMASYNC_POSTREAD);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to