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;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to