|
|
|
@ -129,33 +129,41 @@ public:
|
|
|
|
|
void add_pdcp_sdu(uint32_t sn)
|
|
|
|
|
{
|
|
|
|
|
assert(not has_pdcp_sn(sn));
|
|
|
|
|
uint32_t sn_idx = get_idx(sn);
|
|
|
|
|
buffered_pdus[sn_idx].sn = sn_idx;
|
|
|
|
|
buffered_pdus[get_idx(sn)].sn = sn;
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
void clear_pdcp_sdu(uint32_t sn)
|
|
|
|
|
{
|
|
|
|
|
uint32_t sn_idx = get_idx(sn);
|
|
|
|
|
buffered_pdus[sn_idx].rlc_sn_info_list.clear();
|
|
|
|
|
buffered_pdus[sn_idx].sn = -1;
|
|
|
|
|
buffered_pdus[sn_idx].sn = invalid_sn;
|
|
|
|
|
count--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pdcp_sdu_info_t& operator[](uint32_t sn)
|
|
|
|
|
{
|
|
|
|
|
assert(has_pdcp_sn(sn));
|
|
|
|
|
uint32_t sn_idx = get_idx(sn);
|
|
|
|
|
return buffered_pdus[sn_idx];
|
|
|
|
|
return buffered_pdus[get_idx(sn)];
|
|
|
|
|
}
|
|
|
|
|
bool has_pdcp_sn(uint32_t pdcp_sn) const
|
|
|
|
|
{
|
|
|
|
|
assert(pdcp_sn <= max_pdcp_sn or pdcp_sn == status_report_sn);
|
|
|
|
|
return buffered_pdus[get_idx(pdcp_sn)].sn == pdcp_sn;
|
|
|
|
|
}
|
|
|
|
|
bool has_pdcp_sn(uint32_t pdcp_sn) const { return buffered_pdus[get_idx(pdcp_sn)].sn < max_pdcp_sn; }
|
|
|
|
|
uint32_t nof_sdus() const { return count; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// TODO: Set size based on PDCP config
|
|
|
|
|
const static size_t max_pdcp_sn = 262143;
|
|
|
|
|
const static size_t max_pdcp_sn = 262143u;
|
|
|
|
|
const static size_t max_buffer_idx = 4096u;
|
|
|
|
|
const static uint32_t status_report_sn = std::numeric_limits<uint32_t>::max();
|
|
|
|
|
const static uint32_t invalid_sn = std::numeric_limits<uint32_t>::max() - 1;
|
|
|
|
|
|
|
|
|
|
uint32_t get_idx(uint32_t sn) const { return std::min(sn, static_cast<uint32_t>(buffered_pdus.size() - 1)); }
|
|
|
|
|
size_t get_idx(uint32_t sn) const
|
|
|
|
|
{
|
|
|
|
|
return (sn != status_report_sn) ? static_cast<size_t>(sn % max_buffer_idx) : max_buffer_idx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// size equal to buffer_size + 1 (last element for Status Report)
|
|
|
|
|
std::vector<pdcp_sdu_info_t> buffered_pdus;
|
|
|
|
|
uint32_t count = 0;
|
|
|
|
|
};
|
|
|
|
|