Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 May 2018 18:11:22 +0000 (UTC)
From:      Andrew Gallatin <gallatin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333329 - head/sys/net
Message-ID:  <201805071811.w47IBMUx026543@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gallatin
Date: Mon May  7 18:11:22 2018
New Revision: 333329
URL: https://svnweb.freebsd.org/changeset/base/333329

Log:
  Fix an off-by-one error when deciding to request a tx interrupt
  
  The canonical check for whether or not a ring is drainable is
  TXQ_AVAIL() > MAX_TX_DESC() + 2.  Use this same construct here,
  in order to avoid a potential off-by-one error where we might otherwise
  fail to request an interrupt.
  
  Reviewed by:	mmacy
  Sponsored by:	Netflix

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Mon May  7 17:37:07 2018	(r333328)
+++ head/sys/net/iflib.c	Mon May  7 18:11:22 2018	(r333329)
@@ -3299,7 +3299,7 @@ defrag:
 	 */
 	txq->ift_rs_pending += nsegs + 1;
 	if (txq->ift_rs_pending > TXQ_MAX_RS_DEFERRED(txq) ||
-	     iflib_no_tx_batch || (TXQ_AVAIL(txq) - nsegs - 1) <= MAX_TX_DESC(ctx)) {
+	     iflib_no_tx_batch || (TXQ_AVAIL(txq) - nsegs) <= MAX_TX_DESC(ctx) + 2) {
 		pi.ipi_flags |= IPI_TX_INTR;
 		txq->ift_rs_pending = 0;
 	}



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