The branch main has been updated by jhb:

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

commit b7caa8157602f4eb9acd2729b48ba3a0c0cdc045
Author:     John Baldwin <[email protected]>
AuthorDate: 2021-09-13 16:57:54 +0000
Commit:     John Baldwin <[email protected]>
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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to