Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes Reno CC slightly loss tolerant #445

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/quicly/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ typedef struct st_quicly_cc_t {
* Stash of acknowledged bytes, used during congestion avoidance.
*/
uint32_t stash;
/**
* Number of losses seen in a recovery episode.
*/
uint32_t num_lost_in_episode;
} reno;
/**
* State information for CUBIC congestion control.
Expand Down
26 changes: 21 additions & 5 deletions lib/cc-reno.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@

#define QUICLY_MIN_CWND 2
#define QUICLY_RENO_BETA 0.7
#define QUICLY_RENO_LOSS_THRESHOLD 2

/* TODO: Avoid increase if sender was application limited. */
static void reno_on_acked(quicly_cc_t *cc, const quicly_loss_t *loss, uint32_t bytes, uint64_t largest_acked, uint32_t inflight,
int64_t now, uint32_t max_udp_payload_size)
{
assert(inflight >= bytes);
/* Do not increase congestion window while in recovery. */
if (largest_acked < cc->recovery_end)
/* Do not increase congestion window while in recovery and if number of
* losses in this episode has met the threshold. */
if (largest_acked < cc->recovery_end &&
cc->state.reno.num_lost_in_episode >= QUICLY_RENO_LOSS_THRESHOLD)
return;

/* Slow start. */
Expand All @@ -56,10 +59,23 @@ static void reno_on_acked(quicly_cc_t *cc, const quicly_loss_t *loss, uint32_t b
static void reno_on_lost(quicly_cc_t *cc, const quicly_loss_t *loss, uint32_t bytes, uint64_t lost_pn, uint64_t next_pn,
int64_t now, uint32_t max_udp_payload_size)
{
/* Nothing to do if loss is in recovery window. */
if (lost_pn < cc->recovery_end)
/* Set up state if new recovery episode. */
if (lost_pn >= cc->recovery_end) {
cc->recovery_end = next_pn;
cc->state.reno.num_lost_in_episode = 0;
}

cc->state.reno.num_lost_in_episode++;

/* Nothing to do if number of losses in this recovery episode is below a
* threshold. Doing so builds some tolerance for loss, by only responding
* with a congestion action if the number of losses in a window is greater
* than the threshold. Similarly, there should be only one reduction in a
* window, so nothing to do if number of losses is greater than the
* threshold.
*/
if (cc->state.reno.num_lost_in_episode != QUICLY_RENO_LOSS_THRESHOLD)
return;
cc->recovery_end = next_pn;

++cc->num_loss_episodes;
if (cc->cwnd_exiting_slow_start == 0)
Expand Down