lib,rlc_am_nr: avoid if that would always be true when checking the

out-of-order ACK. Check ACK_SN instead of stop SN with Tx_Next_Ack
master
Pedro Alvarez 3 years ago
parent 7c42b09e89
commit c457132570

@ -136,9 +136,9 @@ private:
rlc_am* parent = nullptr;
rlc_am_nr_rx* rx = nullptr;
uint32_t mod_nr = cardinality(rlc_am_nr_sn_size_t());
inline uint32_t tx_mod_base_nr(uint32_t sn) const;
void check_sn_reached_max_retx(uint32_t sn);
uint32_t mod_nr = cardinality(rlc_am_nr_sn_size_t());
inline int32_t tx_mod_base_nr(uint32_t sn) const;
void check_sn_reached_max_retx(uint32_t sn);
/****************************************************************************
* Configurable parameters
@ -266,7 +266,7 @@ private:
byte_buffer_pool* pool = nullptr;
uint32_t mod_nr = cardinality(rlc_am_nr_sn_size_t());
uint32_t rx_mod_base_nr(uint32_t sn) const;
int32_t rx_mod_base_nr(uint32_t sn) const;
// RX Window
std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> > rx_window;

@ -801,9 +801,9 @@ void rlc_am_nr_tx::handle_control_pdu(uint8_t* payload, uint32_t nof_bytes)
? status.ack_sn
: status.nacks[0].nack_sn; // Stop processing ACKs at the first NACK, if it exists.
if (tx_mod_base_nr(stop_sn) < tx_mod_base_nr(st.tx_next_ack)) {
if (tx_mod_base_nr(status.ack_sn) < tx_mod_base_nr(st.tx_next_ack)) {
RlcInfo(
"Received ACK or NACK with SN=%d smaller than TX_NEXT_ACK=%d. Ignoring status report", stop_sn, st.tx_next_ack);
"Received ACK with SN=%d smaller than TX_NEXT_ACK=%d. Ignoring status report", status.ack_sn, st.tx_next_ack);
info_state();
return;
}
@ -1277,9 +1277,9 @@ void rlc_am_nr_tx::timer_expired(uint32_t timeout_id)
/*
* Window helpers
*/
uint32_t rlc_am_nr_tx::tx_mod_base_nr(uint32_t sn) const
int32_t rlc_am_nr_tx::tx_mod_base_nr(uint32_t sn) const
{
return (sn - st.tx_next_ack) % mod_nr;
return ((int32_t)sn - (int32_t)st.tx_next_ack) % mod_nr;
}
uint32_t rlc_am_nr_tx::tx_window_size() const
@ -1290,7 +1290,7 @@ uint32_t rlc_am_nr_tx::tx_window_size() const
bool rlc_am_nr_tx::inside_tx_window(uint32_t sn) const
{
// TX_Next_Ack <= SN < TX_Next_Ack + AM_Window_Size
return tx_mod_base_nr(sn) < tx_window_size();
return tx_mod_base_nr(sn) < (int32_t)tx_window_size();
}
/*
@ -1870,37 +1870,8 @@ void rlc_am_nr_rx::write_to_upper_layers(uint32_t lcid, unique_byte_buffer_t sdu
}
/*
* Window Helpers
*/
uint32_t rlc_am_nr_rx::rx_mod_base_nr(uint32_t sn) const
{
return (sn - st.rx_next) % mod_nr;
}
uint32_t rlc_am_nr_rx::rx_window_size() const
{
return am_window_size(cfg.rx_sn_field_length);
}
bool rlc_am_nr_rx::inside_rx_window(uint32_t sn)
{
// RX_Next <= SN < RX_Next + AM_Window_Size
return rx_mod_base_nr(sn) < rx_window_size();
}
/*
* Metrics
* Segment Helpers
*/
uint32_t rlc_am_nr_rx::get_sdu_rx_latency_ms()
{
return 0;
}
uint32_t rlc_am_nr_rx::get_rx_buffered_bytes()
{
return 0;
}
void rlc_am_nr_rx::insert_received_segment(rlc_amd_rx_pdu_nr segment,
std::set<rlc_amd_rx_pdu_nr, rlc_amd_rx_pdu_nr_cmp>& segment_list) const
{
@ -1937,6 +1908,25 @@ void rlc_am_nr_rx::update_segment_inventory(rlc_amd_rx_sdu_nr_t& rx_sdu) const
rx_sdu.fully_received = false;
}
/*
* Window Helpers
*/
int32_t rlc_am_nr_rx::rx_mod_base_nr(uint32_t sn) const
{
return ((int32_t)sn - (int32_t)st.rx_next) % mod_nr;
}
uint32_t rlc_am_nr_rx::rx_window_size() const
{
return am_window_size(cfg.rx_sn_field_length);
}
bool rlc_am_nr_rx::inside_rx_window(uint32_t sn)
{
// RX_Next <= SN < RX_Next + AM_Window_Size
return rx_mod_base_nr(sn) < (int32_t)rx_window_size();
}
/*
* Debug Helpers
*/
@ -1954,4 +1944,17 @@ void rlc_am_nr_rx::debug_window() const
RlcDebug(
"RX window state: Rx_Next=%d, Rx_Next_Highest=%d, SDUs %d", st.rx_next, st.rx_next_highest, rx_window->size());
}
/*
* Metrics
*/
uint32_t rlc_am_nr_rx::get_sdu_rx_latency_ms()
{
return 0;
}
uint32_t rlc_am_nr_rx::get_rx_buffered_bytes()
{
return 0;
}
} // namespace srsran

Loading…
Cancel
Save