Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Nov 2017 20:50:31 +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: r325980 - head/sys/arm/allwinner
Message-ID:  <201711182050.vAIKoVme022072@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;



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