Reproduce MSS-dependent BBR pacing and BDP with a dimensional regression
This commit is contained in:
1 parent
9b9a9f2e00
commit
6fec5d6d98
1 file changed
+23
@@ -2,6 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../lib/debug_config.h"
|
||||
|
||||
#define MSEG(s) do { test_total++; printf("TEST %d: %-50s ", test_total, s); fflush(stdout); } while(0)
|
||||
#define PASS() do { puts("PASS"); test_passed++; } while(0)
|
||||
@@ -34,6 +35,26 @@ static uint32_t run_ack(struct bbr* bbr, uint32_t acked, uint32_t rtt_us,
|
||||
|
||||
/* --- tests --- */
|
||||
|
||||
/* Одинаковая доставка байтов обязана давать одну скорость независимо от MTU. */
|
||||
static int test_byte_rate(void) {
|
||||
MSEG("byte rate and BDP are independent of MSS");
|
||||
const uint32_t sizes[] = {576, 1400};
|
||||
for (unsigned i = 0; i < sizeof(sizes)/sizeof(sizes[0]); 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 = 10000, .rtt_us = 20000,
|
||||
.acked_sacked = 1000, .tx_in_flight = 40000 };
|
||||
bbr_main(&s, &rs, &cwnd, &pacing, sizes[i], 40000, 0);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BBR byte sample: MSS=%u delivered=10000 interval_us=10000 pace=%u cwnd=%u",
|
||||
sizes[i], pacing, cwnd);
|
||||
if (pacing != 990000) FAIL("1MB/s delivery must produce 990000B/s cruise pacing");
|
||||
if (cwnd < 40000 || cwnd > 41000) FAIL("2*BDP plus ACK aggregation must be 40000..41000 bytes");
|
||||
}
|
||||
PASS(); return 0;
|
||||
}
|
||||
|
||||
static int test_init(void)
|
||||
{
|
||||
MSEG("bbr_init — startup mode");
|
||||
@@ -148,6 +169,8 @@ static int test_probe_rtt(void)
|
||||
|
||||
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_init();
|
||||
test_startup_growth();
|
||||
test_full_bw();
|
||||
|
||||
Reference in new issue
Block a user