Initial fix for segment handling in RLC AM

This commit is contained in:
Paul Sutton 2018-02-12 13:09:31 +00:00
parent 59e425608f
commit 4cf79c1ead
2 changed files with 16 additions and 9 deletions

View File

@ -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)
{
// Ordered insert
std::list<rlc_amd_rx_pdu_t>::iterator tmpit;
std::list<rlc_amd_rx_pdu_t>::iterator it = pdu->segments.begin();
while(it != pdu->segments.end() && it->header.so < segment->header.so)
it++;
pdu->segments.insert(it, *segment);
// Check segment offset
uint32_t n = 0;
if(!pdu->segments.empty()) {
rlc_amd_rx_pdu_t &back = pdu->segments.back();
n = back.header.so + back.buf->N_bytes;
}
if(segment->header.so != n) {
pool->deallocate(segment->buf);
return false;
} else {
pdu->segments.push_back(*segment);
}
// Check for complete
uint32_t so = 0;
std::list<rlc_amd_rx_pdu_t>::iterator it, tmpit;
for(it = pdu->segments.begin(); it != pdu->segments.end(); it++) {
if(so != it->header.so)
return false;

View File

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