Commit 7f88c93b authored by Andreas Schmidt's avatar Andreas Schmidt

Update BBR.

parent 323cef5f
Pipeline #2104 failed with stages
in 22 seconds
......@@ -152,6 +152,8 @@ cdef extern from "proto/socket.h":
bint PrrtSocket_get_filled_pipe(PrrtSocket *s)
uint32_t PrrtSocket_get_cycle_index(PrrtSocket *s)
float PrrtSocket_get_pacing_gain(PrrtSocket *s)
uint32_t PrrtSocket_get_cwnd(PrrtSocket *s)
uint32_t PrrtSocket_get_inflight(PrrtSocket *s)
bint PrrtSocket_get_app_limited(PrrtSocket *socket)
......
......@@ -2,6 +2,7 @@
#include "../util/dbg.h"
#include "../util/common.h"
#include "receiver.h"
#include <math.h>
prrtByteCount_t BBR_Inflight(BBR* bbr, float gain)
......@@ -9,7 +10,7 @@ prrtByteCount_t BBR_Inflight(BBR* bbr, float gain)
if (bbr->rtprop == Inf)
return InitialCwnd; /* no valid RTT samples yet */
uint32_t quanta = 3 * bbr->send_quantum;
uint32_t estimated_bdp = (bbr->bw * bbr->rtprop) / (1000 * 1000 * 8);
uint32_t estimated_bdp = (uint32_t) round(((double)bbr->bw * bbr->rtprop) / (1000 * 1000));
return (uint32_t)(gain * estimated_bdp + quanta);
}
......@@ -30,7 +31,7 @@ void BBR_UpdateBtlBw(BBR* bbr, PrrtRateSample* rs, PrrtPacketTracking* tracking)
bbr->round_start = false;
}
if ((rs->delivery_rate >= bbr->bw || !rs->is_app_limited) && rs->delivery_rate != 0) {
bbr->bw = (uint32_t)WindowedFilter_push(bbr->btlBwFilter, (uint32_t)(rs->delivery_rate));
bbr->bw = (uint32_t)WindowedFilter_push(bbr->btlBwFilter, (uint32_t)((float) rs->delivery_rate / 8));
debug(DEBUG_BBR, "Current BtlBw: %u, RS delivery rate: %u", bbr->bw, (uint32_t)rs->delivery_rate);
}
}
......@@ -131,10 +132,10 @@ void BBR_EnterProbeRTT(BBR *bbr) {
}
void BBR_HandleProbeRTT(BBR *bbr, PrrtPacketTracking *tracking) {
tracking->app_limited = (tracking->delivered + tracking->pipe) ? : 1;
tracking->app_limited = (tracking->delivered + tracking->packets_in_flight) ? : 1;
/* Ignore low rate samples during ProbeRTT: */
prrtTimestamp_t now = PrrtClock_get_current_time_us();
if (bbr->probe_rtt_done_stamp == 0 && tracking->pipe <= BBRMinPipeCwnd) {
if (bbr->probe_rtt_done_stamp == 0 && tracking->packets_in_flight <= BBRMinPipeCwnd) {
bbr->probe_rtt_done_stamp = now + ProbeRTTDuration;
bbr->probe_rtt_round_done = false;
bbr->next_round_delivered = tracking->delivered;
......@@ -211,7 +212,7 @@ void BBR_SetCwnd(BBR* bbr, PrrtPacketTracking* packetTracking)
void BBR_SetPacingRateWithGain(BBR* bbr, float pacing_gain)
{
uint32_t rate = (uint32_t) (pacing_gain * ((float)bbr->bw) / (1000*1000*8));
uint32_t rate = (uint32_t) (pacing_gain * ((float)bbr->bw));
debug(DEBUG_BBR, "Current rate: %u, Pacing gain: %f, BtlBw: %u, Calc Rate: %u, Filled pipe: %u", bbr->pacing_rate,
pacing_gain, bbr->bw, rate, bbr->filled_pipe);
if (rate != 0 && (bbr->filled_pipe || rate > bbr->pacing_rate))
......@@ -312,3 +313,6 @@ uint64_t BBR_getFullBw(BBR* bbr) {
return bbr->full_bw;
}
prrtByteCount_t BBR_getInflight(BBR* bbr) {
return BBR_Inflight(bbr, bbr->pacing_gain);
}
\ No newline at end of file
......@@ -10,12 +10,11 @@
#include "types/rateSample.h"
#include "../util/windowedFilter.h"
#define MTU 1500
#define RTpropFilterLen 10000000 //10s
#define BBRHighGain ((2885 / 1000) + 1)
#define InitialCwnd (10 * MTU)
#define InitialCwnd 10
#define BBRGainCycleLen 8
#define BBRMinPipeCwnd (4 * MTU)
#define BBRMinPipeCwnd 4
#define ProbeRTTDuration 200000 //200ms
#define Inf UINT32_MAX
......@@ -82,5 +81,6 @@ float BBR_getPacingGain(BBR* bbr);
uint32_t BBR_getCycleIndex(BBR* bbr);
bool BBR_getFilledPipe(BBR* bbr);
uint32_t BBR_getRTProp(BBR* bbr);
prrtByteCount_t BBR_getInflight(BBR* bbr);
#endif //PRRT_BBR_H
......@@ -624,6 +624,15 @@ uint64_t PrrtSocket_get_full_bw(PrrtSocket *s) {
return BBR_getFullBw(s->receiver->bbr);
}
uint32_t PrrtSocket_get_cwnd(PrrtSocket *s) {
return BBR_getCwnd(s->receiver->bbr);
}
uint32_t PrrtSocket_get_inflight(PrrtSocket *s) {
return BBR_getInflight(s->receiver->bbr);
}
float PrrtSocket_get_pacing_gain(PrrtSocket *s) {
return BBR_getPacingGain(s->receiver->bbr);
}
......
......@@ -143,6 +143,8 @@ uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s);
bool PrrtSocket_get_app_limited(PrrtSocket *s);
uint32_t PrrtSocket_get_cycle_index(PrrtSocket *s);
float PrrtSocket_get_pacing_gain(PrrtSocket *s);
uint32_t PrrtSocket_get_cwnd(PrrtSocket *s);
uint32_t PrrtSocket_get_inflight(PrrtSocket *s);
#endif // PRRT_SOCKET_H
......@@ -223,6 +223,18 @@ cdef class PrrtSocket:
raise Exception("Not a sender.")
return cprrt.PrrtSocket_get_pacing_gain(self._c_socket)
property bbr_cwnd:
def __get__(self):
if not self.isSender:
raise Exception("Not a sender.")
return cprrt.PrrtSocket_get_cwnd(self._c_socket)
property bbr_inflight:
def __get__(self):
if not self.isSender:
raise Exception("Not a sender.")
return cprrt.PrrtSocket_get_inflight(self._c_socket)
property app_limited:
def __get__(self):
if not self.isSender:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment