Commit e4cd39e1 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Fix bps conversion. Add missing tracking field.

parent 02539561
Loading
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
include "posix/time.pxd"

from libc.stdint cimport uint32_t, uint16_t, uint8_t, int32_t
from libc.stdint cimport uint32_t, uint16_t, uint8_t, int32_t, uint64_t
from libc.string cimport const_char

cdef extern from "pthread.h" nogil:
@@ -147,6 +147,10 @@ cdef extern from "proto/socket.h":
    float PrrtSocket_get_plr(PrrtSocket *socket)
    uint32_t PrrtSocket_get_delivery_rate(PrrtSocket *socket)
    uint32_t PrrtSocket_get_btlbw(PrrtSocket *socket)
    uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s)
    uint64_t PrrtSocket_get_full_bw(PrrtSocket *s)
    bint PrrtSocket_get_filled_pipe(PrrtSocket *s)

    bint PrrtSocket_get_app_limited(PrrtSocket *socket)
    bint PrrtSocket_enable_thread_pinning(PrrtSocket *socket)

+17 −4
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ uint32_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;
    uint32_t estimated_bdp = (bbr->bw * bbr->rtprop) / (1000 * 1000 * 8);
    return (uint32_t)(gain * estimated_bdp + quanta);
}

@@ -30,7 +30,7 @@ void BBR_UpdateBtlBw(BBR* bbr, PrrtRateSample* rs, prrtByteCount_t packet_delive
        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)(rs->delivery_rate));
        debug(DEBUG_BBR, "Current BtlBw: %u, RS delivery rate: %u", bbr->bw, (uint32_t)rs->delivery_rate);
    }
}
@@ -197,7 +197,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);
    uint32_t rate = (uint32_t) (pacing_gain * ((float)bbr->bw) / (1000*1000*8));
    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))
@@ -278,3 +278,16 @@ uint32_t BBR_getRTProp(BBR* bbr)
{
    return bbr->rtprop;
}

uint32_t BBR_getState(BBR* bbr) {
    return bbr->state;
}

bool BBR_getFilledPipe(BBR* bbr) {
    return bbr->filled_pipe;
}

uint64_t BBR_getFullBw(BBR* bbr) {
    return bbr->full_bw;
}
+3 −0
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ void BBR_destroy(BBR* bbr);
uint32_t BBR_getPacingRate(BBR* bbr);
uint32_t BBR_getCwnd(BBR* bbr);
prrtDeliveryRate_t BBR_getBtlBw(BBR* bbr);
uint32_t BBR_getState(BBR* bbr);
uint64_t BBR_getFullBw(BBR* bbr);
bool BBR_getFilledPipe(BBR* bbr);
uint32_t BBR_getRTProp(BBR* bbr);

#endif //PRRT_BBR_H
+2 −1
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@ bool PrrtReceiver_updateAndGenerateRateSample(PrrtReceiver *recv, prrtSequenceNu
        pthread_cond_wait(&recv->recordNotFoundCv, &recv->lock);
        packet = PrrtInFlightPacketStore_get_packet(inflightPacketStore, seqnum);
    }
    recv->packetTracking->bytes_delivered = packet->delivered;
    PrrtReceiver_updateRateSample(recv->rateSample, packet, receiveTime, recv->packetTracking);


@@ -185,7 +186,7 @@ bool PrrtReceiver_updateAndGenerateRateSample(PrrtReceiver *recv, prrtSequenceNu
    recv->packetTracking->packets_delivered++;
    recv->packetTracking->packets_in_flight = (prrtSequenceNumber_t) (PrrtInFlightPacketStore_get_queue_size(recv->dataInflightPacketStore) + PrrtInFlightPacketStore_get_queue_size(recv->redundancyInflightPacketStore));
    recv->packetTracking->prior_inflight = recv->packetTracking->packets_in_flight;
    if(recv->rateSample != NULL) {
    if(recv->rateSample != NULL && result) {
        BBR_OnACK(recv->bbr, recv->csi, recv->rateSample, recv->packetTracking);
    }
    return result;
+15 −1
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ bool PrrtSocket_uses_thread_pinning(PrrtSocket *s) {
}

uint32_t PrrtSocket_get_rtprop(PrrtSocket *s) {
    return PrrtChannelStateInformation_get_rtprop(s->receiver->csi);
    return BBR_getRTProp(s->receiver->bbr);
}

prrtPacketLossRate_t PrrtSocket_get_plr(PrrtSocket *s) {
@@ -601,6 +601,20 @@ prrtDeliveryRate_t PrrtSocket_get_btlbw(PrrtSocket *s) {
    return BBR_getBtlBw(s->receiver->bbr);
}

uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s) {
    return BBR_getState(s->receiver->bbr);
}


bool PrrtSocket_get_filled_pipe(PrrtSocket *s) {
    return BBR_getFilledPipe(s->receiver->bbr);
}

uint64_t PrrtSocket_get_full_bw(PrrtSocket *s) {
    return BBR_getFullBw(s->receiver->bbr);
}


bool PrrtSocket_get_app_limited(PrrtSocket *s) {
    return PrrtChannelStateInformation_get_app_limited(s->receiver->csi);
}
Loading