expose RLC tx queue length through config struct

This commit is contained in:
Andre Puschmann 2019-01-02 14:52:11 +01:00
parent 84c8626808
commit 86232c143e
8 changed files with 61 additions and 79 deletions

View File

@ -50,13 +50,12 @@ class rlc
public: public:
rlc(); rlc();
virtual ~rlc(); virtual ~rlc();
void init(srsue::pdcp_interface_rlc *pdcp_, void init(srsue::pdcp_interface_rlc* pdcp_,
srsue::rrc_interface_rlc *rrc_, srsue::rrc_interface_rlc* rrc_,
srsue::ue_interface *ue_, srsue::ue_interface* ue_,
log *rlc_log_, log* rlc_log_,
mac_interface_timers *mac_timers_, mac_interface_timers* mac_timers_,
uint32_t lcid_, uint32_t lcid_);
int buffer_size_ = -1); // -1 to use default buffer sizes
void stop(); void stop();
void get_metrics(rlc_metrics_t &m); void get_metrics(rlc_metrics_t &m);
@ -109,7 +108,6 @@ private:
pthread_rwlock_t rwlock; pthread_rwlock_t rwlock;
uint32_t default_lcid; uint32_t default_lcid;
int buffer_size;
// Timer needed for metrics calculation // Timer needed for metrics calculation
struct timeval metrics_time[3]; struct timeval metrics_time[3];

View File

@ -69,7 +69,7 @@ struct rlc_amd_retx_t{
class rlc_am : public rlc_common class rlc_am : public rlc_common
{ {
public: public:
rlc_am(uint32_t queue_len = 128); rlc_am();
~rlc_am(); ~rlc_am();
void init(log *log_, void init(log *log_,
uint32_t lcid_, uint32_t lcid_,
@ -104,11 +104,11 @@ private:
class rlc_am_tx : public timer_callback class rlc_am_tx : public timer_callback
{ {
public: public:
rlc_am_tx(rlc_am *parent_, uint32_t queue_len_); rlc_am_tx(rlc_am* parent_);
~rlc_am_tx(); ~rlc_am_tx();
void init(); void init();
bool configure(srslte_rlc_am_config_t cfg_); bool configure(srslte_rlc_config_t cfg_);
void empty_queue(); void empty_queue();
void reestablish(); void reestablish();

View File

@ -30,6 +30,8 @@
// for custom constructors // for custom constructors
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#define RLC_TX_QUEUE_LEN (128)
namespace srslte { namespace srslte {
typedef enum{ typedef enum{
@ -86,12 +88,13 @@ typedef struct {
class srslte_rlc_config_t class srslte_rlc_config_t
{ {
public: public:
rlc_mode_t rlc_mode; rlc_mode_t rlc_mode;
srslte_rlc_am_config_t am; srslte_rlc_am_config_t am;
srslte_rlc_um_config_t um; srslte_rlc_um_config_t um;
uint32_t tx_queue_length;
// Default ctor // 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 // 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() 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 // Handle default case
break; break;
} }
tx_queue_length = RLC_TX_QUEUE_LEN;
} }
// Factory for MCH // Factory for MCH
@ -145,6 +150,7 @@ public:
cfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cfg.um.tx_mod = 32; cfg.um.tx_mod = 32;
cfg.um.is_mrb = true; cfg.um.is_mrb = true;
cfg.tx_queue_length = 512;
return cfg; return cfg;
} }
}; };

View File

@ -48,7 +48,7 @@ class rlc_um
:public rlc_common :public rlc_common
{ {
public: public:
rlc_um(uint32_t queue_len = 128); rlc_um();
~rlc_um(); ~rlc_um();
void init(log *rlc_entity_log_, void init(log *rlc_entity_log_,
uint32_t lcid_, uint32_t lcid_,
@ -84,7 +84,7 @@ private:
class rlc_um_tx class rlc_um_tx
{ {
public: public:
rlc_um_tx(uint32_t queue_len); rlc_um_tx();
~rlc_um_tx(); ~rlc_um_tx();
void init(srslte::log *log_); void init(srslte::log *log_);
bool configure(srslte_rlc_config_t cfg, std::string rb_name); bool configure(srslte_rlc_config_t cfg, std::string rb_name);

View File

@ -42,8 +42,6 @@ rlc::rlc()
rrc = NULL; rrc = NULL;
mac_timers = NULL; mac_timers = NULL;
ue = NULL; ue = NULL;
default_lcid = 0;
buffer_size = 0;
bzero(metrics_time, sizeof(metrics_time)); bzero(metrics_time, sizeof(metrics_time));
pthread_rwlock_init(&rwlock, NULL); pthread_rwlock_init(&rwlock, NULL);
} }
@ -66,13 +64,12 @@ rlc::~rlc()
pthread_rwlock_destroy(&rwlock); pthread_rwlock_destroy(&rwlock);
} }
void rlc::init(srsue::pdcp_interface_rlc *pdcp_, void rlc::init(srsue::pdcp_interface_rlc* pdcp_,
srsue::rrc_interface_rlc *rrc_, srsue::rrc_interface_rlc* rrc_,
srsue::ue_interface *ue_, srsue::ue_interface* ue_,
log *rlc_log_, log* rlc_log_,
mac_interface_timers *mac_timers_, mac_interface_timers* mac_timers_,
uint32_t lcid_, uint32_t lcid_)
int buffer_size_)
{ {
pdcp = pdcp_; pdcp = pdcp_;
rrc = rrc_; rrc = rrc_;
@ -80,7 +77,6 @@ void rlc::init(srsue::pdcp_interface_rlc *pdcp_,
rlc_log = rlc_log_; rlc_log = rlc_log_;
mac_timers = mac_timers_; mac_timers = mac_timers_;
default_lcid = lcid_; default_lcid = lcid_;
buffer_size = buffer_size_;
gettimeofday(&metrics_time[1], NULL); gettimeofday(&metrics_time[1], NULL);
reset_metrics(); reset_metrics();

View File

@ -38,16 +38,7 @@
namespace srslte { namespace srslte {
rlc_am::rlc_am(uint32_t queue_len) rlc_am::rlc_am() : tx(this), rx(this), log(NULL), rrc(NULL), pdcp(NULL), mac_timers(NULL), lcid(0), rb_name(""), cfg()
:tx(this, queue_len)
,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; return false;
} }
if (not tx.configure(cfg_.am)) { if (not tx.configure(cfg_)) {
return false; return false;
} }
@ -176,26 +167,25 @@ void rlc_am::write_pdu(uint8_t *payload, uint32_t nof_bytes)
* Tx subclass implementation * Tx subclass implementation
***************************************************************************/ ***************************************************************************/
rlc_am::rlc_am_tx::rlc_am_tx(rlc_am* parent_, uint32_t queue_len_) rlc_am::rlc_am_tx::rlc_am_tx(rlc_am* parent_) :
:parent(parent_) parent(parent_),
,poll_retx_timer(NULL) poll_retx_timer(NULL),
,poll_retx_timer_id(0) poll_retx_timer_id(0),
,status_prohibit_timer(NULL) status_prohibit_timer(NULL),
,status_prohibit_timer_id(0) status_prohibit_timer_id(0),
,vt_a(0) vt_a(0),
,vt_ms(RLC_AM_WINDOW_SIZE) vt_ms(RLC_AM_WINDOW_SIZE),
,vt_s(0) vt_s(0),
,status_prohibited(false) status_prohibited(false),
,poll_sn(0) poll_sn(0),
,num_tx_bytes(0) num_tx_bytes(0),
,pdu_without_poll(0) pdu_without_poll(0),
,byte_without_poll(0) byte_without_poll(0),
,tx_sdu(NULL) tx_sdu(NULL),
,tx_sdu_queue(queue_len_) log(NULL),
,log(NULL) cfg(),
,cfg() pool(byte_buffer_pool::get_instance()),
,pool(byte_buffer_pool::get_instance()) tx_enabled(false)
,tx_enabled(false)
{ {
pthread_mutex_init(&mutex, NULL); pthread_mutex_init(&mutex, NULL);
ZERO_OBJECT(tx_status); 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 // TODO: add config checks
cfg = cfg_; cfg = cfg_.am;
// check timers // check timers
if (poll_retx_timer == NULL or status_prohibit_timer == NULL) { 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<uint32_t>(cfg.t_poll_retx)); poll_retx_timer->set(this, static_cast<uint32_t>(cfg.t_poll_retx));
} }
tx_sdu_queue.resize(cfg_.tx_queue_length);
tx_enabled = true; tx_enabled = true;
return true; return true;

View File

@ -36,12 +36,7 @@ using namespace asn1::rrc;
namespace srslte { namespace srslte {
rlc_um::rlc_um(uint32_t queue_len) rlc_um::rlc_um() : lcid(0), tx(), pool(byte_buffer_pool::get_instance()), rrc(NULL), log(NULL)
:lcid(0)
,tx(queue_len)
,pool(byte_buffer_pool::get_instance())
,rrc(NULL)
,log(NULL)
{ {
bzero(&cfg, sizeof(srslte_rlc_um_config_t)); 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 * Tx subclass implementation
***************************************************************************/ ***************************************************************************/
rlc_um::rlc_um_tx::rlc_um_tx(uint32_t queue_len) rlc_um::rlc_um_tx::rlc_um_tx() :
:tx_sdu_queue(queue_len) pool(byte_buffer_pool::get_instance()),
,pool(byte_buffer_pool::get_instance()) log(NULL),
,log(NULL) tx_sdu(NULL),
,tx_sdu(NULL) vt_us(0),
,vt_us(0) tx_enabled(false),
,tx_enabled(false) num_tx_bytes(0)
,num_tx_bytes(0)
{ {
pthread_mutex_init(&mutex, NULL); 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; return false;
} }
if(cfg.is_mrb){ tx_sdu_queue.resize(cnfg_.tx_queue_length);
tx_sdu_queue.resize(512);
}
rb_name = rb_name_; rb_name = rb_name_;
tx_enabled = true; tx_enabled = true;

View File

@ -94,8 +94,6 @@ private:
void clear_user(user_interface *ue); void clear_user(user_interface *ue);
const static int RLC_TX_QUEUE_LEN = 512;
pthread_rwlock_t rwlock; pthread_rwlock_t rwlock;
std::map<uint32_t,user_interface> users; std::map<uint32_t,user_interface> users;