Moving some initialization from init function to constructor in the PDCP entities.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 768ce745dc
commit 15613465cf

@ -32,7 +32,7 @@ namespace srslte {
class pdcp : public srsue::pdcp_interface_rlc, public srsue::pdcp_interface_rrc
{
public:
pdcp(log* log_);
pdcp(srslte::timer_handler* timers_, log* log_);
virtual ~pdcp();
void init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_);
void stop();
@ -79,6 +79,7 @@ private:
typedef std::map<uint16_t, pdcp_entity_lte*> pdcp_map_t;
typedef std::pair<uint16_t, pdcp_entity_lte*> pdcp_map_pair_t;
srslte::timer_handler* timers = nullptr;
log* pdcp_log = nullptr;
pdcp_map_t pdcp_array, pdcp_array_mrb;
pthread_rwlock_t rwlock;

@ -58,7 +58,7 @@ static const char pdcp_d_c_text[PDCP_D_C_N_ITEMS][20] = {"Control PDU", "Data PD
class pdcp_entity_base
{
public:
pdcp_entity_base();
pdcp_entity_base(srslte::timer_handler* timers_, srslte::log* log_);
virtual ~pdcp_entity_base();
virtual void reset() = 0;
virtual void reestablish() = 0;

@ -46,14 +46,13 @@ namespace srslte {
class pdcp_entity_lte final : public pdcp_entity_base
{
public:
pdcp_entity_lte();
~pdcp_entity_lte();
void init(srsue::rlc_interface_pdcp* rlc_,
pdcp_entity_lte(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::log* log_,
uint32_t lcid_,
pdcp_config_t cfg_);
srslte::timer_handler* timers_,
srslte::log* log_);
~pdcp_entity_lte();
void init(uint32_t lcid_, pdcp_config_t cfg_);
void reset();
void reestablish();

@ -40,14 +40,13 @@ namespace srslte {
class pdcp_entity_nr : public pdcp_entity_base
{
public:
pdcp_entity_nr();
~pdcp_entity_nr();
void init(srsue::rlc_interface_pdcp* rlc_,
pdcp_entity_nr(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::timer_handler* timers_,
srslte::log* log_,
uint32_t lcid_,
srslte::log* log_);
~pdcp_entity_nr();
void init( uint32_t lcid_,
pdcp_config_t cfg_);
void reset();
void reestablish();

@ -23,7 +23,7 @@
namespace srslte {
pdcp::pdcp(srslte::log* log_) : pdcp_log(log_)
pdcp::pdcp(srslte::timer_handler* timers_, srslte::log* log_) : timers(timers_), pdcp_log(log_)
{
pthread_rwlock_init(&rwlock, NULL);
}
@ -124,11 +124,11 @@ void pdcp::add_bearer(uint32_t lcid, pdcp_config_t cfg)
{
pthread_rwlock_wrlock(&rwlock);
if (not valid_lcid(lcid)) {
if (not pdcp_array.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte())).second) {
if (not pdcp_array.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte(rlc, rrc, gw, timers, pdcp_log))).second) {
pdcp_log->error("Error inserting PDCP entity in to array\n.");
goto unlock_and_exit;
}
pdcp_array.at(lcid)->init(rlc, rrc, gw, pdcp_log, lcid, cfg);
pdcp_array.at(lcid)->init(lcid, cfg);
pdcp_log->info("Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)\n",
rrc->get_rb_name(lcid).c_str(),
lcid,
@ -145,11 +145,11 @@ void pdcp::add_bearer_mrb(uint32_t lcid, pdcp_config_t cfg)
{
pthread_rwlock_wrlock(&rwlock);
if (not valid_mch_lcid(lcid)) {
if (not pdcp_array_mrb.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte())).second) {
if (not pdcp_array_mrb.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte(rlc, rrc, gw, timers, pdcp_log))).second) {
pdcp_log->error("Error inserting PDCP entity in to array\n.");
goto unlock_and_exit;
}
pdcp_array_mrb.at(lcid)->init(rlc, rrc, gw, pdcp_log, lcid, cfg);
pdcp_array_mrb.at(lcid)->init( lcid, cfg);
pdcp_log->info("Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)\n",
rrc->get_rb_name(lcid).c_str(),
lcid,

@ -24,7 +24,7 @@
namespace srslte {
pdcp_entity_base::pdcp_entity_base() {}
pdcp_entity_base::pdcp_entity_base(srslte::timer_handler* timers_, srslte::log* log_) : log(log_), timers(timers_) {}
pdcp_entity_base::~pdcp_entity_base() {}

@ -24,21 +24,22 @@
namespace srslte {
pdcp_entity_lte::pdcp_entity_lte() {}
pdcp_entity_lte::pdcp_entity_lte(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::timer_handler* timers_,
srslte::log* log_) :
pdcp_entity_base(timers_, log_),
rlc(rlc_),
rrc(rrc_),
gw(gw_)
{
}
pdcp_entity_lte::~pdcp_entity_lte() {}
void pdcp_entity_lte::init(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::log* log_,
uint32_t lcid_,
pdcp_config_t cfg_)
void pdcp_entity_lte::init(uint32_t lcid_, pdcp_config_t cfg_)
{
rlc = rlc_;
rrc = rrc_;
gw = gw_;
log = log_;
lcid = lcid_;
cfg = cfg_;
active = true;

@ -25,23 +25,23 @@
namespace srslte {
pdcp_entity_nr::pdcp_entity_nr() : reordering_fnc(new pdcp_entity_nr::reordering_callback(this)) {}
pdcp_entity_nr::~pdcp_entity_nr() {}
void pdcp_entity_nr::init(srsue::rlc_interface_pdcp* rlc_,
pdcp_entity_nr::pdcp_entity_nr(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::timer_handler* timers_,
srslte::log* log_,
uint32_t lcid_,
pdcp_config_t cfg_)
srslte::log* log_) :
pdcp_entity_base(timers_, log_),
rlc(rlc_),
rrc(rrc_),
gw(gw_),
reordering_fnc(new pdcp_entity_nr::reordering_callback(this))
{
}
pdcp_entity_nr::~pdcp_entity_nr() {}
void pdcp_entity_nr::init(uint32_t lcid_, pdcp_config_t cfg_)
{
rlc = rlc_;
rrc = rrc_;
gw = gw_;
timers = timers_;
log = log_;
lcid = lcid_;
cfg = cfg_;
active = true;
@ -51,7 +51,7 @@ void pdcp_entity_nr::init(srsue::rlc_interface_pdcp* rlc_,
window_size = 1 << (cfg.sn_len - 1);
// Timers
reordering_timer = timers_->get_unique_timer();
reordering_timer = timers->get_unique_timer();
// configure timer
if (static_cast<uint32_t>(cfg.t_reordering) > 0) {

@ -148,9 +148,10 @@ public:
rlc(log),
rrc(log),
gw(log),
timers(64)
timers(64),
pdcp(&rlc, &rrc, &gw, &timers, log)
{
pdcp.init(&rlc, &rrc, &gw, &timers, log, 0, cfg);
pdcp.init(0, cfg);
pdcp.config_security(
sec_cfg.k_enc_rrc, sec_cfg.k_int_rrc, sec_cfg.k_enc_up, sec_cfg.k_int_up, sec_cfg.enc_algo, sec_cfg.int_algo);
pdcp.enable_integrity();
@ -165,11 +166,11 @@ public:
pdcp.set_rx_reord(init_state.rx_reord);
}
srslte::timer_handler timers;
srslte::pdcp_entity_nr pdcp;
rlc_dummy rlc;
rrc_dummy rrc;
gw_dummy gw;
srslte::timer_handler timers;
srslte::pdcp_entity_nr pdcp;
};
// Helper function to generate PDUs

@ -19,10 +19,11 @@
*
*/
#include <map>
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/timers.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/upper/pdcp.h"
#include <map>
#ifndef SRSENB_PDCP_H
#define SRSENB_PDCP_H
@ -32,7 +33,7 @@ namespace srsenb {
class pdcp : public pdcp_interface_rlc, public pdcp_interface_gtpu, public pdcp_interface_rrc
{
public:
pdcp(srslte::log* pdcp_log_);
pdcp(srslte::timer_handler* timers, srslte::log* pdcp_log_);
virtual ~pdcp() {};
void init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_);
void stop();
@ -110,6 +111,7 @@ private:
rlc_interface_pdcp* rlc;
rrc_interface_pdcp* rrc;
gtpu_interface_pdcp* gtpu;
srslte::timer_handler* timers;
srslte::log* log_h;
srslte::byte_buffer_pool* pool;
};

@ -29,7 +29,11 @@ using namespace srslte;
namespace srsenb {
enb_stack_lte::enb_stack_lte(srslte::logger* logger_) : logger(logger_), pdcp(&pdcp_log), timers(128), thread("STACK")
enb_stack_lte::enb_stack_lte(srslte::logger* logger_) :
timers(128),
logger(logger_),
pdcp(&timers, &pdcp_log),
thread("STACK")
{
enb_queue_id = pending_tasks.add_queue();
sync_queue_id = pending_tasks.add_queue();

@ -24,7 +24,12 @@
namespace srsenb {
pdcp::pdcp(srslte::log* log_) : log_h(log_), pool(srslte::byte_buffer_pool::get_instance()) {}
pdcp::pdcp(srslte::timer_handler* timers_, srslte::log* log_) :
timers(timers_),
log_h(log_),
pool(srslte::byte_buffer_pool::get_instance())
{
}
void pdcp::init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_)
{
@ -50,7 +55,7 @@ void pdcp::add_user(uint16_t rnti)
{
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti) == 0) {
srslte::pdcp* obj = new srslte::pdcp(log_h);
srslte::pdcp* obj = new srslte::pdcp(timers, log_h);
obj->init(&users[rnti].rlc_itf, &users[rnti].rrc_itf, &users[rnti].gtpu_itf);
users[rnti].rlc_itf.rnti = rnti;
users[rnti].gtpu_itf.rnti = rnti;

@ -36,7 +36,7 @@ ue_stack_lte::ue_stack_lte() :
rlc(&rlc_log),
mac(&mac_log),
rrc(&rrc_log),
pdcp(&pdcp_log),
pdcp(&timers, &pdcp_log),
nas(&nas_log, &timers),
thread("STACK"),
pending_tasks(1024),

Loading…
Cancel
Save