git: 5dbf8c1588da - main - cxgbe tom: Update rcv_nxt for a FIN after handle_ddp_close().

John Baldwin jhb at FreeBSD.org
Tue Sep 14 20:46:42 UTC 2021


The branch main has been updated by jhb:

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

commit 5dbf8c1588da167c17c45bdf78de51fcb4929504
Author:     John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-09-14 20:46:14 +0000
Commit:     John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-09-14 20:46:14 +0000

    cxgbe tom: Update rcv_nxt for a FIN after handle_ddp_close().
    
    For TCP DDP, handle_ddp_close() needs to see the pre-FIN rcv_nxt to
    determine how much data was placed in the local buffer before the FIN
    was received.  The changes in d59f1c49e26b broke this by updating
    rcv_nxt before calling handle_ddp_close().
    
    Fixes:          d59f1c49e26b cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/tom/t4_cpl_io.c | 20 ++++++++++----------
 sys/dev/cxgbe/tom/t4_ddp.c    |  3 ++-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index ca04cb88b10f..4c558df3f258 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -1374,6 +1374,16 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 	if (toep->flags & TPF_ABORT_SHUTDOWN)
 		goto done;
 
+	so = inp->inp_socket;
+	socantrcvmore(so);
+	if (ulp_mode(toep) == ULP_MODE_TCPDDP) {
+		DDP_LOCK(toep);
+		if (__predict_false(toep->ddp.flags &
+		    (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE)))
+			handle_ddp_close(toep, tp, cpl->rcv_nxt);
+		DDP_UNLOCK(toep);
+	}
+
 	if (ulp_mode(toep) == ULP_MODE_RDMA ||
 	    (ulp_mode(toep) == ULP_MODE_ISCSI && chip_id(sc) >= CHELSIO_T6)) {
 		/*
@@ -1390,16 +1400,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 
 	tp->rcv_nxt = be32toh(cpl->rcv_nxt);
 
-	so = inp->inp_socket;
-	socantrcvmore(so);
-	if (ulp_mode(toep) == ULP_MODE_TCPDDP) {
-		DDP_LOCK(toep);
-		if (__predict_false(toep->ddp.flags &
-		    (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE)))
-			handle_ddp_close(toep, tp, cpl->rcv_nxt);
-		DDP_UNLOCK(toep);
-	}
-
 	switch (tp->t_state) {
 	case TCPS_SYN_RECEIVED:
 		tp->t_starttime = ticks;
diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c
index 2b58cb60d4fd..be142ffb9e4f 100644
--- a/sys/dev/cxgbe/tom/t4_ddp.c
+++ b/sys/dev/cxgbe/tom/t4_ddp.c
@@ -700,7 +700,8 @@ handle_ddp_close(struct toepcb *toep, struct tcpcb *tp, __be32 rcv_nxt)
 	INP_WLOCK_ASSERT(toep->inp);
 	DDP_ASSERT_LOCKED(toep);
 
-	len = be32toh(rcv_nxt) - tp->rcv_nxt;
+	/* - 1 is to ignore the byte for FIN */
+	len = be32toh(rcv_nxt) - tp->rcv_nxt - 1;
 	tp->rcv_nxt += len;
 
 	while (toep->ddp.active_count > 0) {


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