From nobody Fri Oct 29 23:58:27 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6FB33181D5F9; Fri, 29 Oct 2021 23:58:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgzsL3gBkz4VVR; Fri, 29 Oct 2021 23:58:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10274201F3; Fri, 29 Oct 2021 23:58:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwRgK003804; Fri, 29 Oct 2021 23:58:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwRf7003803; Fri, 29 Oct 2021 23:58:27 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:27 GMT Message-Id: <202110292358.19TNwRf7003803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 202f2c169bec - stable/13 - cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 202f2c169bec8a0fc5d1981980b1388e9912201b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=202f2c169bec8a0fc5d1981980b1388e9912201b commit 202f2c169bec8a0fc5d1981980b1388e9912201b Author: John Baldwin AuthorDate: 2021-08-02 16:41:27 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:17:31 +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 (cherry picked from commit d59f1c49e26ba29e7583019bb5d6aa029466fdb6) 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 (cherry picked from commit 5dbf8c1588da167c17c45bdf78de51fcb4929504) --- sys/dev/cxgbe/tom/t4_cpl_io.c | 20 ++++++++++++++------ sys/dev/cxgbe/tom/t4_ddp.c | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index acb2d3408244..66e3955445f9 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1292,8 +1292,6 @@ 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 */ - so = inp->inp_socket; socantrcvmore(so); if (ulp_mode(toep) == ULP_MODE_TCPDDP) { @@ -1304,12 +1302,22 @@ 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))); + 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); + 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) {