Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2021 18:20:44 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ceaf1713927d - stable/12 - 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.
Message-ID:  <202101071820.107IKiQL073840@gitrepo.freebsd.org>

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

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

commit ceaf1713927d99da35cb3e75f879a4706b9f53a2
Author:     Marius Strobl <marius@FreeBSD.org>
AuthorDate: 2019-06-26 15:28:21 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-01-07 18:17:41 +0000

    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.
    
    (cherry picked from commit c2c5d1e7874dd2928bc5e85912e59541741f74a3)
---
 sys/net/iflib.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index eddfb9bc8f9b..3e115e992e4a 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -3664,10 +3664,10 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx)
 	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))) {
@@ -3705,16 +3705,15 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx)
 		       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;
@@ -3733,10 +3732,9 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx)
 		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;
@@ -6269,9 +6267,6 @@ iflib_tx_credits_update(if_ctx_t ctx, iflib_txq_t txq)
 	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);
 	if ((credits = ctx->isc_txd_credits_update(ctx->ifc_softc, txq->ift_id, true)) == 0)



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