From dc763b5045caf2fd04dc15f03f927d3250b51934 Mon Sep 17 00:00:00 2001 From: Francisco Date: Wed, 7 Apr 2021 10:23:42 +0100 Subject: [PATCH] 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 --- lib/include/srsran/upper/rlc_am_lte.h | 11 +++++++++-- lib/src/upper/rlc_am_lte.cc | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/include/srsran/upper/rlc_am_lte.h b/lib/include/srsran/upper/rlc_am_lte.h index a23a91c2f..c20cd6724 100644 --- a/lib/include/srsran/upper/rlc_am_lte.h +++ b/lib/include/srsran/upper/rlc_am_lte.h @@ -116,13 +116,20 @@ public: 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; count++; } 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].fully_acked = false; buffered_pdus[sn_idx].fully_txed = false; diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 2fc44b46d..6d783eef2 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -2128,6 +2128,7 @@ buffered_pdcp_pdu_list::buffered_pdcp_pdu_list() : buffered_pdus(max_buffer_idx void buffered_pdcp_pdu_list::clear() { + count = 0; for (auto& b : buffered_pdus) { b.sn = invalid_sn; b.fully_acked = false;