svn commit: r340366 - stable/12/sys/dev/e1000
Stephen Hurd
shurd at FreeBSD.org
Mon Nov 12 16:28:09 UTC 2018
Author: shurd
Date: Mon Nov 12 16:28:07 2018
New Revision: 340366
URL: https://svnweb.freebsd.org/changeset/base/340366
Log:
MFC r340310:
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
Approved by: re (kib)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D17931
Modified:
stable/12/sys/dev/e1000/em_txrx.c
stable/12/sys/dev/e1000/igb_txrx.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/e1000/em_txrx.c
==============================================================================
--- stable/12/sys/dev/e1000/em_txrx.c Mon Nov 12 16:08:14 2018 (r340365)
+++ stable/12/sys/dev/e1000/em_txrx.c Mon Nov 12 16:28:07 2018 (r340366)
@@ -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: stable/12/sys/dev/e1000/igb_txrx.c
==============================================================================
--- stable/12/sys/dev/e1000/igb_txrx.c Mon Nov 12 16:08:14 2018 (r340365)
+++ stable/12/sys/dev/e1000/igb_txrx.c Mon Nov 12 16:28:07 2018 (r340366)
@@ -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;
More information about the svn-src-stable
mailing list