Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Nov 2018 22:18:43 +0000 (UTC)
From:      Stephen Hurd <shurd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340310 - head/sys/dev/e1000
Message-ID:  <201811092218.wA9MIh2c050984@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: shurd
Date: Fri Nov  9 22:18:43 2018
New Revision: 340310
URL: https://svnweb.freebsd.org/changeset/base/340310

Log:
  Fix first-packet completion
  
  The first packet after the ring is initialized was never
  completed as isc_txd_credits_update() would not include it in the
  count of completed packets. This caused netmap to never complete
  a batch. See PR 233022 for more details.
  
  PR:		233022
  Reported by:	lev
  Reviewed by:	lev
  MFC after:	3 days
  Sponsored by:	Limelight Networks
  Differential Revision:	https://reviews.freebsd.org/D17931

Modified:
  head/sys/dev/e1000/em_txrx.c
  head/sys/dev/e1000/igb_txrx.c

Modified: head/sys/dev/e1000/em_txrx.c
==============================================================================
--- head/sys/dev/e1000/em_txrx.c	Fri Nov  9 21:45:42 2018	(r340309)
+++ head/sys/dev/e1000/em_txrx.c	Fri Nov  9 22:18:43 2018	(r340310)
@@ -458,7 +458,13 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, b
 	ntxd = scctx->isc_ntxd[0];
 	do {
 		delta = (int32_t)cur - (int32_t)prev;
+		/*
+		 * XXX This appears to be a hack for first-packet.
+		 * A correct fix would prevent prev == cur in the first place.
+		 */
 		MPASS(prev == 0 || delta != 0);
+		if (prev == 0 && cur == 0)
+			delta += 1;
 		if (delta < 0)
 			delta += ntxd;
 		DPRINTF(iflib_get_dev(adapter->ctx),

Modified: head/sys/dev/e1000/igb_txrx.c
==============================================================================
--- head/sys/dev/e1000/igb_txrx.c	Fri Nov  9 21:45:42 2018	(r340309)
+++ head/sys/dev/e1000/igb_txrx.c	Fri Nov  9 22:18:43 2018	(r340310)
@@ -333,7 +333,13 @@ igb_isc_txd_credits_update(void *arg, uint16_t txqid, 
 	ntxd = scctx->isc_ntxd[0];
 	do {
 		delta = (int32_t)cur - (int32_t)prev;
+		/*
+		 * XXX This appears to be a hack for first-packet.
+		 * A correct fix would prevent prev == cur in the first place.
+		 */
 		MPASS(prev == 0 || delta != 0);
+		if (prev == 0 && cur == 0)
+			delta += 1;
 		if (delta < 0)
 			delta += ntxd;
 



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