mirror of https://github.com/PentHertz/srsLTE.git
rlc_am_nr: Changed header_t to HeaderType typename in RLC data structs.
Fix issue in clear_pdcp_sdu()
This commit is contained in:
parent
123ac16653
commit
3b150e26cb
|
@ -22,13 +22,13 @@
|
||||||
|
|
||||||
namespace srsran {
|
namespace srsran {
|
||||||
|
|
||||||
template <typename header_t>
|
template <typename HeaderType>
|
||||||
class rlc_amd_tx_pdu;
|
class rlc_amd_tx_pdu;
|
||||||
template <typename header_t>
|
template <typename HeaderType>
|
||||||
class pdcp_pdu_info;
|
class pdcp_pdu_info;
|
||||||
|
|
||||||
/// Pool that manages the allocation of RLC AM PDU Segments to RLC PDUs and tracking of segments ACK state
|
/// Pool that manages the allocation of RLC AM PDU Segments to RLC PDUs and tracking of segments ACK state
|
||||||
template <typename header_t>
|
template <typename HeaderType>
|
||||||
struct rlc_am_pdu_segment_pool {
|
struct rlc_am_pdu_segment_pool {
|
||||||
const static size_t MAX_POOL_SIZE = 16384;
|
const static size_t MAX_POOL_SIZE = 16384;
|
||||||
|
|
||||||
|
@ -64,10 +64,10 @@ struct rlc_am_pdu_segment_pool {
|
||||||
bool empty() const { return rlc_sn_ == invalid_rlc_sn and pdcp_sn_ == invalid_pdcp_sn; }
|
bool empty() const { return rlc_sn_ == invalid_rlc_sn and pdcp_sn_ == invalid_pdcp_sn; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct rlc_am_pdu_segment_pool<header_t>;
|
friend struct rlc_am_pdu_segment_pool<HeaderType>;
|
||||||
uint32_t rlc_sn_ = invalid_rlc_sn;
|
uint32_t rlc_sn_ = invalid_rlc_sn;
|
||||||
uint32_t pdcp_sn_ = invalid_pdcp_sn;
|
uint32_t pdcp_sn_ = invalid_pdcp_sn;
|
||||||
rlc_am_pdu_segment_pool<header_t>* parent_pool = nullptr;
|
rlc_am_pdu_segment_pool<HeaderType>* parent_pool = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
rlc_am_pdu_segment_pool()
|
rlc_am_pdu_segment_pool()
|
||||||
|
@ -83,7 +83,7 @@ struct rlc_am_pdu_segment_pool {
|
||||||
rlc_am_pdu_segment_pool& operator=(rlc_am_pdu_segment_pool&&) = delete;
|
rlc_am_pdu_segment_pool& operator=(rlc_am_pdu_segment_pool&&) = delete;
|
||||||
|
|
||||||
bool has_segments() const { return not free_list.empty(); }
|
bool has_segments() const { return not free_list.empty(); }
|
||||||
bool make_segment(rlc_amd_tx_pdu<header_t>& rlc_list, pdcp_pdu_info<header_t>& pdcp_list)
|
bool make_segment(rlc_amd_tx_pdu<HeaderType>& rlc_list, pdcp_pdu_info<HeaderType>& pdcp_list)
|
||||||
{
|
{
|
||||||
if (not has_segments()) {
|
if (not has_segments()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -97,15 +97,15 @@ struct rlc_am_pdu_segment_pool {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
intrusive_forward_list<rlc_am_pdu_segment_pool<header_t>::segment_resource, free_list_tag> free_list;
|
intrusive_forward_list<rlc_am_pdu_segment_pool<HeaderType>::segment_resource, free_list_tag> free_list;
|
||||||
std::array<rlc_am_pdu_segment_pool<header_t>::segment_resource, MAX_POOL_SIZE> segments;
|
std::array<rlc_am_pdu_segment_pool<HeaderType>::segment_resource, MAX_POOL_SIZE> segments;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Class that contains the parameters and state (e.g. segments) of a RLC PDU
|
/// Class that contains the parameters and state (e.g. segments) of a RLC PDU
|
||||||
template <typename header_t>
|
template <typename HeaderType>
|
||||||
class rlc_amd_tx_pdu
|
class rlc_amd_tx_pdu
|
||||||
{
|
{
|
||||||
using rlc_am_pdu_segment = typename rlc_am_pdu_segment_pool<header_t>::segment_resource;
|
using rlc_am_pdu_segment = typename rlc_am_pdu_segment_pool<HeaderType>::segment_resource;
|
||||||
using list_type = intrusive_forward_list<rlc_am_pdu_segment>;
|
using list_type = intrusive_forward_list<rlc_am_pdu_segment>;
|
||||||
const static uint32_t invalid_rlc_sn = std::numeric_limits<uint32_t>::max();
|
const static uint32_t invalid_rlc_sn = std::numeric_limits<uint32_t>::max();
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public:
|
||||||
|
|
||||||
const uint32_t rlc_sn = invalid_rlc_sn;
|
const uint32_t rlc_sn = invalid_rlc_sn;
|
||||||
uint32_t retx_count = 0;
|
uint32_t retx_count = 0;
|
||||||
header_t header;
|
HeaderType header;
|
||||||
unique_byte_buffer_t buf;
|
unique_byte_buffer_t buf;
|
||||||
|
|
||||||
explicit rlc_amd_tx_pdu(uint32_t rlc_sn_) : rlc_sn(rlc_sn_) {}
|
explicit rlc_amd_tx_pdu(uint32_t rlc_sn_) : rlc_sn(rlc_sn_) {}
|
||||||
|
@ -144,10 +144,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Class that contains the parameters and state (e.g. unACKed segments) of a PDCP PDU
|
/// Class that contains the parameters and state (e.g. unACKed segments) of a PDCP PDU
|
||||||
template <typename header_t>
|
template <typename HeaderType>
|
||||||
class pdcp_pdu_info
|
class pdcp_pdu_info
|
||||||
{
|
{
|
||||||
using rlc_am_pdu_segment = typename rlc_am_pdu_segment_pool<header_t>::segment_resource;
|
using rlc_am_pdu_segment = typename rlc_am_pdu_segment_pool<HeaderType>::segment_resource;
|
||||||
using list_type = intrusive_double_linked_list<rlc_am_pdu_segment>;
|
using list_type = intrusive_double_linked_list<rlc_am_pdu_segment>;
|
||||||
|
|
||||||
list_type list; // List of unACKed RLC PDUs that contain segments that belong to the PDCP PDU.
|
list_type list; // List of unACKed RLC PDUs that contain segments that belong to the PDCP PDU.
|
||||||
|
@ -231,7 +231,7 @@ private:
|
||||||
srsran::static_circular_map<uint32_t, T, WINDOW_SIZE> window;
|
srsran::static_circular_map<uint32_t, T, WINDOW_SIZE> window;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename header_t>
|
template <typename HeaderType>
|
||||||
struct buffered_pdcp_pdu_list {
|
struct buffered_pdcp_pdu_list {
|
||||||
public:
|
public:
|
||||||
explicit buffered_pdcp_pdu_list() : buffered_pdus(buffered_pdcp_pdu_list::buffer_size) { clear(); }
|
explicit buffered_pdcp_pdu_list() : buffered_pdus(buffered_pdcp_pdu_list::buffer_size) { clear(); }
|
||||||
|
@ -239,7 +239,7 @@ public:
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (pdcp_pdu_info<header_t>& b : buffered_pdus) {
|
for (pdcp_pdu_info<HeaderType>& b : buffered_pdus) {
|
||||||
b.clear();
|
b.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ public:
|
||||||
{
|
{
|
||||||
srsran_expect(sn <= max_pdcp_sn or sn == status_report_sn, "Invalid PDCP SN=%d", sn);
|
srsran_expect(sn <= max_pdcp_sn or sn == status_report_sn, "Invalid PDCP SN=%d", sn);
|
||||||
srsran_assert(not has_pdcp_sn(sn), "Cannot re-add same PDCP SN twice");
|
srsran_assert(not has_pdcp_sn(sn), "Cannot re-add same PDCP SN twice");
|
||||||
pdcp_pdu_info<header_t>& pdu = get_pdu_(sn);
|
pdcp_pdu_info<HeaderType>& pdu = get_pdu_(sn);
|
||||||
if (pdu.valid()) {
|
if (pdu.valid()) {
|
||||||
pdu.clear();
|
pdu.clear();
|
||||||
count--;
|
count--;
|
||||||
|
@ -259,17 +259,15 @@ public:
|
||||||
|
|
||||||
void clear_pdcp_sdu(uint32_t sn)
|
void clear_pdcp_sdu(uint32_t sn)
|
||||||
{
|
{
|
||||||
pdcp_pdu_info<header_t>& pdu = get_pdu_(sn);
|
pdcp_pdu_info<HeaderType>& pdu = get_pdu_(sn);
|
||||||
if (not pdu.valid()) {
|
if (not pdu.valid()) {
|
||||||
{
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
pdu.clear();
|
|
||||||
count--;
|
|
||||||
}
|
}
|
||||||
|
pdu.clear();
|
||||||
|
count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdcp_pdu_info<header_t>& operator[](uint32_t sn)
|
pdcp_pdu_info<HeaderType>& operator[](uint32_t sn)
|
||||||
{
|
{
|
||||||
srsran_expect(has_pdcp_sn(sn), "Invalid access to non-existent PDCP SN=%d", sn);
|
srsran_expect(has_pdcp_sn(sn), "Invalid access to non-existent PDCP SN=%d", sn);
|
||||||
return get_pdu_(sn);
|
return get_pdu_(sn);
|
||||||
|
@ -285,21 +283,21 @@ public:
|
||||||
private:
|
private:
|
||||||
const static size_t max_pdcp_sn = 262143u;
|
const static size_t max_pdcp_sn = 262143u;
|
||||||
const static size_t buffer_size = 4096u;
|
const static size_t buffer_size = 4096u;
|
||||||
const static uint32_t status_report_sn = pdcp_pdu_info<header_t>::status_report_sn;
|
const static uint32_t status_report_sn = pdcp_pdu_info<HeaderType>::status_report_sn;
|
||||||
|
|
||||||
pdcp_pdu_info<header_t>& get_pdu_(uint32_t sn)
|
pdcp_pdu_info<HeaderType>& get_pdu_(uint32_t sn)
|
||||||
{
|
{
|
||||||
return (sn == status_report_sn) ? status_report_pdu : buffered_pdus[static_cast<size_t>(sn % buffer_size)];
|
return (sn == status_report_sn) ? status_report_pdu : buffered_pdus[static_cast<size_t>(sn % buffer_size)];
|
||||||
}
|
}
|
||||||
const pdcp_pdu_info<header_t>& get_pdu_(uint32_t sn) const
|
const pdcp_pdu_info<HeaderType>& get_pdu_(uint32_t sn) const
|
||||||
{
|
{
|
||||||
return (sn == status_report_sn) ? status_report_pdu : buffered_pdus[static_cast<size_t>(sn % buffer_size)];
|
return (sn == status_report_sn) ? status_report_pdu : buffered_pdus[static_cast<size_t>(sn % buffer_size)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// size equal to buffer_size
|
// size equal to buffer_size
|
||||||
std::vector<pdcp_pdu_info<header_t> > buffered_pdus;
|
std::vector<pdcp_pdu_info<HeaderType> > buffered_pdus;
|
||||||
pdcp_pdu_info<header_t> status_report_pdu;
|
pdcp_pdu_info<HeaderType> status_report_pdu;
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace srsran
|
} // namespace srsran
|
||||||
|
|
Loading…
Reference in New Issue