Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/tom/t4_cpl_io.c
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | send_flowc_wr(struct toepcb *toep, struct tcpcb *tp) | ||||
KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT), | KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT), | ||||
("%s: flowc for tid %u sent already", __func__, toep->tid)); | ("%s: flowc for tid %u sent already", __func__, toep->tid)); | ||||
if (tp != NULL) | if (tp != NULL) | ||||
nparams = 8; | nparams = 8; | ||||
else | else | ||||
nparams = 6; | nparams = 6; | ||||
if (ulp_mode(toep) == ULP_MODE_TLS) | |||||
nparams++; | |||||
if (toep->tls.fcplenmax != 0) | |||||
nparams++; | |||||
if (toep->params.tc_idx != -1) { | if (toep->params.tc_idx != -1) { | ||||
MPASS(toep->params.tc_idx >= 0 && | MPASS(toep->params.tc_idx >= 0 && | ||||
toep->params.tc_idx < sc->params.nsched_cls); | toep->params.tc_idx < sc->params.nsched_cls); | ||||
nparams++; | nparams++; | ||||
} | } | ||||
flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); | flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); | ||||
Show All 30 Lines | if (tp) { | ||||
FLOWC_PARAM(RCVNXT, tp->rcv_nxt); | FLOWC_PARAM(RCVNXT, tp->rcv_nxt); | ||||
} else | } else | ||||
FLOWC_PARAM(MSS, 512); | FLOWC_PARAM(MSS, 512); | ||||
CTR6(KTR_CXGBE, | CTR6(KTR_CXGBE, | ||||
"%s: tid %u, mss %u, sndbuf %u, snd_nxt 0x%x, rcv_nxt 0x%x", | "%s: tid %u, mss %u, sndbuf %u, snd_nxt 0x%x, rcv_nxt 0x%x", | ||||
__func__, toep->tid, toep->params.emss, toep->params.sndbuf, | __func__, toep->tid, toep->params.emss, toep->params.sndbuf, | ||||
tp ? tp->snd_nxt : 0, tp ? tp->rcv_nxt : 0); | tp ? tp->snd_nxt : 0, tp ? tp->rcv_nxt : 0); | ||||
if (ulp_mode(toep) == ULP_MODE_TLS) | |||||
FLOWC_PARAM(ULP_MODE, ulp_mode(toep)); | |||||
if (toep->tls.fcplenmax != 0) | |||||
FLOWC_PARAM(TXDATAPLEN_MAX, toep->tls.fcplenmax); | |||||
if (toep->params.tc_idx != -1) | if (toep->params.tc_idx != -1) | ||||
FLOWC_PARAM(SCHEDCLASS, toep->params.tc_idx); | FLOWC_PARAM(SCHEDCLASS, toep->params.tc_idx); | ||||
#undef FLOWC_PARAM | #undef FLOWC_PARAM | ||||
KASSERT(paramidx == nparams, ("nparams mismatch")); | KASSERT(paramidx == nparams, ("nparams mismatch")); | ||||
txsd->tx_credits = howmany(flowclen, 16); | txsd->tx_credits = howmany(flowclen, 16); | ||||
txsd->plen = 0; | txsd->plen = 0; | ||||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | make_established(struct toepcb *toep, uint32_t iss, uint32_t irs, uint16_t opt) | ||||
tp->snd_una = iss + 1; | tp->snd_una = iss + 1; | ||||
tp->snd_nxt = iss + 1; | tp->snd_nxt = iss + 1; | ||||
tp->snd_max = iss + 1; | tp->snd_max = iss + 1; | ||||
assign_rxopt(tp, tcpopt); | assign_rxopt(tp, tcpopt); | ||||
send_flowc_wr(toep, tp); | send_flowc_wr(toep, tp); | ||||
soisconnected(so); | soisconnected(so); | ||||
if (ulp_mode(toep) == ULP_MODE_TLS) | |||||
tls_establish(toep); | |||||
} | } | ||||
int | int | ||||
send_rx_credits(struct adapter *sc, struct toepcb *toep, int credits) | send_rx_credits(struct adapter *sc, struct toepcb *toep, int credits) | ||||
{ | { | ||||
struct wrqe *wr; | struct wrqe *wr; | ||||
struct cpl_rx_data_ack *req; | struct cpl_rx_data_ack *req; | ||||
uint32_t dack = F_RX_DACK_CHANGE | V_RX_DACK_MODE(1); | uint32_t dack = F_RX_DACK_CHANGE | V_RX_DACK_MODE(1); | ||||
KASSERT(credits >= 0, ("%s: %d credits", __func__, credits)); | KASSERT(credits >= 0, ("%s: %d credits", __func__, credits)); | ||||
wr = alloc_wrqe(sizeof(*req), toep->ctrlq); | wr = alloc_wrqe(sizeof(*req), toep->ctrlq); | ||||
if (wr == NULL) | if (wr == NULL) | ||||
return (0); | return (0); | ||||
req = wrtod(wr); | req = wrtod(wr); | ||||
INIT_TP_WR_MIT_CPL(req, CPL_RX_DATA_ACK, toep->tid); | INIT_TP_WR_MIT_CPL(req, CPL_RX_DATA_ACK, toep->tid); | ||||
req->credit_dack = htobe32(dack | V_RX_CREDITS(credits)); | req->credit_dack = htobe32(dack | V_RX_CREDITS(credits)); | ||||
t4_wrq_tx(sc, wr); | t4_wrq_tx(sc, wr); | ||||
return (credits); | return (credits); | ||||
} | } | ||||
void | void | ||||
send_rx_modulate(struct adapter *sc, struct toepcb *toep) | |||||
{ | |||||
struct wrqe *wr; | |||||
struct cpl_rx_data_ack *req; | |||||
wr = alloc_wrqe(sizeof(*req), toep->ctrlq); | |||||
if (wr == NULL) | |||||
return; | |||||
req = wrtod(wr); | |||||
INIT_TP_WR_MIT_CPL(req, CPL_RX_DATA_ACK, toep->tid); | |||||
req->credit_dack = htobe32(F_RX_MODULATE_RX); | |||||
t4_wrq_tx(sc, wr); | |||||
} | |||||
void | |||||
t4_rcvd_locked(struct toedev *tod, struct tcpcb *tp) | t4_rcvd_locked(struct toedev *tod, struct tcpcb *tp) | ||||
{ | { | ||||
struct adapter *sc = tod->tod_softc; | struct adapter *sc = tod->tod_softc; | ||||
struct inpcb *inp = tptoinpcb(tp); | struct inpcb *inp = tptoinpcb(tp); | ||||
struct socket *so = inp->inp_socket; | struct socket *so = inp->inp_socket; | ||||
struct sockbuf *sb = &so->so_rcv; | struct sockbuf *sb = &so->so_rcv; | ||||
struct toepcb *toep = tp->t_toe; | struct toepcb *toep = tp->t_toe; | ||||
int rx_credits; | int rx_credits; | ||||
INP_WLOCK_ASSERT(inp); | INP_WLOCK_ASSERT(inp); | ||||
SOCKBUF_LOCK_ASSERT(sb); | SOCKBUF_LOCK_ASSERT(sb); | ||||
rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0; | rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0; | ||||
if (rx_credits > 0 && | if (rx_credits > 0 && | ||||
(tp->rcv_wnd <= 32 * 1024 || rx_credits >= 64 * 1024 || | (tp->rcv_wnd <= 32 * 1024 || rx_credits >= 64 * 1024 || | ||||
(rx_credits >= 16 * 1024 && tp->rcv_wnd <= 128 * 1024) || | (rx_credits >= 16 * 1024 && tp->rcv_wnd <= 128 * 1024) || | ||||
sbused(sb) + tp->rcv_wnd < sb->sb_lowat)) { | sbused(sb) + tp->rcv_wnd < sb->sb_lowat)) { | ||||
rx_credits = send_rx_credits(sc, toep, rx_credits); | rx_credits = send_rx_credits(sc, toep, rx_credits); | ||||
tp->rcv_wnd += rx_credits; | tp->rcv_wnd += rx_credits; | ||||
tp->rcv_adv += rx_credits; | tp->rcv_adv += rx_credits; | ||||
} else if (toep->flags & TPF_FORCE_CREDITS) | |||||
send_rx_modulate(sc, toep); | |||||
} | } | ||||
} | |||||
void | void | ||||
t4_rcvd(struct toedev *tod, struct tcpcb *tp) | t4_rcvd(struct toedev *tod, struct tcpcb *tp) | ||||
{ | { | ||||
struct inpcb *inp = tptoinpcb(tp); | struct inpcb *inp = tptoinpcb(tp); | ||||
struct socket *so = inp->inp_socket; | struct socket *so = inp->inp_socket; | ||||
struct sockbuf *sb = &so->so_rcv; | struct sockbuf *sb = &so->so_rcv; | ||||
▲ Show 20 Lines • Show All 1,345 Lines • ▼ Show 20 Lines | do_rx_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) | ||||
} | } | ||||
if (ulp_mode(toep) == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 && | if (ulp_mode(toep) == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 && | ||||
sbavail(sb) != 0) { | sbavail(sb) != 0) { | ||||
CTR2(KTR_CXGBE, "%s: tid %u queueing AIO task", __func__, | CTR2(KTR_CXGBE, "%s: tid %u queueing AIO task", __func__, | ||||
tid); | tid); | ||||
ddp_queue_toep(toep); | ddp_queue_toep(toep); | ||||
} | } | ||||
if (toep->flags & TPF_TLS_STARTING) | |||||
tls_received_starting_data(sc, toep, sb, len); | |||||
sorwakeup_locked(so); | sorwakeup_locked(so); | ||||
SOCKBUF_UNLOCK_ASSERT(sb); | SOCKBUF_UNLOCK_ASSERT(sb); | ||||
if (ulp_mode(toep) == ULP_MODE_TCPDDP) | if (ulp_mode(toep) == ULP_MODE_TCPDDP) | ||||
DDP_UNLOCK(toep); | DDP_UNLOCK(toep); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 649 Lines • Show Last 20 Lines |