svn commit: r333329 - head/sys/net

Andrew Gallatin gallatin at FreeBSD.org
Mon May 7 18:11:23 UTC 2018


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;
 	}


More information about the svn-src-all mailing list