Verify byte-rate scaling at multiple MTUs and multi-gigabit rates
This commit is contained in:
1 parent
6f87ea1426
commit
dd153264e1
2 files changed
+22
-4
No files matched your search
@@ -53,7 +53,7 @@
|
||||
#define EMU_QUEUE_PKTS 65 /* ~100KB at MTU 1400-1600 */
|
||||
|
||||
/* Convert raw BBR bandwidth (BW_UNIT * bytes / usec) to kbps */
|
||||
#define BW_RAW_TO_KBPS(bw) ((double)(bw) / 2097.152)
|
||||
#define BW_RAW_TO_KBPS(bw) ((double)(bw) * 8000.0 / BW_UNIT)
|
||||
|
||||
/* ===== BBR name helpers ===== */
|
||||
static const char* bbr_mode_name(uint8_t m) {
|
||||
|
||||
+21
-3
@@ -55,6 +55,24 @@ static int test_byte_rate(void) {
|
||||
PASS(); return 0;
|
||||
}
|
||||
|
||||
/* Байтовый Q16 сохраняет многогигабитные скорости; выход uint32 насыщается, а не оборачивается. */
|
||||
static int test_large_rate(void) {
|
||||
MSEG("multi-gigabit rate and pacing saturation");
|
||||
const uint32_t intervals[] = {5, 1}, expected[] = {1980000000, UINT32_MAX};
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
struct bbr s = { .now_tb = 10000 }; bbr_init(&s);
|
||||
s.mode = BBR_PROBE_BW; s.full_bw_reached = 1; s.cycle_idx = BBR_BW_PROBE_CRUISE;
|
||||
s.cycle_mstamp_tb = s.now_tb; s.probe_wait_us = 2000000;
|
||||
uint32_t cwnd = 100000, pacing = 0;
|
||||
struct bbr_rate_sample rs = { .delivered = 10000, .interval_us = intervals[i], .rtt_us = 20000,
|
||||
.acked_sacked = 1000, .tx_in_flight = 40000 };
|
||||
bbr_main(&s, &rs, &cwnd, &pacing, 1400, 40000, 0);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BBR high rate: interval_us=%u pacing=%u expected=%u", intervals[i], pacing, expected[i]);
|
||||
if (pacing != expected[i]) FAIL("high rate was truncated or wrapped");
|
||||
}
|
||||
PASS(); return 0;
|
||||
}
|
||||
|
||||
static int test_init(void)
|
||||
{
|
||||
MSEG("bbr_init — startup mode");
|
||||
@@ -77,8 +95,8 @@ static int test_startup_growth(void)
|
||||
s.init_cwnd = 4; g_cwnd = 5600; g_pacing = 0;
|
||||
uint32_t prev = g_cwnd;
|
||||
for (int r = 0; r < 4; r++) {
|
||||
s.now_tb += 10000;
|
||||
for (int a = 0; a < 5; a++) run_ack(&s, 1400, 10000, 0, 0, prev);
|
||||
// Подтверждаем целое окно за RTT: доступная полоса растёт вместе с окном, STARTUP должен её освоить.
|
||||
run_ack(&s, prev, 10000, 0, 0, prev);
|
||||
if (g_cwnd <= prev) FAIL("cwnd did not grow");
|
||||
prev = g_cwnd;
|
||||
}
|
||||
@@ -100,7 +118,6 @@ static int test_full_bw(void)
|
||||
// Mode transitions STARTUP→DRAIN→PROBE_BW might all happen in one ACK
|
||||
if (s.mode != BBR_DRAIN && s.mode != BBR_PROBE_BW) FAIL("mode not DRAIN/PROBE_BW after full_bw");
|
||||
PASS(); return 0;
|
||||
PASS(); return 0;
|
||||
}
|
||||
|
||||
static int test_loss_startup(void)
|
||||
@@ -171,6 +188,7 @@ int main(void)
|
||||
{
|
||||
debug_config_init(); debug_set_level(DEBUG_LEVEL_ERROR); debug_set_category_level(DEBUG_CATEGORY_DEBUG, DEBUG_LEVEL_INFO);
|
||||
test_byte_rate();
|
||||
test_large_rate();
|
||||
test_init();
|
||||
test_startup_growth();
|
||||
test_full_bw();
|
||||
|
||||
Reference in new issue
Block a user