lib,rlc_am_nr: extract function am_window_size()

master
Robert Falkenberg 3 years ago
parent 717132e0c3
commit 80e23624f8

@ -78,6 +78,14 @@ constexpr uint32_t cardinality(const rlc_am_nr_sn_size_t& sn_size)
{ {
return (1 << to_number(sn_size)); return (1 << to_number(sn_size));
} }
/****************************************************************************
* Tx constants
* Ref: 3GPP TS 38.322 version 16.2.0 Section 7.2
***************************************************************************/
constexpr uint32_t am_window_size(const rlc_am_nr_sn_size_t& sn_size)
{
return cardinality(sn_size) / 2;
}
struct rlc_am_config_t { struct rlc_am_config_t {
/**************************************************************************** /****************************************************************************

@ -147,14 +147,10 @@ private:
* Ref: 3GPP TS 38.322 version 16.2.0 Section 7.1 * Ref: 3GPP TS 38.322 version 16.2.0 Section 7.1
***************************************************************************/ ***************************************************************************/
struct rlc_am_nr_tx_state_t st = {}; struct rlc_am_nr_tx_state_t st = {};
std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> > tx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> > tx_window;
std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> >(
new rlc_ringbuffer_t<rlc_amd_tx_pdu_nr, cardinality(rlc_am_nr_sn_size_t()) / 2>);
// Queues and buffers // Queues and buffers
std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> > retx_queue = std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> > retx_queue;
std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> >(
new pdu_retx_queue<rlc_amd_retx_nr_t, cardinality(rlc_am_nr_sn_size_t()) / 2>);
uint32_t sdu_under_segmentation_sn = INVALID_RLC_SN; // SN of the SDU currently being segmented. uint32_t sdu_under_segmentation_sn = INVALID_RLC_SN; // SN of the SDU currently being segmented.
pdcp_sn_vector_t notify_info_vec; pdcp_sn_vector_t notify_info_vec;
@ -254,9 +250,7 @@ private:
uint32_t rx_mod_base_nr(uint32_t sn) const; uint32_t rx_mod_base_nr(uint32_t sn) const;
// RX Window // RX Window
std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> > rx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> > rx_window;
std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> >(
new rlc_ringbuffer_t<rlc_amd_rx_sdu_nr_t, cardinality(rlc_am_nr_sn_size_t()) / 2>);
// Mutexes // Mutexes
std::mutex mutex; std::mutex mutex;

@ -51,16 +51,16 @@ bool rlc_am_nr_tx::configure(const rlc_config_t& cfg_)
case rlc_am_nr_sn_size_t::size12bits: case rlc_am_nr_sn_size_t::size12bits:
min_hdr_size = 2; min_hdr_size = 2;
tx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> >( tx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> >(
new rlc_ringbuffer_t<rlc_amd_tx_pdu_nr, cardinality(rlc_am_nr_sn_size_t::size12bits) / 2>); new rlc_ringbuffer_t<rlc_amd_tx_pdu_nr, am_window_size(rlc_am_nr_sn_size_t::size12bits)>);
retx_queue = std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> >( retx_queue = std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> >(
new pdu_retx_queue<rlc_amd_retx_nr_t, cardinality(rlc_am_nr_sn_size_t::size12bits) / 2>); new pdu_retx_queue<rlc_amd_retx_nr_t, am_window_size(rlc_am_nr_sn_size_t::size12bits)>);
break; break;
case rlc_am_nr_sn_size_t::size18bits: case rlc_am_nr_sn_size_t::size18bits:
min_hdr_size = 3; min_hdr_size = 3;
tx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> >( tx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_tx_pdu_nr> >(
new rlc_ringbuffer_t<rlc_amd_tx_pdu_nr, cardinality(rlc_am_nr_sn_size_t::size18bits) / 2>); new rlc_ringbuffer_t<rlc_amd_tx_pdu_nr, am_window_size(rlc_am_nr_sn_size_t::size18bits)>);
retx_queue = std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> >( retx_queue = std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> >(
new pdu_retx_queue<rlc_amd_retx_nr_t, cardinality(rlc_am_nr_sn_size_t::size18bits) / 2>); new pdu_retx_queue<rlc_amd_retx_nr_t, am_window_size(rlc_am_nr_sn_size_t::size18bits)>);
break; break;
default: default:
RlcError("attempt to configure unsupported tx_sn_field_length %s", to_string(cfg.tx_sn_field_length)); RlcError("attempt to configure unsupported tx_sn_field_length %s", to_string(cfg.tx_sn_field_length));
@ -943,7 +943,7 @@ uint32_t rlc_am_nr_tx::tx_mod_base_nr(uint32_t sn) const
uint32_t rlc_am_nr_tx::tx_window_size() const uint32_t rlc_am_nr_tx::tx_window_size() const
{ {
return cardinality(cfg.tx_sn_field_length) / 2; return am_window_size(cfg.tx_sn_field_length);
} }
bool rlc_am_nr_tx::inside_tx_window(uint32_t sn) const bool rlc_am_nr_tx::inside_tx_window(uint32_t sn) const
@ -995,11 +995,11 @@ bool rlc_am_nr_rx::configure(const rlc_config_t& cfg_)
switch (cfg.rx_sn_field_length) { switch (cfg.rx_sn_field_length) {
case rlc_am_nr_sn_size_t::size12bits: case rlc_am_nr_sn_size_t::size12bits:
rx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> >( rx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> >(
new rlc_ringbuffer_t<rlc_amd_rx_sdu_nr_t, cardinality(rlc_am_nr_sn_size_t::size12bits) / 2>); new rlc_ringbuffer_t<rlc_amd_rx_sdu_nr_t, am_window_size(rlc_am_nr_sn_size_t::size12bits)>);
break; break;
case rlc_am_nr_sn_size_t::size18bits: case rlc_am_nr_sn_size_t::size18bits:
rx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> >( rx_window = std::unique_ptr<rlc_ringbuffer_base<rlc_amd_rx_sdu_nr_t> >(
new rlc_ringbuffer_t<rlc_amd_rx_sdu_nr_t, cardinality(rlc_am_nr_sn_size_t::size18bits) / 2>); new rlc_ringbuffer_t<rlc_amd_rx_sdu_nr_t, am_window_size(rlc_am_nr_sn_size_t::size18bits)>);
break; break;
default: default:
RlcError("attempt to configure unsupported rx_sn_field_length %s", to_string(cfg.rx_sn_field_length)); RlcError("attempt to configure unsupported rx_sn_field_length %s", to_string(cfg.rx_sn_field_length));
@ -1383,7 +1383,7 @@ uint32_t rlc_am_nr_rx::rx_mod_base_nr(uint32_t sn) const
uint32_t rlc_am_nr_rx::rx_window_size() const uint32_t rlc_am_nr_rx::rx_window_size() const
{ {
return cardinality(cfg.rx_sn_field_length) / 2; return am_window_size(cfg.rx_sn_field_length);
} }
bool rlc_am_nr_rx::inside_rx_window(uint32_t sn) bool rlc_am_nr_rx::inside_rx_window(uint32_t sn)

Loading…
Cancel
Save