Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 2021 17:07:37 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d59f1c49e26b - main - cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.
Message-ID:  <202108021707.172H7bfW032250@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

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

commit d59f1c49e26ba29e7583019bb5d6aa029466fdb6
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-08-02 16:41:27 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-08-02 16:41:27 +0000

    cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.
    
    The remote peer might send a FIN in the middle of a burst of data
    PDUs.  In the case of T6 with data PDU completion moderation, the
    driver would not have seen these PDUs since the final PDU in the burst
    was never received resulting in a stale rcv_nxt when the FIN is
    received.
    
    While here, invert the logic in the condition to be more readable and
    always set tp->rcv_nxt from the sequence number in the CPL.  This sets
    the proper value of rcv_nxt for FINs on connections with data received
    but not reported via a CPL (e.g. a partial iSCSI PDU burst interrupted
    by a FIN).
    
    Reported by:    Jithesh Arakkan @ Chelsio
    Reviewed by:    np
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D30871
---
 sys/dev/cxgbe/tom/t4_cpl_io.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index 3af127c6a3a3..a75f93ded5f6 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -1288,7 +1288,21 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 	if (toep->flags & TPF_ABORT_SHUTDOWN)
 		goto done;
 
-	tp->rcv_nxt++;	/* FIN */
+	if (ulp_mode(toep) == ULP_MODE_RDMA ||
+	    (ulp_mode(toep) == ULP_MODE_ISCSI && chip_id(sc) >= CHELSIO_T6)) {
+		/*
+		 * There might be data received via DDP before the FIN
+		 * not reported to the driver.  Just assume the
+		 * sequence number in the CPL is correct as the
+		 * sequence number of the FIN.
+		 */
+	} else {
+		KASSERT(tp->rcv_nxt + 1 == be32toh(cpl->rcv_nxt),
+		    ("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt,
+		    be32toh(cpl->rcv_nxt)));
+	}
+
+	tp->rcv_nxt = be32toh(cpl->rcv_nxt);
 
 	so = inp->inp_socket;
 	socantrcvmore(so);
@@ -1300,12 +1314,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 		DDP_UNLOCK(toep);
 	}
 
-	if (ulp_mode(toep) != ULP_MODE_RDMA) {
-		KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt),
-	    		("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt,
-	    		be32toh(cpl->rcv_nxt)));
-	}
-
 	switch (tp->t_state) {
 	case TCPS_SYN_RECEIVED:
 		tp->t_starttime = ticks;



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