mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 07:24:32 +00:00
MINOR: quic: More precise window update calculation
When in congestion avoidance state and when acknowledging an <acked> number bytes we must increase the congestion window by at most one datagram (<path->mtu>) by congestion window. So thanks to this patch we apply a ratio to the current number of acked bytes : <acked> * <path->mtu> / <cwnd>. So, when <cwnd> bytes are acked we precisely increment <cwnd> by <path->mtu>. Furthermore we take into an account the number of remaining acknowledged bytes each time we increment the window by <acked> storing their values in the algorithm struct state (->remain_acked) so that it might be take into an account at the next ACK event.
This commit is contained in:
parent
abdf4a1533
commit
0e7c9a7143
@ -76,6 +76,7 @@ union quic_cc_algo_state {
|
||||
uint64_t cwnd;
|
||||
uint64_t ssthresh;
|
||||
uint64_t recovery_start_time;
|
||||
uint64_t remain_acked;
|
||||
} nr;
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,7 @@ static int quic_cc_nr_init(struct quic_cc *cc)
|
||||
cc->algo_state.nr.cwnd = path->cwnd;
|
||||
cc->algo_state.nr.ssthresh = QUIC_CC_INFINITE_SSTHESH;
|
||||
cc->algo_state.nr.recovery_start_time = 0;
|
||||
cc->algo_state.nr.remain_acked = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -95,17 +96,20 @@ static void quic_cc_nr_ca_cb(struct quic_cc *cc, struct quic_cc_event *ev)
|
||||
path = container_of(cc, struct quic_path, cc);
|
||||
switch (ev->type) {
|
||||
case QUIC_CC_EVT_ACK:
|
||||
{
|
||||
uint64_t acked;
|
||||
/* Do not increase the congestion window in recovery period. */
|
||||
if (ev->ack.time_sent <= cc->algo_state.nr.recovery_start_time)
|
||||
goto out;
|
||||
|
||||
/* Increasing the congestion window by 1 maximum packet size by
|
||||
* congestion window.
|
||||
/* Increasing the congestion window by (acked / cwnd)
|
||||
*/
|
||||
cc->algo_state.nr.cwnd +=
|
||||
path->mtu * QUIC_MAX(1ULL, (unsigned long long)ev->ack.acked / cc->algo_state.nr.cwnd);
|
||||
acked = ev->ack.acked * path->mtu + cc->algo_state.nr.remain_acked;
|
||||
cc->algo_state.nr.remain_acked = acked % cc->algo_state.nr.cwnd;
|
||||
cc->algo_state.nr.cwnd += acked / cc->algo_state.nr.cwnd;
|
||||
path->cwnd = cc->algo_state.nr.cwnd;
|
||||
break;
|
||||
}
|
||||
|
||||
case QUIC_CC_EVT_LOSS:
|
||||
/* Do not decrease the congestion window when already in recovery period. */
|
||||
|
Loading…
Reference in New Issue
Block a user