mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: quic/pacing: implement quic_pacer engine
Extend quic_pacer engine to support pacing emission. Several functions are defined. * quic_pacing_sent_done() to notify engine about an emission of one or several datagrams * quic_pacing_expired() to check if emission should be delayed or can be conducted immediately
This commit is contained in:
parent
3e11492c99
commit
ab82fab442
@ -123,6 +123,9 @@ struct quic_cc_algo {
|
|||||||
void (*state_trace)(struct buffer *buf, const struct quic_cc *cc);
|
void (*state_trace)(struct buffer *buf, const struct quic_cc *cc);
|
||||||
void (*state_cli)(struct buffer *buf, const struct quic_cc_path *path);
|
void (*state_cli)(struct buffer *buf, const struct quic_cc_path *path);
|
||||||
void (*hystart_start_round)(struct quic_cc *cc, uint64_t pn);
|
void (*hystart_start_round)(struct quic_cc *cc, uint64_t pn);
|
||||||
|
|
||||||
|
/* Defined only if pacing is used. */
|
||||||
|
uint (*pacing_rate)(const struct quic_cc *cc);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* USE_QUIC */
|
#endif /* USE_QUIC */
|
||||||
|
@ -37,6 +37,9 @@ void quic_cc_init(struct quic_cc *cc, struct quic_cc_algo *algo, struct quic_con
|
|||||||
void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev);
|
void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev);
|
||||||
void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc);
|
void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc);
|
||||||
|
|
||||||
|
/* Pacing callbacks */
|
||||||
|
uint quic_cc_default_pacing_rate(const struct quic_cc *cc);
|
||||||
|
|
||||||
static inline const char *quic_cc_state_str(enum quic_cc_algo_state_type state)
|
static inline const char *quic_cc_state_str(enum quic_cc_algo_state_type state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@ -107,6 +110,5 @@ static inline size_t quic_cc_path_prep_data(struct quic_cc_path *path)
|
|||||||
return path->cwnd - path->prep_in_flight;
|
return path->cwnd - path->prep_in_flight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* USE_QUIC */
|
#endif /* USE_QUIC */
|
||||||
#endif /* _PROTO_QUIC_CC_H */
|
#endif /* _PROTO_QUIC_CC_H */
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
struct quic_pacer {
|
struct quic_pacer {
|
||||||
const struct quic_cc *cc; /* Congestion controler algo used for this connection */
|
const struct quic_cc *cc; /* Congestion controler algo used for this connection */
|
||||||
|
ullong next; /* Nanosecond timestamp at which the next emission should be conducted */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _HAPROXY_QUIC_PACING_T_H */
|
#endif /* _HAPROXY_QUIC_PACING_T_H */
|
||||||
|
@ -10,6 +10,11 @@ static inline void quic_pacing_init(struct quic_pacer *pacer,
|
|||||||
const struct quic_cc *cc)
|
const struct quic_cc *cc)
|
||||||
{
|
{
|
||||||
pacer->cc = cc;
|
pacer->cc = cc;
|
||||||
|
pacer->next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int quic_pacing_expired(const struct quic_pacer *pacer);
|
||||||
|
|
||||||
|
void quic_pacing_sent_done(struct quic_pacer *pacer);
|
||||||
|
|
||||||
#endif /* _HAPROXY_QUIC_PACING_H */
|
#endif /* _HAPROXY_QUIC_PACING_H */
|
||||||
|
@ -47,3 +47,10 @@ void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc)
|
|||||||
{
|
{
|
||||||
cc->algo->state_trace(buf, cc);
|
cc->algo->state_trace(buf, cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return rate in nanoseconds between each datagram emission for a smooth pacing. */
|
||||||
|
uint quic_cc_default_pacing_rate(const struct quic_cc *cc)
|
||||||
|
{
|
||||||
|
struct quic_cc_path *path = container_of(cc, struct quic_cc_path, cc);
|
||||||
|
return path->loss.srtt * 1000000 / (path->cwnd / path->mtu + 1);
|
||||||
|
}
|
||||||
|
@ -1 +1,15 @@
|
|||||||
#include <haproxy/quic_pacing.h>
|
#include <haproxy/quic_pacing.h>
|
||||||
|
|
||||||
|
#include <haproxy/quic_tx.h>
|
||||||
|
|
||||||
|
/* Returns true if <pacer> timer is expired and emission can be retried. */
|
||||||
|
int quic_pacing_expired(const struct quic_pacer *pacer)
|
||||||
|
{
|
||||||
|
return !pacer->next || pacer->next <= now_mono_time();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notify <pacer> about an emission of one datagram. */
|
||||||
|
void quic_pacing_sent_done(struct quic_pacer *pacer)
|
||||||
|
{
|
||||||
|
pacer->next = now_mono_time() + pacer->cc->algo->pacing_rate(pacer->cc);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user