aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2021-09-13 16:57:54 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2021-09-13 16:57:54 +0000
commitb7caa8157602f4eb9acd2729b48ba3a0c0cdc045 (patch)
tree4bba95411b1e1e1ac678ac7b541692bc6fdb14ba
parent9b1bb0aee697352b39b3efa1843f581ca29068ba (diff)
downloadsrc-b7caa8157602f4eb9acd2729b48ba3a0c0cdc045.tar.gz
src-b7caa8157602f4eb9acd2729b48ba3a0c0cdc045.zip
cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff.
This permits unindenting almost half of the function. Sponsored by: Chelsio Communications
-rw-r--r--sys/dev/cxgbe/cxgbei/icl_cxgbei.c80
1 files 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