MINOR: quic: simplify rescheduling for handshake

On CRYPTO frames reception, tasklet is rescheduled with TASK_HEAVY to
limit CPU consumption. This commit slighly simplifies this by regrouping
TASK_HEAVY setting and tasklet_wakeup() instructions in a single
location in qc_handle_crypto_frm(). All other unnecessary
tasklet_wakeup() are removed.
This commit is contained in:
Amaury Denoyelle 2024-03-08 17:40:16 +01:00
parent 6770259083
commit b068e758fb
2 changed files with 5 additions and 16 deletions

View File

@ -753,8 +753,8 @@ struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state)
TRACE_PROTO("connection state", QUIC_EV_CONN_IO_CB, qc, &st);
if (HA_ATOMIC_LOAD(&tl->state) & TASK_HEAVY) {
HA_ATOMIC_AND(&tl->state, ~TASK_HEAVY);
qc_ssl_provide_all_quic_data(qc, qc->xprt_ctx);
HA_ATOMIC_AND(&tl->state, ~TASK_HEAVY);
}
/* Retranmissions */
@ -771,11 +771,6 @@ struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state)
if (!qc_treat_rx_pkts(qc))
goto out;
if (HA_ATOMIC_LOAD(&tl->state) & TASK_HEAVY) {
tasklet_wakeup(tl);
goto out;
}
if (qc->flags & QUIC_FL_CONN_TO_KILL) {
TRACE_DEVEL("connection to be killed", QUIC_EV_CONN_PHPKTS, qc);
goto out;

View File

@ -740,8 +740,11 @@ static int qc_handle_crypto_frm(struct quic_conn *qc,
goto leave;
}
if (ncb_data(ncbuf, 0))
/* Reschedule with TASK_HEAVY if CRYPTO data ready for decoding. */
if (ncb_data(ncbuf, 0)) {
HA_ATOMIC_OR(&qc->wait_event.tasklet->state, TASK_HEAVY);
tasklet_wakeup(qc->wait_event.tasklet);
}
done:
ret = 1;
@ -1325,15 +1328,6 @@ int qc_treat_rx_pkts(struct quic_conn *qc)
qel->pktns->flags |= QUIC_FL_PKTNS_NEW_LARGEST_PN;
}
if (qel->cstream) {
struct ncbuf *ncbuf = &qel->cstream->rx.ncbuf;
if (!ncb_is_null(ncbuf) && ncb_data(ncbuf, 0)) {
/* Some in order CRYPTO data were bufferized. */
HA_ATOMIC_OR(&qc->wait_event.tasklet->state, TASK_HEAVY);
}
}
/* Release the Initial encryption level and packet number space. */
if ((qc->flags & QUIC_FL_CONN_IPKTNS_DCD) && qel == qc->iel) {
qc_enc_level_free(qc, &qc->iel);