svn commit: r365014 - head/sys/dev/cxgbe

Navdeep Parhar np at FreeBSD.org
Mon Aug 31 22:45:00 UTC 2020


Author: np
Date: Mon Aug 31 22:44:59 2020
New Revision: 365014
URL: https://svnweb.freebsd.org/changeset/base/365014

Log:
  cxgbe(4): Check for descriptors before writing a TLS or raw work request.
  
  This fixes a regression in r362905.
  
  Submitted by:	jhb@
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c	Mon Aug 31 21:57:01 2020	(r365013)
+++ head/sys/dev/cxgbe/t4_sge.c	Mon Aug 31 22:44:59 2020	(r365014)
@@ -3004,6 +3004,14 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool
 
 		MPASS(rc != 0 && rc != EAGAIN);
 		MPASS(txp->npkt == 0);
+
+		n = tx_len16_to_desc(mbuf_len16(m0));
+		if (__predict_false(avail < n)) {
+			avail += reclaim_tx_descs(txq, min(n, 32));
+			if (avail < n)
+				break;	/* out of descriptors */
+		}
+
 		wr = &eq->desc[eq->pidx];
 		if (mbuf_cflags(m0) & MC_RAW_WR) {
 			n = write_raw_wr(txq, wr, m0, avail);
@@ -3014,12 +3022,6 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool
 			    avail);
 #endif
 		} else {
-			n = tx_len16_to_desc(mbuf_len16(m0));
-			if (__predict_false(avail < n)) {
-				avail += reclaim_tx_descs(txq, 32);
-				if (avail < n)
-					break;	/* out of descriptors */
-			}
 			ETHER_BPF_MTAP(ifp, m0);
 			if (sc->flags & IS_VF)
 				n = write_txpkt_vm_wr(sc, txq, m0);


More information about the svn-src-head mailing list