MINOR: quic: Implement quic_conn_subscribe()

We implement ->subscribe() xprt callback which should be used only by the mux.
This commit is contained in:
Frédéric Lécaille 2021-09-20 15:23:17 +02:00 committed by Amaury Denoyelle
parent 153194f47a
commit 513b4f290a
3 changed files with 20 additions and 1 deletions

View File

@ -154,6 +154,7 @@ struct qcc {
struct list blocked_list; /* list of streams blocked for other reasons (e.g. sfctl, dep) */
struct buffer_wait buf_wait; /* wait list for buffer allocations */
struct wait_event wait_event; /* To be used if we're waiting for I/Os */
struct wait_event *subs; /* recv wait_event the mux associated is waiting on (via quic_conn_subscribe) */
struct mt_list qcs_rxbuf_wlist; /* list of streams waiting for their rxbuf */
void *ctx; /* Application layer context */
const struct qcc_app_ops *app_ops;

View File

@ -215,6 +215,8 @@ enum quic_pkt_type {
#define QUIC_EV_CONN_PTIMER (1ULL << 34)
#define QUIC_EV_CONN_SPTO (1ULL << 35)
#define QUIC_EV_CONN_BCFRMS (1ULL << 36)
#define QUIC_EV_CONN_XPRTSEND (1ULL << 37)
#define QUIC_EV_CONN_XPRTRECV (1ULL << 38)
/* Similar to kernel min()/max() definitions. */
#define QUIC_MIN(a, b) ({ \

View File

@ -102,6 +102,8 @@ static const struct trace_event quic_trace_events[] = {
{ .mask = QUIC_EV_CONN_PTIMER, .name = "ptimer", .desc = "process timer" },
{ .mask = QUIC_EV_CONN_SPTO, .name = "spto", .desc = "set PTO" },
{ .mask = QUIC_EV_CONN_BCFRMS, .name = "bcfrms", .desc = "build CRYPTO data frames" },
{ .mask = QUIC_EV_CONN_XPRTSEND, .name = "xprt_send", .desc = "sending XRPT subscription" },
{ .mask = QUIC_EV_CONN_XPRTRECV, .name = "xprt_recv", .desc = "receiving XRPT subscription" },
{ /* end */ }
};
@ -4357,7 +4359,21 @@ static size_t quic_conn_from_buf(struct connection *conn, void *xprt_ctx, const
*/
static int quic_conn_subscribe(struct connection *conn, void *xprt_ctx, int event_type, struct wait_event *es)
{
return conn_subscribe(conn, xprt_ctx, event_type, es);
struct qcc *qcc = conn->qc->qcc;
BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV));
BUG_ON(qcc->subs && qcc->subs != es);
es->events |= event_type;
qcc->subs = es;
if (event_type & SUB_RETRY_RECV)
TRACE_DEVEL("subscribe(recv)", QUIC_EV_CONN_XPRTRECV, conn, qcc);
if (event_type & SUB_RETRY_SEND)
TRACE_DEVEL("subscribe(send)", QUIC_EV_CONN_XPRTSEND, conn, qcc);
return 0;
}
/* Called from the upper layer, to unsubscribe <es> from events <event_type>.