Don't Double CWND Reduction in Persistent Congestion
@@ -224,7 +224,8 @@ CubicCongestionControlUpdateBlockedState(
_IRQL_requires_max_(DISPATCH_LEVEL)
void
CubicCongestionControlOnCongestionEvent(
- _In_ QUIC_CONGESTION_CONTROL* Cc
+ _In_ QUIC_CONGESTION_CONTROL* Cc,
+ _In_ BOOLEAN IsPersistentCongestion
)
{
QUIC_CONGESTION_CONTROL_CUBIC* Cubic = &Cc->Cubic;
@@ -251,6 +252,27 @@ CubicCongestionControlOnCongestionEvent(
Cubic->PrevCongestionWindow = Cubic->CongestionWindow;
Cubic->PrevAimdWindow = Cubic->AimdWindow;
+ if (IsPersistentCongestion && !Cubic->IsInPersistentCongestion) {
+
+ CXPLAT_DBG_ASSERT(!Cubic->IsInPersistentCongestion);
+ QuicTraceEvent(
+ ConnPersistentCongestion,
+ "[conn][%p] Persistent congestion event",
+ Connection);
+ Connection->Stats.Send.PersistentCongestionCount++;
+
+ Cubic->IsInPersistentCongestion = TRUE;
+ Cubic->WindowMax =
+ Cubic->WindowLastMax =
+ Cubic->SlowStartThreshold =
+ Cubic->AimdWindow =
+ Cubic->CongestionWindow * TEN_TIMES_BETA_CUBIC / 10;
+ Cubic->CongestionWindow =
+ DatagramPayloadLength * QUIC_PERSISTENT_CONGESTION_WINDOW_PACKETS;
+ Cubic->KCubic = 0;
+
+ } else {
+
Cubic->WindowMax = Cubic->CongestionWindow;
if (Cubic->WindowLastMax > Cubic->WindowMax) {
//
@@ -284,33 +306,6 @@ CubicCongestionControlOnCongestionEvent(
(uint32_t)DatagramPayloadLength * QUIC_PERSISTENT_CONGESTION_WINDOW_PACKETS,
Cubic->CongestionWindow * TEN_TIMES_BETA_CUBIC / 10);
}
-
-_IRQL_requires_max_(DISPATCH_LEVEL)
-void
-CubicCongestionControlOnPersistentCongestionEvent(
- _In_ QUIC_CONGESTION_CONTROL* Cc
- )
-{
- QUIC_CONGESTION_CONTROL_CUBIC* Cubic = &Cc->Cubic;
-
- QUIC_CONNECTION* Connection = QuicCongestionControlGetConnection(Cc);
- const uint16_t DatagramPayloadLength =
- QuicPathGetDatagramPayloadSize(&Connection->Paths[0]);
- QuicTraceEvent(
- ConnPersistentCongestion,
- "[conn][%p] Persistent congestion event",
- Connection);
- Connection->Stats.Send.PersistentCongestionCount++;
-
- Cubic->IsInPersistentCongestion = TRUE;
- Cubic->WindowMax =
- Cubic->WindowLastMax =
- Cubic->SlowStartThreshold =
- Cubic->AimdWindow =
- Cubic->CongestionWindow * TEN_TIMES_BETA_CUBIC / 10;
- Cubic->CongestionWindow =
- DatagramPayloadLength * QUIC_PERSISTENT_CONGESTION_WINDOW_PACKETS;
- Cubic->KCubic = 0;
}
_IRQL_requires_max_(PASSIVE_LEVEL)
@@ -558,11 +553,9 @@ CubicCongestionControlOnDataLost(
LossEvent->LargestPacketNumberLost > Cubic->RecoverySentPacketNumber) {
Cubic->RecoverySentPacketNumber = LossEvent->LargestPacketNumberSent;
- CubicCongestionControlOnCongestionEvent(Cc);
-
- if (LossEvent->PersistentCongestion && !Cubic->IsInPersistentCongestion) {
- CubicCongestionControlOnPersistentCongestionEvent(Cc);
- }
+ CubicCongestionControlOnCongestionEvent(
+ Cc,
+ LossEvent->PersistentCongestion);
}
CXPLAT_DBG_ASSERT(Cubic->BytesInFlight >= LossEvent->NumRetransmittableBytes);
