git: 752e211e6469 - main - cxgbei: Don't fail task setup if the socket is disconnected.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 23 Dec 2021 22:14:31 UTC
The branch main has been updated by jhb:

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

commit 752e211e64699ff14bb0a66d368cfaec836cfb95
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-12-22 20:53:58 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-12-23 22:14:07 +0000

    cxgbei: Don't fail task setup if the socket is disconnected.
    
    When the initiator is reconnecting to the target, the connection may
    temporarily be marked disconnected or not have an associated socket.
    New I/O requests received by the initiator in this state should not
    fail with ECONNRESET as that results in an I/O error back to userland.
    Instead, they need to still succeed so that CAM can queue the requests
    and send them once the connection is re-established.
    
    Setting up DDP for zero-copy receive requires a socket, so just punt
    on using DDP for these transfers.
    
    Reported by:    Jithesh Arakkan @ Chelsio
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
index de8f2547f29a..9296488fd793 100644
--- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
@@ -1089,11 +1089,9 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip,
 	MPASS(arg != NULL);
 	MPASS(*arg == NULL);
 
-	if (ic->ic_disconnecting || ic->ic_socket == NULL)
-		return (ECONNRESET);
-
 	if ((csio->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_IN ||
-	    csio->dxfer_len < ci->ddp_threshold) {
+	    csio->dxfer_len < ci->ddp_threshold || ic->ic_disconnecting ||
+	    ic->ic_socket == NULL) {
 no_ddp:
 		/*
 		 * No DDP for this I/O.	 Allocate an ITT (based on the one
@@ -1151,7 +1149,7 @@ no_ddp:
 		mbufq_drain(&mq);
 		t4_free_page_pods(prsv);
 		free(ddp, M_CXGBEI);
-		return (ECONNRESET);
+		goto no_ddp;
 	}
 	mbufq_concat(&toep->ulp_pduq, &mq);
 	INP_WUNLOCK(inp);