Cover probing byte budgets and ACK aggregation beyond 64KiB

This commit is contained in:
evgeny committed 2026-10-23 00:16:40 +02:00
1 parent a79c724110
commit 229e992695
1 file changed
+35
+35
View File
@@ -94,6 +94,39 @@ static int test_probe_growth_bytes(void) {
PASS(); return 0;
}
static int test_probe_packet_budget(void) {
MSEG("PROBE_UP reserves two MSS; Reno rounds use packets");
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_UP;
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, 1400, 40000, 0);
if (cwnd != 43800) FAIL("two MSS probing reserve must add 2800 bytes to 41000");
memset(&s, 0, sizeof(s)); 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.min_rtt_us = s.probe_rtt_min_us = 14000; s.has_seen_rtt = 1;
s.bw_hi[0] = BW_UNIT; s.rounds_since_probe = 9; s.cycle_mstamp_tb = s.now_tb; s.probe_wait_us = 2000000;
cwnd = 56000; pacing = 0; rs.rtt_us = 14000;
bbr_main(&s, &rs, &cwnd, &pacing, 1400, 14000, 0);
if (s.cycle_idx != BBR_BW_PROBE_REFILL) FAIL("ten-packet BDP should probe after ten packet rounds");
PASS(); return 0;
}
static int test_large_ack_aggregation(void) {
MSEG("ACK aggregation above 64KiB keeps byte precision");
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 = 300000, pacing = 0;
struct bbr_rate_sample rs = { .delivered = 80000, .interval_us = 80000, .rtt_us = 100000,
.acked_sacked = 80000, .tx_in_flight = 200000 };
bbr_main(&s, &rs, &cwnd, &pacing, 1400, 200000, 0);
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ACK aggregation: 2*BDP=200000 ACKed=80000 cwnd=%u", cwnd);
if (cwnd != 280000) FAIL("80000-byte ACK aggregation must not wrap at 65536");
PASS(); return 0;
}
static int test_init(void)
{
MSEG("bbr_init — startup mode");
@@ -211,6 +244,8 @@ int main(void)
test_byte_rate();
test_large_rate();
test_probe_growth_bytes();
test_probe_packet_budget();
test_large_ack_aggregation();
test_init();
test_startup_growth();
test_full_bw();