From ecc995bd4b2fae52ba1569e12b623cc53f6442c8 Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Mon, 2 May 2022 14:55:33 +0200 Subject: [PATCH] lib,rlc_am_nr: merge NACKs across SN overflows --- lib/include/srsran/rlc/rlc_am_nr_packing.h | 7 +++++-- lib/src/rlc/rlc_am_nr_packing.cc | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/include/srsran/rlc/rlc_am_nr_packing.h b/lib/include/srsran/rlc/rlc_am_nr_packing.h index f70bf6c14..b9a275ba6 100644 --- a/lib/include/srsran/rlc/rlc_am_nr_packing.h +++ b/lib/include/srsran/rlc/rlc_am_nr_packing.h @@ -90,6 +90,8 @@ class rlc_am_nr_status_pdu_t private: /// Stored SN size required to compute the packed size rlc_am_nr_sn_size_t sn_size = rlc_am_nr_sn_size_t::nulltype; + /// Stored modulus to determine continuous sequences across SN overflows + uint32_t mod_nr = cardinality(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_ @@ -109,8 +111,9 @@ public: const uint32_t& packed_size = packed_size_; rlc_am_nr_status_pdu_t(rlc_am_nr_sn_size_t sn_size); - void reset(); - void push_nack(const rlc_status_nack_t& nack); + void reset(); + bool is_continuous_sequence(const rlc_status_nack_t& left, const rlc_status_nack_t& right) const; + void push_nack(const rlc_status_nack_t& nack); const std::vector& get_nacks() const { return nacks_; } uint32_t get_packed_size() const { return packed_size; } bool trim(uint32_t max_packed_size); diff --git a/lib/src/rlc/rlc_am_nr_packing.cc b/lib/src/rlc/rlc_am_nr_packing.cc index e1469d21d..b7ba0a867 100644 --- a/lib/src/rlc/rlc_am_nr_packing.cc +++ b/lib/src/rlc/rlc_am_nr_packing.cc @@ -19,7 +19,8 @@ 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) +rlc_am_nr_status_pdu_t::rlc_am_nr_status_pdu_t(rlc_am_nr_sn_size_t sn_size) : + sn_size(sn_size), mod_nr(cardinality(sn_size)) { nacks_.reserve(RLC_AM_NR_TYP_NACKS); } @@ -32,10 +33,10 @@ void rlc_am_nr_status_pdu_t::reset() packed_size_ = rlc_am_nr_status_pdu_sizeof_header_ack_sn; } -static bool is_continuous_sequence(const rlc_status_nack_t& left, const rlc_status_nack_t& right) +bool rlc_am_nr_status_pdu_t::is_continuous_sequence(const rlc_status_nack_t& left, const rlc_status_nack_t& right) const { // SN must be continuous - if (right.nack_sn != left.has_nack_range ? left.nack_sn + left.nack_range : left.nack_sn + 1) { + if (right.nack_sn != ((left.has_nack_range ? left.nack_sn + left.nack_range : (left.nack_sn + 1)) % mod_nr)) { return false; }