dcsctp: implement congestion control errata
When re-reading through the errata for RFC4960 in RFC8540, it was found
that two erratas were not applied to dcSCTP:
https://datatracker.ietf.org/doc/html/rfc8540#section-3.11
https://datatracker.ietf.org/doc/html/rfc8540#section-3.12
They are now applied. Re-running throughput tests show no difference.
Bug: webrtc:12943
Change-Id: I9d73d0d257eab8442954924dc414d8efa2c41e8b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232221
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35024}
diff --git a/net/dcsctp/tx/retransmission_queue.cc b/net/dcsctp/tx/retransmission_queue.cc
index b1b9afb..57154b3 100644
--- a/net/dcsctp/tx/retransmission_queue.cc
+++ b/net/dcsctp/tx/retransmission_queue.cc
@@ -274,8 +274,10 @@
// data outstanding (i.e., before arrival of the SACK, flightsize was
// greater than or equal to cwnd), increase cwnd by MTU, and reset
// partial_bytes_acked to (partial_bytes_acked - cwnd)."
- cwnd_ += options_.mtu;
+
+ // Errata: https://datatracker.ietf.org/doc/html/rfc8540#section-3.12
partial_bytes_acked_ -= cwnd_;
+ cwnd_ += options_.mtu;
RTC_DLOG(LS_VERBOSE) << log_prefix_ << "CA increase cwnd=" << cwnd_
<< " (" << old_cwnd << ") ssthresh=" << ssthresh_
<< ", pba=" << partial_bytes_acked_ << " ("
@@ -488,6 +490,8 @@
// its ssthresh with rules defined in Section 7.2.3 and set the cwnd <- MTU."
ssthresh_ = std::max(cwnd_ / 2, 4 * options_.mtu);
cwnd_ = 1 * options_.mtu;
+ // Errata: https://datatracker.ietf.org/doc/html/rfc8540#section-3.11
+ partial_bytes_acked_ = 0;
// https://tools.ietf.org/html/rfc4960#section-6.3.3
// "For the destination address for which the timer expires, set RTO