From owner-dev-commits-src-all@freebsd.org Mon Aug 2 17:07:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1D99677E84; Mon, 2 Aug 2021 17:07:37 +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 4Gdkvs4Bk7z4jHt; Mon, 2 Aug 2021 17:07:37 +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 6A25123438; Mon, 2 Aug 2021 17:07:37 +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 172H7bt8032251; Mon, 2 Aug 2021 17:07:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172H7bfW032250; Mon, 2 Aug 2021 17:07:37 GMT (envelope-from git) Date: Mon, 2 Aug 2021 17:07:37 GMT Message-Id: <202108021707.172H7bfW032250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d59f1c49e26b - main - cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. 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/main X-Git-Reftype: branch X-Git-Commit: d59f1c49e26ba29e7583019bb5d6aa029466fdb6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 17:07:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d59f1c49e26ba29e7583019bb5d6aa029466fdb6 commit d59f1c49e26ba29e7583019bb5d6aa029466fdb6 Author: John Baldwin AuthorDate: 2021-08-02 16:41:27 +0000 Commit: John Baldwin 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;