diff --git a/lib/include/srslte/upper/rlc.h b/lib/include/srslte/upper/rlc.h index 6f0f2d21f..642d59fac 100644 --- a/lib/include/srslte/upper/rlc.h +++ b/lib/include/srslte/upper/rlc.h @@ -50,13 +50,12 @@ class rlc public: rlc(); virtual ~rlc(); - void init(srsue::pdcp_interface_rlc *pdcp_, - srsue::rrc_interface_rlc *rrc_, - srsue::ue_interface *ue_, - log *rlc_log_, - mac_interface_timers *mac_timers_, - uint32_t lcid_, - int buffer_size_ = -1); // -1 to use default buffer sizes + void init(srsue::pdcp_interface_rlc* pdcp_, + srsue::rrc_interface_rlc* rrc_, + srsue::ue_interface* ue_, + log* rlc_log_, + mac_interface_timers* mac_timers_, + uint32_t lcid_); void stop(); void get_metrics(rlc_metrics_t &m); @@ -109,7 +108,6 @@ private: pthread_rwlock_t rwlock; uint32_t default_lcid; - int buffer_size; // Timer needed for metrics calculation struct timeval metrics_time[3]; diff --git a/lib/include/srslte/upper/rlc_am.h b/lib/include/srslte/upper/rlc_am.h index 29d44a2a4..d67dbb53b 100644 --- a/lib/include/srslte/upper/rlc_am.h +++ b/lib/include/srslte/upper/rlc_am.h @@ -69,7 +69,7 @@ struct rlc_amd_retx_t{ class rlc_am : public rlc_common { public: - rlc_am(uint32_t queue_len = 128); + rlc_am(); ~rlc_am(); void init(log *log_, uint32_t lcid_, @@ -104,11 +104,11 @@ private: class rlc_am_tx : public timer_callback { public: - rlc_am_tx(rlc_am *parent_, uint32_t queue_len_); + rlc_am_tx(rlc_am* parent_); ~rlc_am_tx(); void init(); - bool configure(srslte_rlc_am_config_t cfg_); + bool configure(srslte_rlc_config_t cfg_); void empty_queue(); void reestablish(); diff --git a/lib/include/srslte/upper/rlc_interface.h b/lib/include/srslte/upper/rlc_interface.h index 6a0869b52..9549cdd38 100644 --- a/lib/include/srslte/upper/rlc_interface.h +++ b/lib/include/srslte/upper/rlc_interface.h @@ -30,6 +30,8 @@ // for custom constructors #include "srslte/asn1/rrc_asn1.h" +#define RLC_TX_QUEUE_LEN (128) + namespace srslte { typedef enum{ @@ -86,12 +88,13 @@ typedef struct { class srslte_rlc_config_t { public: - rlc_mode_t rlc_mode; - srslte_rlc_am_config_t am; - srslte_rlc_um_config_t um; + rlc_mode_t rlc_mode; + srslte_rlc_am_config_t am; + srslte_rlc_um_config_t um; + uint32_t tx_queue_length; // Default ctor - srslte_rlc_config_t(): rlc_mode(RLC_MODE_TM), am(), um() {}; + srslte_rlc_config_t() : rlc_mode(RLC_MODE_TM), am(), um(), tx_queue_length(RLC_TX_QUEUE_LEN){}; // Constructor based on rrc_asn1's RLC config srslte_rlc_config_t(asn1::rrc::rlc_cfg_c* cnfg) : rlc_mode(RLC_MODE_AM), am(), um() @@ -131,6 +134,8 @@ public: // Handle default case break; } + + tx_queue_length = RLC_TX_QUEUE_LEN; } // Factory for MCH @@ -145,6 +150,7 @@ public: cfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cfg.um.tx_mod = 32; cfg.um.is_mrb = true; + cfg.tx_queue_length = 512; return cfg; } }; diff --git a/lib/include/srslte/upper/rlc_um.h b/lib/include/srslte/upper/rlc_um.h index 48ad0da17..7f947b94f 100644 --- a/lib/include/srslte/upper/rlc_um.h +++ b/lib/include/srslte/upper/rlc_um.h @@ -48,7 +48,7 @@ class rlc_um :public rlc_common { public: - rlc_um(uint32_t queue_len = 128); + rlc_um(); ~rlc_um(); void init(log *rlc_entity_log_, uint32_t lcid_, @@ -84,7 +84,7 @@ private: class rlc_um_tx { public: - rlc_um_tx(uint32_t queue_len); + rlc_um_tx(); ~rlc_um_tx(); void init(srslte::log *log_); bool configure(srslte_rlc_config_t cfg, std::string rb_name); diff --git a/lib/src/upper/rlc.cc b/lib/src/upper/rlc.cc index 4111c5b5b..c8516ac3a 100644 --- a/lib/src/upper/rlc.cc +++ b/lib/src/upper/rlc.cc @@ -42,8 +42,6 @@ rlc::rlc() rrc = NULL; mac_timers = NULL; ue = NULL; - default_lcid = 0; - buffer_size = 0; bzero(metrics_time, sizeof(metrics_time)); pthread_rwlock_init(&rwlock, NULL); } @@ -66,13 +64,12 @@ rlc::~rlc() pthread_rwlock_destroy(&rwlock); } -void rlc::init(srsue::pdcp_interface_rlc *pdcp_, - srsue::rrc_interface_rlc *rrc_, - srsue::ue_interface *ue_, - log *rlc_log_, - mac_interface_timers *mac_timers_, - uint32_t lcid_, - int buffer_size_) +void rlc::init(srsue::pdcp_interface_rlc* pdcp_, + srsue::rrc_interface_rlc* rrc_, + srsue::ue_interface* ue_, + log* rlc_log_, + mac_interface_timers* mac_timers_, + uint32_t lcid_) { pdcp = pdcp_; rrc = rrc_; @@ -80,7 +77,6 @@ void rlc::init(srsue::pdcp_interface_rlc *pdcp_, rlc_log = rlc_log_; mac_timers = mac_timers_; default_lcid = lcid_; - buffer_size = buffer_size_; gettimeofday(&metrics_time[1], NULL); reset_metrics(); diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 6d34ee8e9..9cff3ad87 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -38,16 +38,7 @@ namespace srslte { -rlc_am::rlc_am(uint32_t queue_len) - :tx(this, queue_len) - ,rx(this) - ,log(NULL) - ,rrc(NULL) - ,pdcp(NULL) - ,mac_timers(NULL) - ,lcid(0) - ,rb_name("") - ,cfg() +rlc_am::rlc_am() : tx(this), rx(this), log(NULL), rrc(NULL), pdcp(NULL), mac_timers(NULL), lcid(0), rb_name(""), cfg() { } @@ -80,7 +71,7 @@ bool rlc_am::configure(srslte_rlc_config_t cfg_) return false; } - if (not tx.configure(cfg_.am)) { + if (not tx.configure(cfg_)) { return false; } @@ -176,26 +167,25 @@ void rlc_am::write_pdu(uint8_t *payload, uint32_t nof_bytes) * Tx subclass implementation ***************************************************************************/ -rlc_am::rlc_am_tx::rlc_am_tx(rlc_am* parent_, uint32_t queue_len_) - :parent(parent_) - ,poll_retx_timer(NULL) - ,poll_retx_timer_id(0) - ,status_prohibit_timer(NULL) - ,status_prohibit_timer_id(0) - ,vt_a(0) - ,vt_ms(RLC_AM_WINDOW_SIZE) - ,vt_s(0) - ,status_prohibited(false) - ,poll_sn(0) - ,num_tx_bytes(0) - ,pdu_without_poll(0) - ,byte_without_poll(0) - ,tx_sdu(NULL) - ,tx_sdu_queue(queue_len_) - ,log(NULL) - ,cfg() - ,pool(byte_buffer_pool::get_instance()) - ,tx_enabled(false) +rlc_am::rlc_am_tx::rlc_am_tx(rlc_am* parent_) : + parent(parent_), + poll_retx_timer(NULL), + poll_retx_timer_id(0), + status_prohibit_timer(NULL), + status_prohibit_timer_id(0), + vt_a(0), + vt_ms(RLC_AM_WINDOW_SIZE), + vt_s(0), + status_prohibited(false), + poll_sn(0), + num_tx_bytes(0), + pdu_without_poll(0), + byte_without_poll(0), + tx_sdu(NULL), + log(NULL), + cfg(), + pool(byte_buffer_pool::get_instance()), + tx_enabled(false) { pthread_mutex_init(&mutex, NULL); ZERO_OBJECT(tx_status); @@ -219,10 +209,10 @@ void rlc_am::rlc_am_tx::init() } } -bool rlc_am::rlc_am_tx::configure(srslte_rlc_am_config_t cfg_) +bool rlc_am::rlc_am_tx::configure(srslte_rlc_config_t cfg_) { // TODO: add config checks - cfg = cfg_; + cfg = cfg_.am; // check timers if (poll_retx_timer == NULL or status_prohibit_timer == NULL) { @@ -238,6 +228,8 @@ bool rlc_am::rlc_am_tx::configure(srslte_rlc_am_config_t cfg_) poll_retx_timer->set(this, static_cast(cfg.t_poll_retx)); } + tx_sdu_queue.resize(cfg_.tx_queue_length); + tx_enabled = true; return true; diff --git a/lib/src/upper/rlc_um.cc b/lib/src/upper/rlc_um.cc index 55b61f008..2c1858661 100644 --- a/lib/src/upper/rlc_um.cc +++ b/lib/src/upper/rlc_um.cc @@ -36,12 +36,7 @@ using namespace asn1::rrc; namespace srslte { -rlc_um::rlc_um(uint32_t queue_len) - :lcid(0) - ,tx(queue_len) - ,pool(byte_buffer_pool::get_instance()) - ,rrc(NULL) - ,log(NULL) +rlc_um::rlc_um() : lcid(0), tx(), pool(byte_buffer_pool::get_instance()), rrc(NULL), log(NULL) { bzero(&cfg, sizeof(srslte_rlc_um_config_t)); } @@ -221,14 +216,13 @@ std::string rlc_um::get_rb_name(srsue::rrc_interface_rlc *rrc, uint32_t lcid, bo * Tx subclass implementation ***************************************************************************/ -rlc_um::rlc_um_tx::rlc_um_tx(uint32_t queue_len) - :tx_sdu_queue(queue_len) - ,pool(byte_buffer_pool::get_instance()) - ,log(NULL) - ,tx_sdu(NULL) - ,vt_us(0) - ,tx_enabled(false) - ,num_tx_bytes(0) +rlc_um::rlc_um_tx::rlc_um_tx() : + pool(byte_buffer_pool::get_instance()), + log(NULL), + tx_sdu(NULL), + vt_us(0), + tx_enabled(false), + num_tx_bytes(0) { pthread_mutex_init(&mutex, NULL); } @@ -255,9 +249,7 @@ bool rlc_um::rlc_um_tx::configure(srslte_rlc_config_t cnfg_, std::string rb_name return false; } - if(cfg.is_mrb){ - tx_sdu_queue.resize(512); - } + tx_sdu_queue.resize(cnfg_.tx_queue_length); rb_name = rb_name_; tx_enabled = true; diff --git a/srsenb/hdr/upper/rlc.h b/srsenb/hdr/upper/rlc.h index 05d4681f1..6ca7ee195 100644 --- a/srsenb/hdr/upper/rlc.h +++ b/srsenb/hdr/upper/rlc.h @@ -94,8 +94,6 @@ private: void clear_user(user_interface *ue); - const static int RLC_TX_QUEUE_LEN = 512; - pthread_rwlock_t rwlock; std::map users;