Commit 24236605 authored by Andreas Schmidt's avatar Andreas Schmidt

Update BBR.

* Add send_quantum.
* cwnd in bytes.
* nextSendTime: correct units.
parent 7c690edc
Pipeline #2106 failed with stages
in 21 seconds
......@@ -155,6 +155,7 @@ cdef extern from "proto/socket.h":
uint32_t PrrtSocket_get_cwnd(PrrtSocket *s)
uint32_t PrrtSocket_get_inflight(PrrtSocket *s)
uint32_t PrrtSocket_get_pacing_rate(PrrtSocket *s)
uint32_t PrrtSocket_get_send_quantum(PrrtSocket *s)
bint PrrtSocket_get_app_limited(PrrtSocket *socket)
......
......@@ -188,6 +188,7 @@ void BBR_ModulateCwndForProbeRTT(BBR* bbr)
void BBR_ModulateCwndForRecovery(BBR* bbr, prrtSequenceNumber_t packets_lost, prrtSequenceNumber_t packets_in_flight, prrtSequenceNumber_t packets_delivered)
{
// TODO: [cwnd] = Bytes not packets
if (packets_lost > 0)
bbr->cwnd = MAX(bbr->cwnd - packets_lost, 1);
if (bbr->packet_conservation)
......@@ -201,9 +202,9 @@ void BBR_SetCwnd(BBR* bbr, PrrtPacketTracking* packetTracking)
BBR_ModulateCwndForRecovery(bbr, packetTracking->packets_lost, packetTracking->packets_in_flight, packetTracking->packets_delivered);
if (!bbr->packet_conservation) {
if (bbr->filled_pipe)
bbr->cwnd = MIN(bbr->cwnd + packetTracking->packets_delivered, bbr->target_cwnd);
bbr->cwnd = MIN(bbr->cwnd + packetTracking->delivered, bbr->target_cwnd);
else if (bbr->cwnd < bbr->target_cwnd || packetTracking->delivered < InitialCwnd)
bbr->cwnd = bbr->cwnd + packetTracking->packets_delivered;
bbr->cwnd = bbr->cwnd + packetTracking->delivered;
bbr->cwnd = MAX(bbr->cwnd, BBRMinPipeCwnd);
}
BBR_ModulateCwndForProbeRTT(bbr);
......@@ -224,12 +225,22 @@ void BBR_SetPacingRate(BBR* bbr)
BBR_SetPacingRateWithGain(bbr, bbr->pacing_gain);
}
void BBR_SetSendQuantum(BBR* bbr) {
if(bbr->pacing_rate < 150000) { // 1.2Mbps = 0.15 MBps = 150000 Bps
bbr->send_quantum = 1 * MTU;
} else if (bbr->pacing_rate < 3000000) { // 24 Mbps = 20 * 1.2Mbps = 3000000
bbr->send_quantum = 2 * MTU;
} else {
bbr->send_quantum = MIN((prrtByteCount_t) round(((double)bbr->pacing_rate) / 1000), 64000);
}
}
void BBR_OnACK(BBR* bbr, PrrtChannelStateInformation* csi, PrrtRateSample* rs, PrrtPacketTracking* packetTracking)
{
BBR_UpdateModelAndState(bbr, csi, rs, packetTracking);
BBR_SetPacingRate(bbr);
BBR_SetSendQuantum(bbr);
BBR_SetCwnd(bbr, packetTracking);
}
......@@ -278,7 +289,7 @@ uint32_t BBR_getPacingRate(BBR* bbr)
return bbr->pacing_rate;
}
uint32_t BBR_getCwnd(BBR* bbr)
prrtByteCount_t BBR_getCwnd(BBR* bbr)
{
return bbr->cwnd;
}
......@@ -315,4 +326,8 @@ uint64_t BBR_getFullBw(BBR* bbr) {
prrtByteCount_t BBR_getInflight(BBR* bbr) {
return BBR_Inflight(bbr, bbr->pacing_gain);
}
prrtByteCount_t BBR_getSendQuantum(BBR* bbr) {
return bbr->send_quantum;
}
\ No newline at end of file
......@@ -10,11 +10,12 @@
#include "types/rateSample.h"
#include "../util/windowedFilter.h"
#define MTU 1200
#define RTpropFilterLen 10000000 //10s
#define BBRHighGain ((2885 / 1000) + 1)
#define InitialCwnd 10
#define InitialCwnd (10 * MTU)
#define BBRGainCycleLen 8
#define BBRMinPipeCwnd 4
#define BBRMinPipeCwnd (2 * MTU)
#define ProbeRTTDuration 200000 //200ms
#define Inf UINT32_MAX
......@@ -31,9 +32,9 @@ typedef struct bbr {
uint32_t probe_rtt_done_stamp;
bool probe_rtt_round_done;
bool packet_conservation;
uint32_t prior_cwnd;
uint32_t cwnd;
uint32_t target_cwnd;
prrtByteCount_t prior_cwnd;
prrtByteCount_t cwnd;
prrtByteCount_t target_cwnd;
bool idle_restart;
enum bbr_state state;
......@@ -61,7 +62,7 @@ typedef struct bbr {
uint8_t cycle_index;
float* pacing_gain_cycle;
uint32_t send_quantum;
prrtByteCount_t send_quantum;
prrtDeliveryRate_t bw;
......@@ -73,7 +74,7 @@ void BBR_OnACK(BBR* bbr, PrrtChannelStateInformation* csi, PrrtRateSample* rs, P
void BBR_destroy(BBR* bbr);
uint32_t BBR_getPacingRate(BBR* bbr);
uint32_t BBR_getCwnd(BBR* bbr);
prrtByteCount_t BBR_getCwnd(BBR* bbr);
prrtDeliveryRate_t BBR_getBtlBw(BBR* bbr);
uint32_t BBR_getState(BBR* bbr);
uint64_t BBR_getFullBw(BBR* bbr);
......@@ -82,5 +83,6 @@ uint32_t BBR_getCycleIndex(BBR* bbr);
bool BBR_getFilledPipe(BBR* bbr);
uint32_t BBR_getRTProp(BBR* bbr);
prrtByteCount_t BBR_getInflight(BBR* bbr);
prrtByteCount_t BBR_getSendQuantum(BBR* bbr);
#endif //PRRT_BBR_H
......@@ -8,6 +8,7 @@
#include "../../util/dbg.h"
#include "../../util/common.h"
#include "dataTransmitter.h"
#include <math.h>
bool send_to_socket(PrrtSocket* sock_ptr, PrrtReceiver *recv, uint8_t* buf, prrtPacketLength_t length, struct timespec *packet_timestamp, uint64_t* packet_clockstamp) {
if(sock_ptr->isHardwareTimestamping) {
......@@ -106,7 +107,7 @@ static bool send_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
prrtTimestamp_t now = PrrtClock_get_current_time_us();
if (sock_ptr->pacingEnabled && BBR_getPacingRate(sock_ptr->receiver->bbr) != 0) {
debug(DEBUG_DATATRANSMITTER, "Payload: %u, PacingRate: %u, Pacing Time: %u", packet->payloadLength, BBR_getPacingRate(sock_ptr->receiver->bbr), packet->payloadLength / BBR_getPacingRate(sock_ptr->receiver->bbr));
sock_ptr->nextSendTime = now + (packet->payloadLength / BBR_getPacingRate(sock_ptr->receiver->bbr));
sock_ptr->nextSendTime = now + ((prrtTimedelta_t) round((packet->payloadLength / ((double) 1000 * 1000 * BBR_getPacingRate(sock_ptr->receiver->bbr)))));
}
struct timespec timestamp;
......
......@@ -624,14 +624,18 @@ uint64_t PrrtSocket_get_full_bw(PrrtSocket *s) {
return BBR_getFullBw(s->receiver->bbr);
}
uint32_t PrrtSocket_get_cwnd(PrrtSocket *s) {
prrtByteCount_t PrrtSocket_get_cwnd(PrrtSocket *s) {
return BBR_getCwnd(s->receiver->bbr);
}
uint32_t PrrtSocket_get_inflight(PrrtSocket *s) {
prrtByteCount_t PrrtSocket_get_inflight(PrrtSocket *s) {
return BBR_getInflight(s->receiver->bbr);
}
prrtByteCount_t PrrtSocket_get_send_quantum(PrrtSocket *s) {
return BBR_getSendQuantum(s->receiver->bbr);
};
float PrrtSocket_get_pacing_gain(PrrtSocket *s) {
return BBR_getPacingGain(s->receiver->bbr);
......
......@@ -146,6 +146,7 @@ float PrrtSocket_get_pacing_gain(PrrtSocket *s);
uint32_t PrrtSocket_get_cwnd(PrrtSocket *s);
uint32_t PrrtSocket_get_inflight(PrrtSocket *s);
uint32_t PrrtSocket_get_pacing_rate(PrrtSocket *s);
prrtByteCount_t PrrtSocket_get_send_quantum(PrrtSocket *s);
#endif // PRRT_SOCKET_H
......@@ -241,6 +241,12 @@ cdef class PrrtSocket:
raise Exception("Not a sender.")
return cprrt.PrrtSocket_get_pacing_rate(self._c_socket)
property bbr_send_quantum:
def __get__(self):
if not self.isSender:
raise Exception("Not a sender.")
return cprrt.PrrtSocket_get_send_quantum(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