Initial fix for segment handling in RLC AM

master
Paul Sutton 7 years ago
parent 59e425608f
commit 4cf79c1ead

@ -1221,15 +1221,22 @@ void rlc_am::print_rx_segments()
bool rlc_am::add_segment_and_check(rlc_amd_rx_pdu_segments_t *pdu, rlc_amd_rx_pdu_t *segment) bool rlc_am::add_segment_and_check(rlc_amd_rx_pdu_segments_t *pdu, rlc_amd_rx_pdu_t *segment)
{ {
// Ordered insert // Check segment offset
std::list<rlc_amd_rx_pdu_t>::iterator tmpit; uint32_t n = 0;
std::list<rlc_amd_rx_pdu_t>::iterator it = pdu->segments.begin(); if(!pdu->segments.empty()) {
while(it != pdu->segments.end() && it->header.so < segment->header.so) rlc_amd_rx_pdu_t &back = pdu->segments.back();
it++; n = back.header.so + back.buf->N_bytes;
pdu->segments.insert(it, *segment); }
if(segment->header.so != n) {
pool->deallocate(segment->buf);
return false;
} else {
pdu->segments.push_back(*segment);
}
// Check for complete // Check for complete
uint32_t so = 0; uint32_t so = 0;
std::list<rlc_amd_rx_pdu_t>::iterator it, tmpit;
for(it = pdu->segments.begin(); it != pdu->segments.end(); it++) { for(it = pdu->segments.begin(); it != pdu->segments.end(); it++) {
if(so != it->header.so) if(so != it->header.so)
return false; return false;

@ -82,7 +82,7 @@ private:
if(((float)rand()/RAND_MAX > fail_rate) && read>0) { if(((float)rand()/RAND_MAX > fail_rate) && read>0) {
rlc2->write_pdu(1, pdu->msg, opp_size); rlc2->write_pdu(1, pdu->msg, opp_size);
} }
usleep(1000); usleep(100);
} }
running = false; running = false;
} }
@ -187,7 +187,7 @@ private:
pdu->N_bytes = 1500; pdu->N_bytes = 1500;
pdu->msg[0] = sn++; pdu->msg[0] = sn++;
rlc->write_sdu(1, pdu); rlc->write_sdu(1, pdu);
usleep(1000); usleep(100);
} }
running = false; running = false;
} }
@ -207,7 +207,7 @@ void stress_test()
log1.set_hex_limit(-1); log1.set_hex_limit(-1);
log2.set_hex_limit(-1); log2.set_hex_limit(-1);
float fail_rate = 0.1; float fail_rate = 0.01;
rlc rlc1; rlc rlc1;
rlc rlc2; rlc rlc2;

Loading…
Cancel
Save