Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2020 22:44:59 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r365014 - head/sys/dev/cxgbe
Message-ID:  <202008312244.07VMixcV081648@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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