Use the offload transmit queue to set flags on TLS connections.

Requests to modify the state of TLS connections need to be sent on the
same queue as TLS record transmit requests to ensure ordering.

However, in order to use the offload transmit queue in t4_set_tcb_field(),
the function needs to be updated to do proper flow control / credit
management when queueing a request to an offload queue.  This required
passing a pointer to the toepcb itself to this function, so while here
remove the 'tid' and 'iqid' parameters and obtain those values from the
toepcb in t4_set_tcb_field() itself.

Submitted by:	Harsh Jain @ Chelsio (original version)
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D14871
This commit is contained in:
jhb 2018-03-27 20:54:57 +00:00
parent 308f791e1c
commit c679dc89bc
6 changed files with 31 additions and 21 deletions

View File

@ -589,9 +589,9 @@ set_ulp_mode_iscsi(struct adapter *sc, struct toepcb *toep, int hcrc, int dcrc)
CTR4(KTR_CXGBE, "%s: tid %u, ULP_MODE_ISCSI, CRC hdr=%d data=%d",
__func__, toep->tid, hcrc, dcrc);
t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_ULP_TYPE,
t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_ULP_TYPE,
V_TCB_ULP_TYPE(M_TCB_ULP_TYPE) | V_TCB_ULP_RAW(M_TCB_ULP_RAW), val,
0, 0, toep->ofld_rxq->iq.abs_id);
0, 0);
}
/*

View File

@ -1934,14 +1934,14 @@ do_set_tcb_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
}
void
t4_set_tcb_field(struct adapter *sc, struct sge_wrq *wrq, int tid,
uint16_t word, uint64_t mask, uint64_t val, int reply, int cookie, int iqid)
t4_set_tcb_field(struct adapter *sc, struct sge_wrq *wrq, struct toepcb *toep,
uint16_t word, uint64_t mask, uint64_t val, int reply, int cookie)
{
struct wrqe *wr;
struct cpl_set_tcb_field *req;
struct ofld_tx_sdesc *txsd;
MPASS((cookie & ~M_COOKIE) == 0);
MPASS((iqid & ~M_QUEUENO) == 0);
wr = alloc_wrqe(sizeof(*req), wrq);
if (wr == NULL) {
@ -1950,13 +1950,26 @@ t4_set_tcb_field(struct adapter *sc, struct sge_wrq *wrq, int tid,
}
req = wrtod(wr);
INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, tid);
req->reply_ctrl = htobe16(V_QUEUENO(iqid));
INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, toep->tid);
req->reply_ctrl = htobe16(V_QUEUENO(toep->ofld_rxq->iq.abs_id));
if (reply == 0)
req->reply_ctrl |= htobe16(F_NO_REPLY);
req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(cookie));
req->mask = htobe64(mask);
req->val = htobe64(val);
if ((wrq->eq.flags & EQ_TYPEMASK) == EQ_OFLD) {
txsd = &toep->txsd[toep->txsd_pidx];
txsd->tx_credits = howmany(sizeof(*req), 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);
}

View File

@ -811,14 +811,13 @@ enable_ddp(struct adapter *sc, struct toepcb *toep)
DDP_ASSERT_LOCKED(toep);
toep->ddp.flags |= DDP_SC_REQ;
t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_RX_DDP_FLAGS,
t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_RX_DDP_FLAGS,
V_TF_DDP_OFF(1) | V_TF_DDP_INDICATE_OUT(1) |
V_TF_DDP_BUF0_INDICATE(1) | V_TF_DDP_BUF1_INDICATE(1) |
V_TF_DDP_BUF0_VALID(1) | V_TF_DDP_BUF1_VALID(1),
V_TF_DDP_BUF0_INDICATE(1) | V_TF_DDP_BUF1_INDICATE(1), 0, 0,
toep->ofld_rxq->iq.abs_id);
t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_T_FLAGS,
V_TF_RCV_COALESCE_ENABLE(1), 0, 0, 0, toep->ofld_rxq->iq.abs_id);
V_TF_DDP_BUF0_INDICATE(1) | V_TF_DDP_BUF1_INDICATE(1), 0, 0);
t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_T_FLAGS,
V_TF_RCV_COALESCE_ENABLE(1), 0, 0, 0);
}
static int
@ -1868,10 +1867,9 @@ t4_aio_cancel_active(struct kaiocb *job)
*/
valid_flag = i == 0 ? V_TF_DDP_BUF0_VALID(1) :
V_TF_DDP_BUF1_VALID(1);
t4_set_tcb_field(sc, toep->ctrlq, toep->tid,
t4_set_tcb_field(sc, toep->ctrlq, toep,
W_TCB_RX_DDP_FLAGS, valid_flag, 0, 1,
i + DDP_BUF0_INVALIDATED,
toep->ofld_rxq->iq.abs_id);
i + DDP_BUF0_INVALIDATED);
toep->ddp.db[i].cancel_pending = 1;
CTR2(KTR_CXGBE, "%s: request %p marked pending",
__func__, job);

View File

@ -68,8 +68,7 @@ t4_set_tls_tcb_field(struct toepcb *toep, uint16_t word, uint64_t mask,
{
struct adapter *sc = td_adapter(toep->td);
t4_set_tcb_field(sc, toep->ctrlq, toep->tid, word, mask, val, 0, 0,
toep->ofld_rxq->iq.abs_id);
t4_set_tcb_field(sc, toep->ofld_txq, toep, word, mask, val, 0, 0);
}
/* TLS and DTLS common routines */

View File

@ -392,9 +392,9 @@ t4_ctloutput(struct toedev *tod, struct tcpcb *tp, int dir, int name)
case TCP_NODELAY:
if (tp->t_state != TCPS_ESTABLISHED)
break;
t4_set_tcb_field(sc, toep->ctrlq, toep->tid, W_TCB_T_FLAGS,
t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_T_FLAGS,
V_TF_NAGLE(1), V_TF_NAGLE(tp->t_flags & TF_NODELAY ? 0 : 1),
0, 0, toep->ofld_rxq->iq.abs_id);
0, 0);
break;
default:
break;

View File

@ -384,8 +384,8 @@ void t4_rcvd_locked(struct toedev *, struct tcpcb *);
int t4_tod_output(struct toedev *, struct tcpcb *);
int t4_send_fin(struct toedev *, struct tcpcb *);
int t4_send_rst(struct toedev *, struct tcpcb *);
void t4_set_tcb_field(struct adapter *, struct sge_wrq *, int, uint16_t,
uint64_t, uint64_t, int, int, int);
void t4_set_tcb_field(struct adapter *, struct sge_wrq *, struct toepcb *,
uint16_t, uint64_t, uint64_t, int, int);
void t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop);
void t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop);
int do_set_tcb_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *);