Commit 92e34718 authored by Andreas Schmidt's avatar Andreas Schmidt

Btlbw is now also available at the receiver.

parent 18429509
Pipeline #2193 passed with stages
in 1 minute and 25 seconds
...@@ -33,9 +33,9 @@ void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, pr ...@@ -33,9 +33,9 @@ void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, pr
} }
void PrrtChannelStateInformation_update_delivery_rate(PrrtChannelStateInformation *csi, PrrtRateSample *rateSample) { void PrrtChannelStateInformation_update_delivery_rate(PrrtChannelStateInformation *csi, prrtDeliveryRate_t rate) {
pthread_mutex_lock(&csi->lock); pthread_mutex_lock(&csi->lock);
csi->deliveryRate = rateSample->delivery_rate; csi->deliveryRate = rate;
pthread_mutex_unlock(&csi->lock); pthread_mutex_unlock(&csi->lock);
} }
void PrrtChannelStateInformation_update_app_limited(PrrtChannelStateInformation *csi, bool appLimited) { void PrrtChannelStateInformation_update_app_limited(PrrtChannelStateInformation *csi, bool appLimited) {
......
...@@ -22,7 +22,7 @@ bool PrrtChannelStateInformation_get_app_limited(PrrtChannelStateInformation *cs ...@@ -22,7 +22,7 @@ bool PrrtChannelStateInformation_get_app_limited(PrrtChannelStateInformation *cs
prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInformation* csi); prrtPacketLossRate_t PrrtChannelStateInformation_get_plr(PrrtChannelStateInformation* csi);
void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, prrtSequenceNumber_t erasures, void PrrtChannelStateInformation_update_plr(PrrtChannelStateInformation *csi, prrtSequenceNumber_t erasures,
prrtSequenceNumber_t packets); prrtSequenceNumber_t packets);
void PrrtChannelStateInformation_update_delivery_rate(PrrtChannelStateInformation *csi, PrrtRateSample *rate); void PrrtChannelStateInformation_update_delivery_rate(PrrtChannelStateInformation *csi, prrtDeliveryRate_t rate);
void PrrtChannelStateInformation_update_app_limited(PrrtChannelStateInformation *csi, bool appLimited); void PrrtChannelStateInformation_update_app_limited(PrrtChannelStateInformation *csi, bool appLimited);
bool PrrtChannelStateInformation_destroy(PrrtChannelStateInformation* csi); bool PrrtChannelStateInformation_destroy(PrrtChannelStateInformation* csi);
......
...@@ -141,6 +141,7 @@ handle_data_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) { ...@@ -141,6 +141,7 @@ handle_data_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
false) { false) {
PrrtPacket_destroy(packet); PrrtPacket_destroy(packet);
} else { } else {
PrrtChannelStateInformation_update_delivery_rate(sock_ptr->senderChannelStateInformation, payload->btlbw);
prrtSequenceNumber_t baseSequenceNumber = packet->sequenceNumber - packet->index; prrtSequenceNumber_t baseSequenceNumber = packet->sequenceNumber - packet->index;
PrrtPacket *reference = PrrtPacket_copy(packet); PrrtPacket *reference = PrrtPacket_copy(packet);
......
...@@ -117,6 +117,7 @@ static bool send_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) { ...@@ -117,6 +117,7 @@ static bool send_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
// Update timestamp // Update timestamp
if(PrrtPacket_type(packet) == PACKET_TYPE_DATA) { if(PrrtPacket_type(packet) == PACKET_TYPE_DATA) {
((PrrtPacketDataPayload*) (packet->payload))->timestamp = PrrtClock_get_current_time_us(); ((PrrtPacketDataPayload*) (packet->payload))->timestamp = PrrtClock_get_current_time_us();
((PrrtPacketDataPayload*) (packet->payload))->btlbw = BBR_getBtlBw(sock_ptr->receiver->bbr);
} else if(PrrtPacket_type(packet) == PACKET_TYPE_REDUNDANCY) { } else if(PrrtPacket_type(packet) == PACKET_TYPE_REDUNDANCY) {
((PrrtPacketRedundancyPayload*) (packet->payload))->timestamp = PrrtClock_get_current_time_us(); ((PrrtPacketRedundancyPayload*) (packet->payload))->timestamp = PrrtClock_get_current_time_us();
} }
......
...@@ -190,7 +190,7 @@ void PrrtReceiver_on_ack(PrrtReceiver *receiver, PrrtPacketFeedbackPayload * fee ...@@ -190,7 +190,7 @@ void PrrtReceiver_on_ack(PrrtReceiver *receiver, PrrtPacketFeedbackPayload * fee
bool valid_sample = PrrtReceiver_updateAndGenerateRateSample(receiver, feedbackPayload->ackSequenceNumber, feedbackPayload->ackPacketType, receiveTime, rtt); bool valid_sample = PrrtReceiver_updateAndGenerateRateSample(receiver, feedbackPayload->ackSequenceNumber, feedbackPayload->ackPacketType, receiveTime, rtt);
if(valid_sample) { if(valid_sample) {
PrrtChannelStateInformation_update_delivery_rate(receiver->csi, receiver->rateSample); PrrtChannelStateInformation_update_delivery_rate(receiver->csi, receiver->rateSample->delivery_rate);
} }
PrrtChannelStateInformation_update_app_limited(receiver->csi, receiver->rateSample->is_app_limited); PrrtChannelStateInformation_update_app_limited(receiver->csi, receiver->rateSample->is_app_limited);
......
...@@ -227,6 +227,7 @@ bool PrrtSocket_bind(PrrtSocket *s, const char *ipAddress, const uint16_t port) ...@@ -227,6 +227,7 @@ bool PrrtSocket_bind(PrrtSocket *s, const char *ipAddress, const uint16_t port)
EXIT_SUCCESS, EXIT_SUCCESS,
"Cannot create send thread."); "Cannot create send thread.");
} else { } else {
s->senderChannelStateInformation = PrrtChannelStateInformation_create();
s->receiveDataThreadAttr = calloc(1, sizeof(pthread_attr_t)); s->receiveDataThreadAttr = calloc(1, sizeof(pthread_attr_t));
pthread_attr_init(s->receiveDataThreadAttr); pthread_attr_init(s->receiveDataThreadAttr);
if(s->isThreadPinning) { if(s->isThreadPinning) {
...@@ -452,6 +453,11 @@ int PrrtSocket_close(PrrtSocket *s) { ...@@ -452,6 +453,11 @@ int PrrtSocket_close(PrrtSocket *s) {
s->redundancyReceptionTable = NULL; s->redundancyReceptionTable = NULL;
} }
if(s->senderChannelStateInformation != NULL) {
PrrtChannelStateInformation_destroy(s->senderChannelStateInformation);
s->senderChannelStateInformation = NULL;
}
if (s->packetDeliveryStore != NULL) { if (s->packetDeliveryStore != NULL) {
PrrtPacketDeliveryStore_destroy(s->packetDeliveryStore); PrrtPacketDeliveryStore_destroy(s->packetDeliveryStore);
s->packetDeliveryStore = NULL; s->packetDeliveryStore = NULL;
...@@ -609,7 +615,11 @@ prrtDeliveryRate_t PrrtSocket_get_delivery_rate(PrrtSocket *s) { ...@@ -609,7 +615,11 @@ prrtDeliveryRate_t PrrtSocket_get_delivery_rate(PrrtSocket *s) {
} }
prrtDeliveryRate_t PrrtSocket_get_btlbw(PrrtSocket *s) { prrtDeliveryRate_t PrrtSocket_get_btlbw(PrrtSocket *s) {
if(s->isSender) {
return BBR_getBtlBw(s->receiver->bbr); return BBR_getBtlBw(s->receiver->bbr);
} else {
return PrrtChannelStateInformation_get_delivery_rate(s->senderChannelStateInformation);
}
} }
uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s) { uint32_t PrrtSocket_get_bbr_state(PrrtSocket *s) {
......
...@@ -86,6 +86,8 @@ typedef struct prrtSocket { ...@@ -86,6 +86,8 @@ typedef struct prrtSocket {
atomic_bool isHardwareTimestamping; atomic_bool isHardwareTimestamping;
char *interfaceName; char *interfaceName;
PrrtChannelStateInformation* senderChannelStateInformation;
atomic_bool isThreadPinning; atomic_bool isThreadPinning;
} PrrtSocket; } PrrtSocket;
......
...@@ -243,6 +243,10 @@ void *encode_data_header(void *buf_ptr, const void *payload) { ...@@ -243,6 +243,10 @@ void *encode_data_header(void *buf_ptr, const void *payload) {
*packet_timeout = htonl(data_payload->packetTimeout_us); *packet_timeout = htonl(data_payload->packetTimeout_us);
buf_ptr += sizeof(prrtTimedelta_t); buf_ptr += sizeof(prrtTimedelta_t);
prrtDeliveryRate_t *deliveryRate = (prrtDeliveryRate_t *) buf_ptr;
*deliveryRate = htonl(data_payload->btlbw);
buf_ptr += sizeof(prrtDeliveryRate_t);
return buf_ptr; return buf_ptr;
} }
...@@ -384,6 +388,10 @@ void *decode_data_header(void *dstBuffer, const void *srcBuffer) { ...@@ -384,6 +388,10 @@ void *decode_data_header(void *dstBuffer, const void *srcBuffer) {
data_payload->packetTimeout_us = ntohl(*packet_timeout); data_payload->packetTimeout_us = ntohl(*packet_timeout);
dstBuffer += sizeof(prrtTimedelta_t); dstBuffer += sizeof(prrtTimedelta_t);
prrtDeliveryRate_t *btlbw = (prrtDeliveryRate_t *) dstBuffer;
data_payload->btlbw = ntohl(*btlbw);
dstBuffer += sizeof(prrtDeliveryRate_t);
return dstBuffer; return dstBuffer;
} }
......
...@@ -57,6 +57,7 @@ typedef struct prrtPacketDataPayload { ...@@ -57,6 +57,7 @@ typedef struct prrtPacketDataPayload {
prrtTimestamp_t timestamp; prrtTimestamp_t timestamp;
prrtTimedelta_t groupRTprop_us; prrtTimedelta_t groupRTprop_us;
prrtTimestamp_t packetTimeout_us; prrtTimestamp_t packetTimeout_us;
prrtDeliveryRate_t btlbw;
} PrrtPacketDataPayload; } PrrtPacketDataPayload;
#define PRRT_PACKET_DATA_HEADER_SIZE sizeof(PrrtPacketDataPayload) #define PRRT_PACKET_DATA_HEADER_SIZE sizeof(PrrtPacketDataPayload)
......
...@@ -190,8 +190,6 @@ cdef class PrrtSocket: ...@@ -190,8 +190,6 @@ cdef class PrrtSocket:
property btlbw: property btlbw:
def __get__(self): def __get__(self):
if not self.isSender:
raise Exception("Not a sender.")
return cprrt.PrrtSocket_get_btlbw(self._c_socket) return cprrt.PrrtSocket_get_btlbw(self._c_socket)
property bbr_state: property bbr_state:
......
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