rlc am - fix bugs in buffered_pdcp_pdu_list

The count and container elements were not being correctly updated in the events
of SN overwrite, clear(), clear_pdcp_sdu(sn) of sn that doesnt exist
master
Francisco 4 years ago committed by Francisco Paisana
parent ebbb74e639
commit dc763b5045

@ -116,13 +116,20 @@ public:
void add_pdcp_sdu(uint32_t sn) void add_pdcp_sdu(uint32_t sn)
{ {
assert(not has_pdcp_sn(sn)); srsran_assert(not has_pdcp_sn(sn), "Cannot re-add same PDCP SN twice");
uint32_t sn_idx = get_idx(sn);
if (buffered_pdus[sn_idx].sn != invalid_sn) {
clear_pdcp_sdu(buffered_pdus[sn_idx].sn);
}
buffered_pdus[get_idx(sn)].sn = sn; buffered_pdus[get_idx(sn)].sn = sn;
count++; count++;
} }
void clear_pdcp_sdu(uint32_t sn) void clear_pdcp_sdu(uint32_t sn)
{ {
uint32_t sn_idx = get_idx(sn); uint32_t sn_idx = get_idx(sn);
if (buffered_pdus[sn_idx].sn == invalid_sn) {
return;
}
buffered_pdus[sn_idx].sn = invalid_sn; buffered_pdus[sn_idx].sn = invalid_sn;
buffered_pdus[sn_idx].fully_acked = false; buffered_pdus[sn_idx].fully_acked = false;
buffered_pdus[sn_idx].fully_txed = false; buffered_pdus[sn_idx].fully_txed = false;

@ -2128,6 +2128,7 @@ buffered_pdcp_pdu_list::buffered_pdcp_pdu_list() : buffered_pdus(max_buffer_idx
void buffered_pdcp_pdu_list::clear() void buffered_pdcp_pdu_list::clear()
{ {
count = 0;
for (auto& b : buffered_pdus) { for (auto& b : buffered_pdus) {
b.sn = invalid_sn; b.sn = invalid_sn;
b.fully_acked = false; b.fully_acked = false;

Loading…
Cancel
Save