svn commit: r325980 - head/sys/arm/allwinner

Emmanuel Vadot manu at FreeBSD.org
Sat Nov 18 20:50:33 UTC 2017


Author: manu
Date: Sat Nov 18 20:50:31 2017
New Revision: 325980
URL: https://svnweb.freebsd.org/changeset/base/325980

Log:
  if_awg: only increment IFCOUNTER_OPACKETS when the last segment of a frame has been successfully transmitted
  
  A packet may be built from multiple segments, don't increase the count for each segment
  
  Submitted by:	Guy Yur <guyyur at gmail.com>
  Differential Revision:	https://reviews.freebsd.org/D13032

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:46:31 2017	(r325979)
+++ head/sys/arm/allwinner/if_awg.c	Sat Nov 18 20:50:31 2017	(r325980)
@@ -914,7 +914,7 @@ static void
 awg_txintr(struct awg_softc *sc)
 {
 	struct emac_desc *desc;
-	uint32_t status;
+	uint32_t status, size;
 	if_t ifp;
 	int i;
 
@@ -929,9 +929,15 @@ awg_txintr(struct awg_softc *sc)
 		status = le32toh(desc->status);
 		if ((status & TX_DESC_CTL) != 0)
 			break;
+		size = le32toh(desc->size);
+		if (size & TX_LAST_DESC) {
+			if ((status & (TX_HEADER_ERR | TX_PAYLOAD_ERR)) != 0)
+				if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
+			else
+				if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+		}
 		awg_clean_txbuf(sc, i);
 		if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
-		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 	}
 
 	sc->tx.next = i;


More information about the svn-src-head mailing list