From 231c237d933e53a56ec56d6cd156101b3323f49e Mon Sep 17 00:00:00 2001 From: Christian Huitema Date: Thu, 8 Feb 2024 18:09:17 -0800 Subject: [PATCH] Add test for high and low bdp seed --- PerfAndStressTest/PerfAndStressTest.cpp | 14 +++++++++++ picoquic/bbr.c | 28 ++++++++++----------- picoquic_t/picoquic_t.c | 2 ++ picoquictest/picoquictest.h | 2 ++ picoquictest/tls_api_test.c | 33 +++++++++++++++++++++++-- 5 files changed, 62 insertions(+), 17 deletions(-) diff --git a/PerfAndStressTest/PerfAndStressTest.cpp b/PerfAndStressTest/PerfAndStressTest.cpp index 8ac8494ff..3f391b70c 100644 --- a/PerfAndStressTest/PerfAndStressTest.cpp +++ b/PerfAndStressTest/PerfAndStressTest.cpp @@ -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(); diff --git a/picoquic/bbr.c b/picoquic/bbr.c index 98c91f658..0b14d978b 100644 --- a/picoquic/bbr.c +++ b/picoquic/bbr.c @@ -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" @@ -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) { @@ -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); } } diff --git a/picoquic_t/picoquic_t.c b/picoquic_t/picoquic_t.c index f1fb35ccc..66801a90f 100644 --- a/picoquic_t/picoquic_t.c +++ b/picoquic_t/picoquic_t.c @@ -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 }, diff --git a/picoquictest/picoquictest.h b/picoquictest/picoquictest.h index ca322f310..6e10eeeac 100644 --- a/picoquictest/picoquictest.h +++ b/picoquictest/picoquictest.h @@ -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(); diff --git a/picoquictest/tls_api_test.c b/picoquictest/tls_api_test.c index b89fac070..5b8701583 100644 --- a/picoquictest/tls_api_test.c +++ b/picoquictest/tls_api_test.c @@ -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) @@ -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) { @@ -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", @@ -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() {