diff --git a/lib/include/srsran/rlc/rlc_am_nr_packing.h b/lib/include/srsran/rlc/rlc_am_nr_packing.h index 8a7484a45..f70bf6c14 100644 --- a/lib/include/srsran/rlc/rlc_am_nr_packing.h +++ b/lib/include/srsran/rlc/rlc_am_nr_packing.h @@ -78,22 +78,35 @@ struct rlc_amd_tx_sdu_nr_t { explicit rlc_amd_tx_sdu_nr_t(uint32_t rlc_sn_) : rlc_sn(rlc_sn_) {} }; -///< AM NR Status PDU header +constexpr uint32_t rlc_am_nr_status_pdu_sizeof_header_ack_sn = 3; ///< header fixed part and ACK SN +constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_sn_ext_12bit_sn = 2; ///< NACK SN and extension fields (12 bit SN) +constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_sn_ext_18bit_sn = 3; ///< NACK SN and extension fields (18 bit SN) +constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_so = 4; ///< NACK segment offsets (start and end) +constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_range = 1; ///< NACK range (nof consecutively lost SDUs) + +/// AM NR Status PDU header class rlc_am_nr_status_pdu_t { private: - rlc_am_nr_sn_size_t sn_size; ///< Stored SN size required to compute the packed size - std::vector nacks_; ///< Internal NACK container; keep in sync with packed_size_ - uint32_t packed_size_; ///< Stores the current packed size; sync on each change of nacks_ + /// Stored SN size required to compute the packed size + rlc_am_nr_sn_size_t sn_size = rlc_am_nr_sn_size_t::nulltype; + /// Internal NACK container; keep in sync with packed_size_ + std::vector nacks_ = {}; + /// Stores the current packed size; sync on each change of nacks_ + uint32_t packed_size_ = rlc_am_nr_status_pdu_sizeof_header_ack_sn; void refresh_packed_size(); uint32_t nack_size(const rlc_status_nack_t& nack) const; public: - rlc_am_nr_control_pdu_type_t cpt; ///< CPT header - uint32_t ack_sn; ///< SN of the next not received RLC Data PDU - const std::vector& nacks; ///< Read-only reference to NACKs - const uint32_t& packed_size; ///< Read-only reference to packed size + /// CPT header + rlc_am_nr_control_pdu_type_t cpt = rlc_am_nr_control_pdu_type_t::status_pdu; + /// SN of the next not received RLC Data PDU + uint32_t ack_sn = INVALID_RLC_SN; + /// Read-only reference to NACKs + const std::vector& nacks = nacks_; + /// Read-only reference to packed size + const uint32_t& packed_size = packed_size_; rlc_am_nr_status_pdu_t(rlc_am_nr_sn_size_t sn_size); void reset(); @@ -125,12 +138,6 @@ uint32_t rlc_am_nr_packed_length(const rlc_am_nr_pdu_header_t& header); * Status PDU pack/unpack helper functions for NR * Ref: 3GPP TS 38.322 v16.2.0 Section 6.2.2.5 ***************************************************************************/ -constexpr uint32_t rlc_am_nr_status_pdu_sizeof_header_ack_sn = 3; // header fixed part and ACK SN -constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_sn_ext_12bit_sn = 2; // NACK SN and extension fields (12 bit SN) -constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_sn_ext_18bit_sn = 3; // NACK SN and extension fields (18 bit SN) -constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_so = 4; // NACK segment offsets (start and end) -constexpr uint32_t rlc_am_nr_status_pdu_sizeof_nack_range = 1; // NACK range (nof consecutively lost SDUs) - uint32_t rlc_am_nr_read_status_pdu(const byte_buffer_t* pdu, const rlc_am_nr_sn_size_t sn_size, rlc_am_nr_status_pdu_t* status); diff --git a/lib/src/rlc/rlc_am_nr_packing.cc b/lib/src/rlc/rlc_am_nr_packing.cc index ed642aa79..72054c26c 100644 --- a/lib/src/rlc/rlc_am_nr_packing.cc +++ b/lib/src/rlc/rlc_am_nr_packing.cc @@ -19,14 +19,7 @@ namespace srsran { * Container implementation for pack/unpack functions ***************************************************************************/ -rlc_am_nr_status_pdu_t::rlc_am_nr_status_pdu_t(rlc_am_nr_sn_size_t sn_size) : - sn_size(sn_size), - nacks_(0), - packed_size_(rlc_am_nr_status_pdu_sizeof_header_ack_sn), - cpt(rlc_am_nr_control_pdu_type_t::status_pdu), - ack_sn(INVALID_RLC_SN), - nacks(nacks_), - packed_size(packed_size_) +rlc_am_nr_status_pdu_t::rlc_am_nr_status_pdu_t(rlc_am_nr_sn_size_t sn_size) : sn_size(sn_size) { nacks_.reserve(RLC_AM_NR_TYP_NACKS); }