Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Nov 2017 20:55:37 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325981 - head/sys/arm/allwinner
Message-ID:  <201711182055.vAIKtb8i026262@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Sat Nov 18 20:55:37 2017
New Revision: 325981
URL: https://svnweb.freebsd.org/changeset/base/325981

Log:
  if_awg: replace multiple calls to if_setdrvflagbits with one call in awg_txintr
  
  Small optimization
  
  Submitted by:	Guy Yur <guyyur@gmail.com>
  Differential Revision:	https://reviews.freebsd.org/D13033

Modified:
  head/sys/arm/allwinner/if_awg.c

Modified: head/sys/arm/allwinner/if_awg.c
==============================================================================
--- head/sys/arm/allwinner/if_awg.c	Sat Nov 18 20:50:31 2017	(r325980)
+++ head/sys/arm/allwinner/if_awg.c	Sat Nov 18 20:55:37 2017	(r325981)
@@ -916,7 +916,7 @@ awg_txintr(struct awg_softc *sc)
 	struct emac_desc *desc;
 	uint32_t status, size;
 	if_t ifp;
-	int i;
+	int i, prog;
 
 	AWG_ASSERT_LOCKED(sc);
 
@@ -924,6 +924,8 @@ awg_txintr(struct awg_softc *sc)
 	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
 	ifp = sc->ifp;
+
+	prog = 0;
 	for (i = sc->tx.next; sc->tx.queued > 0; i = TX_NEXT(i)) {
 		desc = &sc->tx.desc_ring[i];
 		status = le32toh(desc->status);
@@ -936,11 +938,14 @@ awg_txintr(struct awg_softc *sc)
 			else
 				if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 		}
+		prog++;
 		awg_clean_txbuf(sc, i);
-		if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
 	}
 
-	sc->tx.next = i;
+	if (prog > 0) {
+		sc->tx.next = i;
+		if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
+	}
 }
 
 static void



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