diff --git a/lib/include/srsran/rlc/rlc_am_nr.h b/lib/include/srsran/rlc/rlc_am_nr.h index 0a70639fb..42bf858d7 100644 --- a/lib/include/srsran/rlc/rlc_am_nr.h +++ b/lib/include/srsran/rlc/rlc_am_nr.h @@ -131,6 +131,7 @@ public: // Window helpers bool inside_tx_window(uint32_t sn) const; + bool valid_ack_sn(uint32_t sn) const; private: rlc_am* parent = nullptr; @@ -240,6 +241,7 @@ public: int handle_full_data_sdu(const rlc_am_nr_pdu_header_t& header, const uint8_t* payload, uint32_t nof_bytes); int handle_segment_data_sdu(const rlc_am_nr_pdu_header_t& header, const uint8_t* payload, uint32_t nof_bytes); bool inside_rx_window(uint32_t sn); + bool valid_ack_sn(uint32_t sn); void write_to_upper_layers(uint32_t lcid, unique_byte_buffer_t sdu); void insert_received_segment(rlc_amd_rx_pdu_nr segment, rlc_amd_rx_sdu_nr_t::segment_list_t& segment_list) const; /** diff --git a/lib/src/rlc/rlc_am_nr.cc b/lib/src/rlc/rlc_am_nr.cc index 0acdbe273..5cf175917 100644 --- a/lib/src/rlc/rlc_am_nr.cc +++ b/lib/src/rlc/rlc_am_nr.cc @@ -1309,6 +1309,12 @@ bool rlc_am_nr_tx::inside_tx_window(uint32_t sn) const return tx_mod_base_nr(sn) < tx_window_size(); } +bool rlc_am_nr_tx::valid_ack_sn(uint32_t sn) +{ + // Tx_Next_Ack < SN <= TX_Next + AM_Window_Size + return (0 < tx_mod_base_nr(sn)) && (tx_mod_base_nr(sn) <= tx_window_size()); +} + /* * Debug Helpers */ @@ -1844,11 +1850,11 @@ void rlc_am_nr_rx::timer_expired(uint32_t timeout_id) } } st.rx_highest_status = sn_upd; - if (not inside_rx_window(st.rx_highest_status)) { + if (not valid_ack_sn(st.rx_highest_status)) { RlcError("Rx_Highest_Status not inside RX window"); debug_state(); } - srsran_assert(inside_rx_window(st.rx_highest_status), "Error: rx_highest_status assigned outside rx window"); + srsran_assert(valid_ack_sn(st.rx_highest_status), "Error: rx_highest_status assigned outside rx window"); bool restart_reassembly_timer = false; if (rx_mod_base_nr(st.rx_next_highest) > rx_mod_base_nr(st.rx_highest_status + 1)) { @@ -1943,6 +1949,12 @@ bool rlc_am_nr_rx::inside_rx_window(uint32_t sn) return rx_mod_base_nr(sn) < rx_window_size(); } +bool rlc_am_nr_rx::valid_ack_sn(uint32_t sn) +{ + // RX_Next < SN <= RX_Next + AM_Window_Size + return (0 < rx_mod_base_nr(sn)) && (rx_mod_base_nr(sn) <= rx_window_size()); +} + /* * Debug Helpers */