support max bandwidth in congestion control

This commit is contained in:
Stephen Birarda 2015-07-31 08:57:25 -07:00
parent 6c4a36fb7f
commit 0ea1bb578f
2 changed files with 10 additions and 1 deletions

View file

@ -112,6 +112,14 @@ void DefaultCC::onACK(SequenceNumber ackNum) {
}
_packetSendPeriod = (_packetSendPeriod * synInterval()) / (_packetSendPeriod * increase + synInterval());
if (_maxBandwidth > 0) {
// anytime the packet send period is about to be increased, make sure it stays below the minimum period,
// calculated based on the maximum desired bandwidth
int minPacketSendPeriod = USECS_PER_SECOND / (double(_maxBandwidth) / _mss);
_packetSendPeriod = std::max(_packetSendPeriod, (double) minPacketSendPeriod);
}
}
void DefaultCC::onLoss(SequenceNumber rangeStart, SequenceNumber rangeEnd) {

View file

@ -47,15 +47,16 @@ protected:
void setMSS(int mss) { _mss = mss; }
void setMaxCongestionWindowSize(int window) { _maxCongestionWindowSize = window; }
void setBandwidth(int bandwidth) { _bandwidth = bandwidth; }
void setMaxBandwidth(int maxBandwidth) { _maxBandwidth = maxBandwidth; }
void setSendCurrentSequenceNumber(SequenceNumber seqNum) { _sendCurrSeqNum = seqNum; }
void setReceiveRate(int rate) { _receiveRate = rate; }
void setRTT(int rtt) { _rtt = rtt; }
double _packetSendPeriod { 1.0 }; // Packet sending period, in microseconds
double _congestionWindowSize { 16.0 }; // Congestion window size, in packets
int _bandwidth { 0 }; // estimated bandwidth, packets per second
int _maxBandwidth { -1 }; // Maximum desired bandwidth, packets per second
double _maxCongestionWindowSize { 0.0 }; // maximum cwnd size, in packets
int _mss { 0 }; // Maximum Packet Size, including all packet headers