git: 23b209ee885b - main - cxgbe tom: Account for pre-iSCSI mode data on suspended connections.

John Baldwin jhb at FreeBSD.org
Fri May 14 19:21:54 UTC 2021


The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=23b209ee885b7891f806ecfe1bb944e40b3b4728

commit 23b209ee885b7891f806ecfe1bb944e40b3b4728
Author:     John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-05-14 19:17:02 +0000
Commit:     John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-05-14 19:17:02 +0000

    cxgbe tom: Account for pre-iSCSI mode data on suspended connections.
    
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D29907
---
 sys/dev/cxgbe/tom/t4_cpl_io.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index d1b20cfa0e1e..732754d07f8f 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -1081,8 +1081,34 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop)
 		return;
 	}
 
-	if (drop)
+	if (drop) {
+		struct socket *so = inp->inp_socket;
+		struct sockbuf *sb = &so->so_snd;
+		int sbu;
+
+		/*
+		 * An unlocked read is ok here as the data should only
+		 * transition from a non-zero value to either another
+		 * non-zero value or zero.  Once it is zero it should
+		 * stay zero.
+		 */
+		if (__predict_false(sbused(sb)) > 0) {
+			SOCKBUF_LOCK(sb);
+			sbu = sbused(sb);
+			if (sbu > 0) {
+				/*
+				 * The data transmitted before the
+				 * tid's ULP mode changed to ISCSI is
+				 * still in so_snd.  Incoming credits
+				 * should account for so_snd first.
+				 */
+				sbdrop_locked(sb, min(sbu, drop));
+				drop -= min(sbu, drop);
+			}
+			sowwakeup_locked(so);	/* unlocks so_snd */
+		}
 		rqdrop_locked(&toep->ulp_pdu_reclaimq, drop);
+	}
 
 	while ((sndptr = mbufq_first(pduq)) != NULL) {
 		wr = write_iscsi_mbuf_wr(toep, sndptr);


More information about the dev-commits-src-all mailing list