initialize the congestion controller with the actual max datagram size

This commit is contained in:
Marten Seemann 2021-03-20 14:02:28 +08:00
parent 81d16a9903
commit 7feda789d2
6 changed files with 50 additions and 13 deletions

View file

@ -42,7 +42,15 @@ var _ = Describe("Cubic Sender", func() {
ackedPacketNumber = 0
clock = mockClock{}
rttStats = utils.NewRTTStats()
sender = newCubicSender(&clock, rttStats, true /*reno*/, initialCongestionWindowPackets*maxDatagramSize, MaxCongestionWindow, nil)
sender = newCubicSender(
&clock,
rttStats,
true, /*reno*/
protocol.InitialPacketSizeIPv4,
initialCongestionWindowPackets*maxDatagramSize,
MaxCongestionWindow,
nil,
)
})
SendAvailableSendWindowLen := func(packetLength protocol.ByteCount) int {
@ -310,7 +318,7 @@ var _ = Describe("Cubic Sender", func() {
It("tcp cubic reset epoch on quiescence", func() {
const maxCongestionWindow = 50
const maxCongestionWindowBytes = maxCongestionWindow * maxDatagramSize
sender = newCubicSender(&clock, rttStats, false, initialCongestionWindowPackets*maxDatagramSize, maxCongestionWindowBytes, nil)
sender = newCubicSender(&clock, rttStats, false, protocol.InitialPacketSizeIPv4, initialCongestionWindowPackets*maxDatagramSize, maxCongestionWindowBytes, nil)
numSent := SendAvailableSendWindow()
@ -450,7 +458,8 @@ var _ = Describe("Cubic Sender", func() {
})
It("slow starts up to the maximum congestion window", func() {
sender = newCubicSender(&clock, rttStats, true, initialCongestionWindowPackets*maxDatagramSize, initialMaxCongestionWindow, nil)
const initialMaxCongestionWindow = protocol.MaxCongestionWindowPackets * initialMaxDatagramSize
sender = newCubicSender(&clock, rttStats, true, protocol.InitialPacketSizeIPv4, initialCongestionWindowPackets*maxDatagramSize, initialMaxCongestionWindow, nil)
for i := 1; i < protocol.MaxCongestionWindowPackets; i++ {
sender.MaybeExitSlowStart()
@ -464,7 +473,8 @@ var _ = Describe("Cubic Sender", func() {
})
It("slow starts up to maximum congestion window, if larger packets are sent", func() {
sender = newCubicSender(&clock, rttStats, true, initialCongestionWindowPackets*maxDatagramSize, initialMaxCongestionWindow, nil)
const initialMaxCongestionWindow = protocol.MaxCongestionWindowPackets * initialMaxDatagramSize
sender = newCubicSender(&clock, rttStats, true, protocol.InitialPacketSizeIPv4, initialCongestionWindowPackets*maxDatagramSize, initialMaxCongestionWindow, nil)
const packetSize = initialMaxDatagramSize + 100
sender.SetMaxDatagramSize(packetSize)
for i := 1; i < protocol.MaxCongestionWindowPackets; i++ {
@ -479,7 +489,7 @@ var _ = Describe("Cubic Sender", func() {
It("limit cwnd increase in congestion avoidance", func() {
// Enable Cubic.
sender = newCubicSender(&clock, rttStats, false, initialCongestionWindowPackets*maxDatagramSize, MaxCongestionWindow, nil)
sender = newCubicSender(&clock, rttStats, false, protocol.InitialPacketSizeIPv4, initialCongestionWindowPackets*maxDatagramSize, MaxCongestionWindow, nil)
numSent := SendAvailableSendWindow()
// Make sure we fall out of slow start.