From owner-dev-commits-src-all@freebsd.org Mon Sep 13 17:04:15 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 D438467E555; Mon, 13 Sep 2021 17:04:15 +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 4H7Xrb5J1Dz3HYp; Mon, 13 Sep 2021 17:04:15 +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 92EAA2E94; Mon, 13 Sep 2021 17:04:15 +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 18DH4FOv032386; Mon, 13 Sep 2021 17:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DH4FQn032385; Mon, 13 Sep 2021 17:04:15 GMT (envelope-from git) Date: Mon, 13 Sep 2021 17:04:15 GMT Message-Id: <202109131704.18DH4FQn032385@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: b7caa8157602 - main - cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff. 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: b7caa8157602f4eb9acd2729b48ba3a0c0cdc045 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, 13 Sep 2021 17:04:15 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b7caa8157602f4eb9acd2729b48ba3a0c0cdc045 commit b7caa8157602f4eb9acd2729b48ba3a0c0cdc045 Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-09-13 16:57:54 +0000 cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff. This permits unindenting almost half of the function. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 80 ++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 4b1eb0718e86..6bec1f812cc0 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -857,52 +857,46 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) inp = sotoinpcb(so); INP_WLOCK(inp); tp = intotcpcb(inp); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) - error = EBUSY; - else { - /* - * socket could not have been "unoffloaded" if here. - */ - MPASS(tp->t_flags & TF_TOE); - MPASS(tp->tod != NULL); - MPASS(tp->t_toe != NULL); - toep = tp->t_toe; - MPASS(toep->vi->adapter == icc->sc); - icc->toep = toep; - icc->cwt = cxgbei_select_worker_thread(icc); - - icc->ulp_submode = 0; - if (ic->ic_header_crc32c) - icc->ulp_submode |= ULP_CRC_HEADER; - if (ic->ic_data_crc32c) - icc->ulp_submode |= ULP_CRC_DATA; - - if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && - !is_memfree(icc->sc)) { - max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / - max_tx_pdu_len; - ic->ic_hw_isomax = max_iso_pdus * - ic->ic_max_send_data_segment_length; - } else - max_iso_pdus = 1; - - so->so_options |= SO_NO_DDP; - toep->params.ulp_mode = ULP_MODE_ISCSI; - toep->ulpcb = icc; - - send_iscsi_flowc_wr(icc->sc, toep, - roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); - set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); - error = 0; + if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) { + INP_WUNLOCK(inp); + return (EBUSY); } - INP_WUNLOCK(inp); - if (error == 0) { - error = icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, - max_rx_pdu_len); - } + /* + * socket could not have been "unoffloaded" if here. + */ + MPASS(tp->t_flags & TF_TOE); + MPASS(tp->tod != NULL); + MPASS(tp->t_toe != NULL); + toep = tp->t_toe; + MPASS(toep->vi->adapter == icc->sc); + icc->toep = toep; + icc->cwt = cxgbei_select_worker_thread(icc); + + icc->ulp_submode = 0; + if (ic->ic_header_crc32c) + icc->ulp_submode |= ULP_CRC_HEADER; + if (ic->ic_data_crc32c) + icc->ulp_submode |= ULP_CRC_DATA; + + if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && + !is_memfree(icc->sc)) { + max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / max_tx_pdu_len; + ic->ic_hw_isomax = max_iso_pdus * + ic->ic_max_send_data_segment_length; + } else + max_iso_pdus = 1; + + so->so_options |= SO_NO_DDP; + toep->params.ulp_mode = ULP_MODE_ISCSI; + toep->ulpcb = icc; + + send_iscsi_flowc_wr(icc->sc, toep, + roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); + set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); + INP_WUNLOCK(inp); - return (error); + return (icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, max_rx_pdu_len)); } void