Skip to content

Commit 1608cb3

Browse files
committed
MINOR: quic/pacing: add burst support
qc_send_mux() has been extended previously to support pacing emission. This will ensure that no more than one datagram will be emitted during each invokation. However, to achieve better performance, it may be necessary to emit a batch of several datagrams one one turn. A so-called burst value can be specified by the user in the configuration. However, some congestion control algos may defined their owned dynamic value. As such, a new CC callback pacing_burst is defined. quic_cc_default_pacing_burst() can be used for algo without pacing interaction, such as cubic. It will returns a static value based on user selected configuration.
1 parent 2e44d41 commit 1608cb3

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

include/haproxy/quic_cc-t.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ struct quic_cc_path {
113113
uint64_t in_flight;
114114
/* Number of in flight ack-eliciting packets. */
115115
uint64_t ifae_pkts;
116+
/* Burst size if pacing is used. Not used if congestion algo handle pacing itself. */
117+
uint32_t pacing_burst;
116118
};
117119

118120
struct quic_cc_algo {
@@ -124,6 +126,7 @@ struct quic_cc_algo {
124126
void (*state_cli)(struct buffer *buf, const struct quic_cc_path *path);
125127
void (*hystart_start_round)(struct quic_cc *cc, uint64_t pn);
126128
uint (*pacing_rate)(const struct quic_cc *cc);
129+
uint (*pacing_burst)(const struct quic_cc *cc);
127130
};
128131

129132
#endif /* USE_QUIC */

include/haproxy/quic_cc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,12 @@ static inline uint quic_cc_default_pacing_rate(const struct quic_cc *cc)
113113
return path->loss.srtt * 1000000 / (path->cwnd / path->mtu + 1);
114114
}
115115

116+
static inline uint quic_cc_default_pacing_burst(const struct quic_cc *cc)
117+
{
118+
struct quic_cc_path *path = container_of(cc, struct quic_cc_path, cc);
119+
const uint ns_pkts = cc->algo->pacing_rate(cc);
120+
return path->pacing_burst * 1000000 / (ns_pkts + 1) + 1;
121+
}
122+
116123
#endif /* USE_QUIC */
117124
#endif /* _PROTO_QUIC_CC_H */

include/haproxy/quic_pacing.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ static inline void quic_pacing_init(struct quic_pacer *pacer,
1717

1818
int quic_pacing_expired(const struct quic_pacer *pacer);
1919

20-
21-
void quic_pacing_sent_done(struct quic_pacer *pacer);
20+
void quic_pacing_sent_done(struct quic_pacer *pacer, int sent);
2221

2322
enum quic_tx_err quic_pacing_send(struct quic_pacer *pacer, struct quic_conn *qc);
2423

src/quic_pacing.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ int quic_pacing_expired(const struct quic_pacer *pacer)
88
return !pacer->next || pacer->next <= now_mono_time();
99
}
1010

11-
/* Notify <pacer> about an emission of one datagram. */
12-
void quic_pacing_sent_done(struct quic_pacer *pacer)
11+
/* Notify <pacer> about an emission of <sent> count of datagrams. */
12+
void quic_pacing_sent_done(struct quic_pacer *pacer, int sent)
1313
{
14-
pacer->next = now_mono_time() + pacer->cc->algo->pacing_rate(pacer->cc);
14+
pacer->next = now_mono_time() + pacer->cc->algo->pacing_rate(pacer->cc) * sent;
1515
}
1616

1717
/* Restart emission after <pacer> has delayed some frames on <qc> connection.

src/quic_tx.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,10 @@ enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms,
494494
qc_send(qc, 0, &send_list, 0);
495495
}
496496

497-
if (pacer)
498-
max_dgram = 1;
497+
if (pacer) {
498+
max_dgram = qc->path->cc.algo->pacing_burst(&qc->path->cc);
499+
BUG_ON(max_dgram <= 0); /* pacer must specify a positive burst value. */
500+
}
499501

500502
TRACE_STATE("preparing data (from MUX)", QUIC_EV_CONN_TXPKT, qc);
501503
qel_register_send(&send_list, qc->ael, frms);
@@ -504,10 +506,10 @@ enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms,
504506
ret = QUIC_TX_ERR_FATAL;
505507
}
506508
else if (pacer) {
507-
BUG_ON(sent > 1); /* burst not yet supported for pacing */
508-
if (!LIST_ISEMPTY(frms))
509+
BUG_ON(sent > max_dgram); /* Must not exceed pacing limit. */
510+
if (max_dgram == sent && !LIST_ISEMPTY(frms))
509511
ret = QUIC_TX_ERR_AGAIN;
510-
quic_pacing_sent_done(pacer);
512+
quic_pacing_sent_done(pacer, sent);
511513
}
512514

513515
TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc);

0 commit comments

Comments
 (0)