Skip to content

Commit

Permalink
Add test for high and low bdp seed
Browse files Browse the repository at this point in the history
  • Loading branch information
huitema committed Feb 9, 2024
1 parent 0c21106 commit 231c237
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 17 deletions.
14 changes: 14 additions & 0 deletions PerfAndStressTest/PerfAndStressTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ namespace PerfAndStressTest
Assert::AreEqual(ret, 0);
}

TEST_METHOD(bdp_short_hi)
{
int ret = bdp_short_hi_test();

Assert::AreEqual(ret, 0);
}

TEST_METHOD(bdp_short_lo)
{
int ret = bdp_short_lo_test();

Assert::AreEqual(ret, 0);
}

TEST_METHOD(stress)
{
int ret = stress_test();
Expand Down
28 changes: 13 additions & 15 deletions picoquic/bbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ static void BBRCheckStartupFullBandwidthGeneric(picoquic_bbr_state_t* bbr_state,
}
}

static void BBRCheckEnterStartupResume(picoquic_bbr_state_t* bbr_state)
static void BBREnterStartupResume(picoquic_bbr_state_t* bbr_state)
{
/* This code is called either when the "bdp seed" is set, or
* upon "Enter Startup"
Expand All @@ -1528,24 +1528,22 @@ static void BBRCheckStartupResume(picoquic_bbr_state_t* bbr_state, picoquic_path
{
if (bbr_state->state == picoquic_bbr_alg_startup_resume) {
BBRCheckStartupHighLoss(bbr_state, path_x, rs);
BBRCheckStartupFullBandwidthGeneric(bbr_state, rs, BBRStartupResumeIncreaseThreshold);
if (bbr_state->filled_pipe) {
if (bbr_state->full_bw_count > 0) {
bbr_state->probe_probe_bw_quickly = 1;
bbr_state->full_bw_count = 0;
if (!bbr_state->filled_pipe && (double)bbr_state->max_bw > BBRStartupResumeIncreaseThreshold * bbr_state->bdp_seed) {
BBREnterStartup(bbr_state);
}
else {
BBRCheckStartupFullBandwidthGeneric(bbr_state, rs, BBRStartupResumeIncreaseThreshold);
if (bbr_state->filled_pipe) {
if (bbr_state->full_bw_count > 0) {
bbr_state->probe_probe_bw_quickly = 1;
bbr_state->full_bw_count = 0;
}
BBREnterDrain(bbr_state, path_x, current_time);
}
BBREnterDrain(bbr_state, path_x, current_time);
}
}
}

static void BBREnterStartupResume(picoquic_bbr_state_t* bbr_state)
{
bbr_state->state = picoquic_bbr_alg_startup_resume;
bbr_state->pacing_gain = BBRStartupResumePacingGain;
bbr_state->cwnd_gain = BBRStartupResumeCwndGain;
}

/* Startup specific processes for BBRv3 */
static void BBRCheckStartupHighLoss(picoquic_bbr_state_t* bbr_state, picoquic_path_t * path_x, bbr_per_ack_state_t * rs)
{
Expand Down Expand Up @@ -1715,7 +1713,7 @@ void BBRSetBdpSeed(picoquic_bbr_state_t* bbr_state, uint64_t bdp_seed)
bbr_state->bdp_seed = bdp_seed;
if (bbr_state->state == picoquic_bbr_alg_startup &&
bbr_state->bdp_seed > bbr_state->max_bw) {
BBRCheckEnterStartupResume(bbr_state);
BBREnterStartupResume(bbr_state);
}
}

Expand Down
2 changes: 2 additions & 0 deletions picoquic_t/picoquic_t.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ static const picoquic_test_def_t test_table[] = {
{ "bdp_cubic", bdp_cubic_test },
#endif
{ "bdp_short", bdp_short_test },
{ "bdp_short_hi", bdp_short_hi_test },
{ "bdp_short_lo", bdp_short_lo_test },
{ "cid_length", cid_length_test },
{ "optimistic_ack", optimistic_ack_test },
{ "optimistic_hole", optimistic_hole_test },
Expand Down
2 changes: 2 additions & 0 deletions picoquictest/picoquictest.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ int bdp_rtt_test();
int bdp_ip_test();
int bdp_delay_test();
int bdp_short_test();
int bdp_short_hi_test();
int bdp_short_lo_test();
int long_rtt_test();
int high_latency_basic_test();
int high_latency_bbr_test();
Expand Down
33 changes: 31 additions & 2 deletions picoquictest/tls_api_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -12506,7 +12506,9 @@ typedef enum {
bdp_test_option_delay,
bdp_test_option_reno,
bdp_test_option_cubic,
bdp_test_option_short
bdp_test_option_short,
bdp_test_option_short_lo,
bdp_test_option_short_hi,
} bdp_test_option_enum;

int bdp_option_test_one(bdp_test_option_enum bdp_test_option)
Expand Down Expand Up @@ -12546,12 +12548,27 @@ int bdp_option_test_one(bdp_test_option_enum bdp_test_option)
test_ctx->c_to_s_link->picosec_per_byte = (1000000ull * 8) / 20;
test_ctx->s_to_c_link->picosec_per_byte = (1000000ull * 8) / 20;

if (bdp_test_option == bdp_test_option_short) {
if (bdp_test_option == bdp_test_option_short ||
bdp_test_option == bdp_test_option_short_lo ||
bdp_test_option == bdp_test_option_short_hi) {
/* Test that the BDP option also works well if delay < 250 ms */
max_completion_time = 4500000;
test_ctx->c_to_s_link->microsec_latency = 100000ull;
test_ctx->s_to_c_link->microsec_latency = 100000ull;
buffer_size = 2 * test_ctx->c_to_s_link->microsec_latency;
if (i == 0) {
if (bdp_test_option == bdp_test_option_short_lo) {
test_ctx->c_to_s_link->picosec_per_byte *= 2;
test_ctx->s_to_c_link->picosec_per_byte *= 2;
}
else if (bdp_test_option == bdp_test_option_short_hi) {
test_ctx->c_to_s_link->picosec_per_byte /= 2;
test_ctx->s_to_c_link->picosec_per_byte /= 2;
}
}
else if (i == 1 && bdp_test_option == bdp_test_option_short_lo) {
max_completion_time = 4650000;
}
}
else if (i > 0) {
switch (bdp_test_option) {
Expand Down Expand Up @@ -12646,6 +12663,8 @@ int bdp_option_test_one(bdp_test_option_enum bdp_test_option)
else if (bdp_test_option == bdp_test_option_basic ||
bdp_test_option == bdp_test_option_reno ||
bdp_test_option == bdp_test_option_short ||
bdp_test_option == bdp_test_option_short_hi ||
bdp_test_option == bdp_test_option_short_lo ||
bdp_test_option == bdp_test_option_cubic) {
if (!test_ctx->cnx_server->cwin_notified_from_seed) {
DBG_PRINTF("BDP RTT test (bdp test: %d), cnx %d, cwin not seed on server.\n",
Expand Down Expand Up @@ -12726,6 +12745,16 @@ int bdp_short_test()
return bdp_option_test_one(bdp_test_option_short);
}

int bdp_short_hi_test()
{
return bdp_option_test_one(bdp_test_option_short_hi);
}

int bdp_short_lo_test()
{
return bdp_option_test_one(bdp_test_option_short_lo);
}

#if defined(_WINDOWS) && !defined(_WINDOWS64)
int bdp_cubic_test()
{
Expand Down

0 comments on commit 231c237

Please sign in to comment.