aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cxgbe/cxgbei/icl_cxgbei.c')
-rw-r--r--sys/dev/cxgbe/cxgbei/icl_cxgbei.c96
1 files changed, 5 insertions, 91 deletions
diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
index c8592807f843..9cdfd0fb9652 100644
--- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
@@ -976,42 +976,6 @@ icl_cxgbei_setsockopt(struct icl_conn *ic, struct socket *so, int sspace,
return (0);
}
-/*
- * Request/response structure used to find out the adapter offloading a socket.
- */
-struct find_ofld_adapter_rr {
- struct socket *so;
- struct adapter *sc; /* result */
-};
-
-static void
-find_offload_adapter(struct adapter *sc, void *arg)
-{
- struct find_ofld_adapter_rr *fa = arg;
- struct socket *so = fa->so;
- struct tom_data *td = sc->tom_softc;
- struct tcpcb *tp;
- struct inpcb *inp;
-
- /* Non-TCP were filtered out earlier. */
- MPASS(so->so_proto->pr_protocol == IPPROTO_TCP);
-
- if (fa->sc != NULL)
- return; /* Found already. */
-
- if (td == NULL)
- return; /* TOE not enabled on this adapter. */
-
- inp = sotoinpcb(so);
- INP_WLOCK(inp);
- if ((inp->inp_flags & INP_DROPPED) == 0) {
- tp = intotcpcb(inp);
- if (tp->t_flags & TF_TOE && tp->tod == &td->tod)
- fa->sc = sc; /* Found. */
- }
- INP_WUNLOCK(inp);
-}
-
static bool
is_memfree(struct adapter *sc)
{
@@ -1025,46 +989,6 @@ is_memfree(struct adapter *sc)
return (true);
}
-/* XXXNP: move this to t4_tom. */
-static void
-send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen)
-{
- struct wrqe *wr;
- struct fw_flowc_wr *flowc;
- const u_int nparams = 1;
- u_int flowclen;
- struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx];
-
- flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval);
-
- wr = alloc_wrqe(roundup2(flowclen, 16), &toep->ofld_txq->wrq);
- if (wr == NULL) {
- /* XXX */
- panic("%s: allocation failure.", __func__);
- }
- flowc = wrtod(wr);
- memset(flowc, 0, wr->wr_len);
-
- flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) |
- V_FW_FLOWC_WR_NPARAMS(nparams));
- flowc->flowid_len16 = htonl(V_FW_WR_LEN16(howmany(flowclen, 16)) |
- V_FW_WR_FLOWID(toep->tid));
-
- flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX;
- flowc->mnemval[0].val = htobe32(maxlen);
-
- txsd->tx_credits = howmany(flowclen, 16);
- txsd->plen = 0;
- KASSERT(toep->tx_credits >= txsd->tx_credits && toep->txsd_avail > 0,
- ("%s: not enough credits (%d)", __func__, toep->tx_credits));
- toep->tx_credits -= txsd->tx_credits;
- if (__predict_false(++toep->txsd_pidx == toep->txsd_total))
- toep->txsd_pidx = 0;
- toep->txsd_avail--;
-
- t4_wrq_tx(sc, wr);
-}
-
static void
set_ulp_mode_iscsi(struct adapter *sc, struct toepcb *toep, u_int ulp_submode)
{
@@ -1093,7 +1017,6 @@ int
icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd)
{
struct icl_cxgbei_conn *icc = ic_to_icc(ic);
- struct find_ofld_adapter_rr fa;
struct file *fp;
struct socket *so;
struct inpcb *inp;
@@ -1137,15 +1060,11 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd)
fdrop(fp, curthread);
ICL_CONN_UNLOCK(ic);
- /* Find the adapter offloading this socket. */
- fa.sc = NULL;
- fa.so = so;
- t4_iterate(find_offload_adapter, &fa);
- if (fa.sc == NULL) {
+ icc->sc = find_offload_adapter(so);
+ if (icc->sc == NULL) {
error = EINVAL;
goto out;
}
- icc->sc = fa.sc;
max_rx_pdu_len = ISCSI_BHS_SIZE + ic->ic_max_recv_data_segment_length;
max_tx_pdu_len = ISCSI_BHS_SIZE + ic->ic_max_send_data_segment_length;
@@ -1203,7 +1122,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd)
toep->params.ulp_mode = ULP_MODE_ISCSI;
toep->ulpcb = icc;
- send_iscsi_flowc_wr(icc->sc, toep,
+ send_txdataplen_max_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);
@@ -1776,7 +1695,6 @@ cxgbei_limits(struct adapter *sc, void *arg)
static int
cxgbei_limits_fd(struct icl_drv_limits *idl, int fd)
{
- struct find_ofld_adapter_rr fa;
struct file *fp;
struct socket *so;
struct adapter *sc;
@@ -1799,17 +1717,13 @@ cxgbei_limits_fd(struct icl_drv_limits *idl, int fd)
return (EINVAL);
}
- /* Find the adapter offloading this socket. */
- fa.sc = NULL;
- fa.so = so;
- t4_iterate(find_offload_adapter, &fa);
- if (fa.sc == NULL) {
+ sc = find_offload_adapter(so);
+ if (sc == NULL) {
fdrop(fp, curthread);
return (ENXIO);
}
fdrop(fp, curthread);
- sc = fa.sc;
error = begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4lims");
if (error != 0)
return (error);