common interface for stack multiqueue tasks, background tasks and timers

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent 6911ee3004
commit 30ae2226c1

@ -22,6 +22,7 @@
#ifndef SRSLTE_INTERFACES_COMMON_H
#define SRSLTE_INTERFACES_COMMON_H
#include "srslte/common/multiqueue.h"
#include "srslte/common/security.h"
#include "srslte/common/timers.h"
#include <string>
@ -77,6 +78,17 @@ public:
virtual int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_bytes) = 0;
};
// Generic Task Management + Timer interface for upper stack
class task_handler_interface
{
public:
virtual srslte::timer_handler::unique_timer get_unique_timer() = 0;
virtual srslte::task_multiqueue::queue_handler make_task_queue() = 0;
virtual void defer_callback(uint32_t duration_ms, std::function<void()> func) = 0;
virtual void enqueue_background_task(std::function<void(uint32_t)> task) = 0;
virtual void notify_background_task_result(srslte::move_task_t task) = 0;
};
} // namespace srslte
#endif // SRSLTE_INTERFACES_COMMON_H

@ -508,13 +508,6 @@ typedef struct {
int link_failure_nof_err;
} mac_args_t;
class enb_task_interface_lte
{
public:
virtual srslte::timer_handler::unique_timer get_unique_timer() = 0;
virtual srslte::task_multiqueue::queue_handler get_task_queue() = 0;
};
class stack_interface_s1ap_lte
{
public:
@ -530,7 +523,7 @@ public:
};
// STACK interface for MAC
class stack_interface_mac_lte : public enb_task_interface_lte
class stack_interface_mac_lte : public srslte::task_handler_interface
{
};

@ -207,8 +207,8 @@ public:
class nas_interface_ue
{
public:
virtual void start_attach_proc(srslte::proc_state_t* proc_result, srslte::establishment_cause_t cause_) = 0;
virtual bool detach_request(const bool switch_off) = 0;
virtual void start_attach_proc(srslte::proc_state_t* proc_result, srslte::establishment_cause_t cause_) = 0;
virtual bool detach_request(const bool switch_off) = 0;
};
// PDCP interface for RRC
@ -598,29 +598,8 @@ class gw_interface_stack : public gw_interface_nas, public gw_interface_rrc, pub
{
};
// Generic Task Management + Timer interface for upper stack
class task_handler_interface_lte
{
public:
virtual srslte::timer_handler::unique_timer get_unique_timer() = 0;
virtual srslte::task_multiqueue::queue_handler make_task_queue() = 0;
virtual void enqueue_background_task(std::function<void(uint32_t)> task) = 0;
virtual void notify_background_task_result(srslte::move_task_t task) = 0;
virtual void defer_callback(uint32_t duration_ms, std::function<void()> func) = 0;
};
// STACK interface for MAC
class stack_interface_mac : public task_handler_interface_lte
{
};
// STACK interface for MAC
class stack_interface_nas : public task_handler_interface_lte
{
};
// STACK interface for RRC
class stack_interface_rrc : public task_handler_interface_lte
class stack_interface_rrc : public srslte::task_handler_interface
{
public:
virtual void start_cell_search() = 0;

@ -26,7 +26,7 @@
namespace srsue {
class stack_dummy_interface : public stack_interface_rrc, public stack_interface_mac, public stack_interface_nas
class stack_test_dummy : public stack_interface_rrc
{
public:
srslte::timer_handler::unique_timer get_unique_timer() override { return timers.get_unique_timer(); }

@ -32,7 +32,7 @@ namespace srslte {
class pdcp : public srsue::pdcp_interface_rlc, public srsue::pdcp_interface_rrc
{
public:
pdcp(srslte::timer_handler* timers_, const char* logname);
pdcp(srslte::task_handler_interface* task_executor_, const char* logname);
virtual ~pdcp();
void init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_);
void stop();
@ -71,9 +71,9 @@ 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;
srslte::log_ref pdcp_log;
pdcp_map_t pdcp_array, pdcp_array_mrb;
srslte::task_handler_interface* task_executor = nullptr;
srslte::log_ref pdcp_log;
pdcp_map_t pdcp_array, pdcp_array_mrb;
// cache valid lcids to be checked from separate thread
std::mutex cache_mutex;

@ -63,7 +63,7 @@ static const char srslte_direction_text[DIRECTION_N_ITEMS][6] = {"none", "tx", "
class pdcp_entity_base
{
public:
pdcp_entity_base(srslte::timer_handler* timers_, srslte::log_ref log_);
pdcp_entity_base(srslte::task_handler_interface* task_executor_, srslte::log_ref log_);
virtual ~pdcp_entity_base();
virtual void reset() = 0;
virtual void reestablish() = 0;
@ -111,8 +111,8 @@ public:
uint32_t COUNT(uint32_t hfn, uint32_t sn);
protected:
srslte::log_ref log;
srslte::timer_handler* timers = nullptr;
srslte::log_ref log;
srslte::task_handler_interface* task_executor = nullptr;
bool active = false;
uint32_t lcid = 0;

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

@ -41,11 +41,11 @@ namespace srslte {
class pdcp_entity_nr : public pdcp_entity_base
{
public:
pdcp_entity_nr(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::timer_handler* timers_,
srslte::log_ref log_);
pdcp_entity_nr(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::task_handler_interface* task_executor_,
srslte::log_ref log_);
~pdcp_entity_nr();
void init(uint32_t lcid_, pdcp_config_t cfg_);
void reset();

@ -23,7 +23,11 @@
namespace srslte {
pdcp::pdcp(srslte::timer_handler* timers_, const char* logname) : timers(timers_), pdcp_log(logname) {}
pdcp::pdcp(srslte::task_handler_interface* task_executor_, const char* logname) :
task_executor(task_executor_),
pdcp_log(logname)
{
}
pdcp::~pdcp()
{
@ -110,7 +114,8 @@ void pdcp::write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu)
void pdcp::add_bearer(uint32_t lcid, pdcp_config_t cfg)
{
if (not valid_lcid(lcid)) {
if (not pdcp_array.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte(rlc, rrc, gw, timers, pdcp_log))).second) {
if (not pdcp_array.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte(rlc, rrc, gw, task_executor, pdcp_log)))
.second) {
pdcp_log->error("Error inserting PDCP entity in to array\n.");
return;
}
@ -132,7 +137,8 @@ void pdcp::add_bearer(uint32_t lcid, pdcp_config_t cfg)
void pdcp::add_bearer_mrb(uint32_t lcid, pdcp_config_t cfg)
{
if (not valid_mch_lcid(lcid)) {
if (not pdcp_array_mrb.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte(rlc, rrc, gw, timers, pdcp_log))).second) {
if (not pdcp_array_mrb.insert(pdcp_map_pair_t(lcid, new pdcp_entity_lte(rlc, rrc, gw, task_executor, pdcp_log)))
.second) {
pdcp_log->error("Error inserting PDCP entity in to array\n.");
return;
}

@ -26,7 +26,11 @@
namespace srslte {
pdcp_entity_base::pdcp_entity_base(srslte::timer_handler* timers_, srslte::log_ref log_) : log(log_), timers(timers_) {}
pdcp_entity_base::pdcp_entity_base(srslte::task_handler_interface* task_executor_, srslte::log_ref log_) :
log(log_),
task_executor(task_executor_)
{
}
pdcp_entity_base::~pdcp_entity_base() {}

@ -24,12 +24,12 @@
namespace srslte {
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_ref log_) :
pdcp_entity_base(timers_, log_),
pdcp_entity_lte::pdcp_entity_lte(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::task_handler_interface* task_executor_,
srslte::log_ref log_) :
pdcp_entity_base(task_executor_, log_),
rlc(rlc_),
rrc(rrc_),
gw(gw_)

@ -24,12 +24,12 @@
namespace srslte {
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_ref log_) :
pdcp_entity_base(timers_, log_),
pdcp_entity_nr::pdcp_entity_nr(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
srslte::task_handler_interface* task_executor_,
srslte::log_ref log_) :
pdcp_entity_base(task_executor_, log_),
rlc(rlc_),
rrc(rrc_),
gw(gw_),
@ -50,7 +50,7 @@ void pdcp_entity_nr::init(uint32_t lcid_, pdcp_config_t cfg_)
window_size = 1 << (cfg.sn_len - 1);
// Timers
reordering_timer = timers->get_unique_timer();
reordering_timer = task_executor->get_unique_timer();
// configure timer
if (static_cast<uint32_t>(cfg.t_reordering) > 0) {
@ -102,7 +102,7 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking)
// Start discard timer
if (cfg.discard_timer != pdcp_discard_timer_t::infinity) {
timer_handler::unique_timer discard_timer = timers->get_unique_timer();
timer_handler::unique_timer discard_timer = task_executor->get_unique_timer();
discard_callback discard_fnc(this, tx_next);
discard_timer.set(static_cast<uint32_t>(cfg.discard_timer), discard_fnc);
discard_timer.run();

@ -23,6 +23,7 @@
#define SRSLTE_PDCP_LTE_TEST_H
#include "pdcp_base_test.h"
#include "srslte/test/ue_test_interfaces.h"
#include "srslte/upper/pdcp_entity_lte.h"
struct pdcp_lte_initial_state {
@ -78,8 +79,7 @@ public:
rlc(log),
rrc(log),
gw(log),
timers(64),
pdcp(&rlc, &rrc, &gw, &timers, log)
pdcp(&rlc, &rrc, &gw, &stack, log)
{
pdcp.init(0, cfg);
pdcp.config_security(sec_cfg);
@ -98,7 +98,7 @@ public:
rlc_dummy rlc;
rrc_dummy rrc;
gw_dummy gw;
srslte::timer_handler timers;
srsue::stack_test_dummy stack;
srslte::pdcp_entity_lte pdcp;
};

@ -46,7 +46,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
srslte::pdcp_entity_lte* pdcp_rx = &pdcp_hlp_rx.pdcp;
gw_dummy* gw_rx = &pdcp_hlp_rx.gw;
rrc_dummy* rrc_rx = &pdcp_hlp_rx.rrc;
srslte::timer_handler* timers_rx = &pdcp_hlp_rx.timers;
srslte::timer_handler* timers_rx = &pdcp_hlp_rx.stack.timers;
pdcp_hlp_rx.set_pdcp_initial_state(init_state);
// Generate test message and encript/decript SDU.

@ -23,6 +23,7 @@
#define SRSLTE_PDCP_NR_TEST_H
#include "pdcp_base_test.h"
#include "srslte/test/ue_test_interfaces.h"
#include "srslte/upper/pdcp_entity_nr.h"
struct pdcp_initial_state {
@ -99,8 +100,7 @@ public:
rlc(log),
rrc(log),
gw(log),
timers(64),
pdcp(&rlc, &rrc, &gw, &timers, log)
pdcp(&rlc, &rrc, &gw, &stack, log)
{
pdcp.init(0, cfg);
pdcp.config_security(sec_cfg);
@ -116,11 +116,11 @@ public:
pdcp.set_rx_reord(init_state.rx_reord);
}
rlc_dummy rlc;
rrc_dummy rrc;
gw_dummy gw;
srslte::timer_handler timers;
srslte::pdcp_entity_nr pdcp;
rlc_dummy rlc;
rrc_dummy rrc;
gw_dummy gw;
srsue::stack_test_dummy stack;
srslte::pdcp_entity_nr pdcp;
};
// Helper function to generate PDUs

@ -41,7 +41,7 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state,
pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, log);
srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp;
rlc_dummy* rlc = &pdcp_hlp.rlc;
srslte::timer_handler* timers = &pdcp_hlp.timers;
srslte::timer_handler* timers = &pdcp_hlp.stack.timers;
pdcp_hlp.set_pdcp_initial_state(init_state);

@ -45,7 +45,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
pdcp_nr_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, log);
srslte::pdcp_entity_nr* pdcp_rx = &pdcp_hlp_rx.pdcp;
gw_dummy* gw_rx = &pdcp_hlp_rx.gw;
srslte::timer_handler* timers_rx = &pdcp_hlp_rx.timers;
srslte::timer_handler* timers_rx = &pdcp_hlp_rx.stack.timers;
pdcp_hlp_rx.set_pdcp_initial_state(init_state);
// Generate test message and encript/decript SDU.

@ -113,7 +113,10 @@ public:
/* Stack-MAC interface */
srslte::timer_handler::unique_timer get_unique_timer() final;
srslte::task_multiqueue::queue_handler get_task_queue() final;
srslte::task_multiqueue::queue_handler make_task_queue() final;
void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
void enqueue_background_task(std::function<void(uint32_t)> task) final;
void notify_background_task_result(srslte::move_task_t task) final;
private:
static const int STACK_MAIN_THREAD_PRIO = -1; // Use default high-priority below UHD

@ -33,7 +33,7 @@ namespace srsenb {
class pdcp : public pdcp_interface_rlc, public pdcp_interface_gtpu, public pdcp_interface_rrc
{
public:
pdcp(srslte::timer_handler* timers, const char* logname);
pdcp(srslte::task_handler_interface* task_executor_, const char* logname);
virtual ~pdcp() {}
void init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_);
void stop();
@ -103,12 +103,12 @@ private:
std::map<uint32_t, user_interface> users;
rlc_interface_pdcp* rlc;
rrc_interface_pdcp* rrc;
gtpu_interface_pdcp* gtpu;
srslte::timer_handler* timers;
srslte::log_ref log_h;
srslte::byte_buffer_pool* pool;
rlc_interface_pdcp* rlc;
rrc_interface_pdcp* rrc;
gtpu_interface_pdcp* gtpu;
srslte::task_handler_interface* task_executor;
srslte::log_ref log_h;
srslte::byte_buffer_pool* pool;
};
} // namespace srsenb

@ -32,7 +32,7 @@ namespace srsenb {
enb_stack_lte::enb_stack_lte(srslte::logger* logger_) :
timers(128),
logger(logger_),
pdcp(&timers, "PDCP"),
pdcp(this, "PDCP"),
thread("STACK")
{
enb_queue_id = pending_tasks.add_queue();
@ -250,9 +250,24 @@ srslte::timer_handler::unique_timer enb_stack_lte::get_unique_timer()
return timers.get_unique_timer();
}
srslte::task_multiqueue::queue_handler enb_stack_lte::get_task_queue()
srslte::task_multiqueue::queue_handler enb_stack_lte::make_task_queue()
{
return pending_tasks.get_queue_handler();
}
void enb_stack_lte::defer_callback(uint32_t duration_ms, std::function<void()> func)
{
timers.defer_callback(duration_ms, func);
}
void enb_stack_lte::enqueue_background_task(std::function<void(uint32_t)> task)
{
task(0);
}
void enb_stack_lte::notify_background_task_result(srslte::move_task_t task)
{
task();
}
} // namespace srsenb

@ -68,7 +68,7 @@ bool mac::init(const mac_args_t& args_,
args = args_;
cells = cells_;
stack_task_queue = stack->get_task_queue();
stack_task_queue = stack->make_task_queue();
scheduler.init(rrc);

@ -24,8 +24,8 @@
namespace srsenb {
pdcp::pdcp(srslte::timer_handler* timers_, const char* logname) :
timers(timers_),
pdcp::pdcp(srslte::task_handler_interface* task_executor_, const char* logname) :
task_executor(task_executor_),
log_h(logname),
pool(srslte::byte_buffer_pool::get_instance())
{
@ -49,7 +49,7 @@ void pdcp::stop()
void pdcp::add_user(uint16_t rnti)
{
if (users.count(rnti) == 0) {
srslte::pdcp* obj = new srslte::pdcp(timers, log_h->get_service_name().c_str());
srslte::pdcp* obj = new srslte::pdcp(task_executor, log_h->get_service_name().c_str());
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;

@ -50,7 +50,10 @@ class mac : public mac_interface_phy_lte,
public:
mac(const char* logname);
~mac();
bool init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc, stack_interface_mac* stack_);
bool init(phy_interface_mac_lte* phy,
rlc_interface_mac* rlc,
rrc_interface_mac* rrc,
srslte::task_handler_interface* stack_);
void stop();
void get_metrics(mac_metrics_t m[SRSLTE_MAX_CARRIERS]);
@ -119,7 +122,7 @@ private:
phy_interface_mac_lte* phy_h = nullptr;
rlc_interface_mac* rlc_h = nullptr;
rrc_interface_mac* rrc_h = nullptr;
stack_interface_mac* stack_h = nullptr;
srslte::task_handler_interface* stack_h = nullptr;
srslte::log_ref log_h;
mac_interface_phy_lte::mac_phy_cfg_mbsfn_t phy_mbsfn_cfg = {};

@ -55,7 +55,7 @@ class bsr_proc : public srslte::timer_callback, public bsr_interface_mux
{
public:
bsr_proc();
void init(rlc_interface_mac* rlc, srslte::log_ref log_h, srsue::task_handler_interface_lte* task_handler_);
void init(rlc_interface_mac* rlc, srslte::log_ref log_h, srslte::task_handler_interface* task_handler_);
void step(uint32_t tti);
void reset();
void set_config(srslte::bsr_cfg_t& bsr_cfg);
@ -73,10 +73,10 @@ private:
pthread_mutex_t mutex;
bool reset_sr;
srsue::task_handler_interface_lte* task_handler;
srslte::log_ref log_h;
rlc_interface_mac* rlc;
bool reset_sr;
srslte::task_handler_interface* task_handler;
srslte::log_ref log_h;
rlc_interface_mac* rlc;
srslte::bsr_cfg_t bsr_cfg;

@ -35,7 +35,7 @@ class phr_proc : public srslte::timer_callback
{
public:
phr_proc();
void init(phy_interface_mac_lte* phy_h, srslte::log_ref log_h_, srsue::task_handler_interface_lte* task_handler_);
void init(phy_interface_mac_lte* phy_h, srslte::log_ref log_h_, srslte::task_handler_interface* task_handler_);
void set_config(srslte::phr_cfg_t& cfg);
void step();
void reset();
@ -49,13 +49,13 @@ public:
private:
bool pathloss_changed();
srslte::log_ref log_h;
phy_interface_mac_lte* phy_h;
srsue::task_handler_interface_lte* task_handler;
srslte::phr_cfg_t phr_cfg;
bool initiated;
int last_pathloss_db;
bool phr_is_triggered;
srslte::log_ref log_h;
phy_interface_mac_lte* phy_h;
srslte::task_handler_interface* task_handler;
srslte::phr_cfg_t phr_cfg;
bool initiated;
int last_pathloss_db;
bool phr_is_triggered;
srslte::timer_handler::unique_timer timer_periodic;
srslte::timer_handler::unique_timer timer_prohibit;

@ -72,7 +72,7 @@ public:
mac_interface_rrc::ue_rnti_t* rntis,
srslte::timer_handler::unique_timer* time_alignment_timer_,
mux* mux_unit,
stack_interface_mac* stack_);
srslte::task_handler_interface* stack_);
void reset();
@ -164,12 +164,12 @@ private:
void read_params();
phy_interface_mac_lte* phy_h;
srslte::log_ref log_h;
mux* mux_unit;
srslte::mac_pcap* pcap;
rrc_interface_mac* rrc;
stack_interface_mac* stack = nullptr;
phy_interface_mac_lte* phy_h;
srslte::log_ref log_h;
mux* mux_unit;
srslte::mac_pcap* pcap;
rrc_interface_mac* rrc;
srslte::task_handler_interface* stack = nullptr;
srslte::timer_handler::unique_timer* time_alignment_timer = nullptr;
srslte::timer_handler::unique_timer contention_resolution_timer;

@ -54,9 +54,7 @@ namespace srsue {
class ue_stack_lte final : public ue_stack_base,
public stack_interface_phy_lte,
public stack_interface_gw,
public stack_interface_mac,
public stack_interface_rrc,
public stack_interface_nas,
public srslte::thread
{
public:

@ -40,7 +40,7 @@ namespace srsue {
class nas : public nas_interface_rrc, public nas_interface_ue, public srslte::timer_callback
{
public:
explicit nas(srsue::stack_interface_nas* task_handler_);
explicit nas(srslte::task_handler_interface* task_handler_);
void init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, const nas_args_t& args_);
void stop();
void run_tti();
@ -132,7 +132,7 @@ private:
uint8_t transaction_id = 0;
// timers
srsue::task_handler_interface_lte* task_handler = nullptr;
srslte::task_handler_interface* task_handler = nullptr;
srslte::timer_handler::unique_timer t3402; // started when attach attempt counter reached 5
srslte::timer_handler::unique_timer t3410; // started when attach request is sent, on expiry, start t3411
srslte::timer_handler::unique_timer t3411; // started when attach failed
@ -141,10 +141,10 @@ private:
// Values according to TS 24.301 Sec 10.2
const uint32_t t3402_duration_ms = 12 * 60 * 1000; // 12m
const uint32_t t3410_duration_ms = 15 * 1000; // 15s
const uint32_t t3411_duration_ms = 10 * 1000; // 10s
const uint32_t t3421_duration_ms = 15 * 1000; // 15s
const uint32_t reattach_timer_duration_ms = 2 * 1000; // 2s (arbitrarily chosen to delay re-attach)
const uint32_t t3410_duration_ms = 15 * 1000; // 15s
const uint32_t t3411_duration_ms = 10 * 1000; // 10s
const uint32_t t3421_duration_ms = 15 * 1000; // 15s
const uint32_t reattach_timer_duration_ms = 2 * 1000; // 2s (arbitrarily chosen to delay re-attach)
// TS 23.003 Sec. 6.2.2 IMEISV's last two octets are Software Version Number (SVN)
// which identifies the software version number of the mobile equipment

@ -72,7 +72,10 @@ mac::~mac()
srslte_softbuffer_rx_free(&mch_softbuffer);
}
bool mac::init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc, stack_interface_mac* stack_)
bool mac::init(phy_interface_mac_lte* phy,
rlc_interface_mac* rlc,
rrc_interface_mac* rrc,
task_handler_interface* stack_)
{
phy_h = phy;
rlc_h = rlc;

@ -35,7 +35,7 @@ bsr_proc::bsr_proc()
pthread_mutex_init(&mutex, NULL);
}
void bsr_proc::init(rlc_interface_mac* rlc_, srslte::log_ref log_h_, srsue::task_handler_interface_lte* task_handler_)
void bsr_proc::init(rlc_interface_mac* rlc_, srslte::log_ref log_h_, srslte::task_handler_interface* task_handler_)
{
log_h = log_h_;
rlc = rlc_;

@ -38,9 +38,9 @@ phr_proc::phr_proc()
phr_cfg = {};
}
void phr_proc::init(phy_interface_mac_lte* phy_h_,
srslte::log_ref log_h_,
srsue::task_handler_interface_lte* task_handler_)
void phr_proc::init(phy_interface_mac_lte* phy_h_,
srslte::log_ref log_h_,
srslte::task_handler_interface* task_handler_)
{
phy_h = phy_h_;
log_h = log_h_;

@ -56,7 +56,7 @@ void ra_proc::init(phy_interface_mac_lte* phy_h_,
mac_interface_rrc::ue_rnti_t* rntis_,
srslte::timer_handler::unique_timer* time_alignment_timer_,
mux* mux_unit_,
stack_interface_mac* stack_)
srslte::task_handler_interface* stack_)
{
phy_h = phy_h_;
log_h = log_h_;

@ -40,7 +40,7 @@ ue_stack_lte::ue_stack_lte() :
rlc("RLC"),
mac("MAC "),
rrc(this),
pdcp(&timers, "PDCP"),
pdcp(this, "PDCP"),
nas(this),
thread("STACK"),
pending_tasks(512),

@ -234,7 +234,7 @@ proc_outcome_t nas::rrc_connect_proc::react(nas::rrc_connect_proc::connection_re
* NAS
********************************************************************/
nas::nas(srsue::stack_interface_nas* task_handler_) :
nas::nas(srslte::task_handler_interface* task_handler_) :
pool(byte_buffer_pool::get_instance()),
plmn_searcher(this),
rrc_connector(this),
@ -250,9 +250,9 @@ nas::nas(srsue::stack_interface_nas* task_handler_) :
void nas::init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, const nas_args_t& cfg_)
{
usim = usim_;
rrc = rrc_;
gw = gw_;
usim = usim_;
rrc = rrc_;
gw = gw_;
enter_state(EMM_STATE_DEREGISTERED);
if (!usim->get_home_plmn_id(&home_plmn)) {
@ -340,7 +340,7 @@ void nas::timer_expired(uint32_t timeout_id)
// Section 5.5.1.2.6 case c)
attach_attempt_counter++;
nas_log->console("Attach failed (attempt %d/%d)\n",attach_attempt_counter, max_attach_attempts);
nas_log->console("Attach failed (attempt %d/%d)\n", attach_attempt_counter, max_attach_attempts);
if (attach_attempt_counter < max_attach_attempts) {
nas_log->info("Timer T3410 expired after attach attempt %d/%d: starting T3411\n",
attach_attempt_counter,
@ -953,7 +953,7 @@ void nas::reset_security_context()
have_guti = false;
have_ctxt = false;
ctxt = {};
ctxt.ksi = LIBLTE_MME_NAS_KEY_SET_IDENTIFIER_NO_KEY_AVAILABLE;
ctxt.ksi = LIBLTE_MME_NAS_KEY_SET_IDENTIFIER_NO_KEY_AVAILABLE;
}
/*******************************************************************************

@ -24,9 +24,9 @@
#include "srslte/common/log_filter.h"
#include "srslte/common/mac_pcap.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/test/ue_test_interfaces.h"
#include "srsue/hdr/stack/mac/mac.h"
#include "srsue/hdr/stack/mac/mux.h"
#include "srsue/test/common/dummy_classes.h"
#include <assert.h>
#include <iostream>
#include <string.h>
@ -341,7 +341,7 @@ public:
uint32_t rach_problem = 0;
};
class stack_dummy : public stack_dummy_interface
class stack_dummy : public stack_test_dummy
{
public:
void init(mac* mac_, phy_interface_mac_lte* phy_)

@ -24,6 +24,7 @@
#include "dut_utils.h"
#include "srslte/common/pdu_queue.h"
#include "srslte/test/ue_test_interfaces.h"
#include "srslte/upper/pdcp.h"
#include "srslte/upper/rlc.h"
#include "ttcn3_common.h"
@ -34,7 +35,6 @@
#include "ttcn3_ue.h"
#include "ttcn3_ut_interface.h"
#include <functional>
#include <srslte/interfaces/ue_interfaces.h>
#define TTCN3_CRNTI (0x1001)
@ -52,7 +52,6 @@ public:
log{"SS "},
mac_msg_ul(20, ss_mac_log),
mac_msg_dl(20, ss_mac_log),
timers(8),
pdus(128),
logger(logger_file_),
logger_file(logger_file_),
@ -61,7 +60,7 @@ public:
rlc(ss_rlc_log->get_service_name().c_str()),
signal_handler(&running),
timer_handler(create_tti_timer(), [&](uint64_t res) { new_tti_indication(res); }),
pdcp(&timers, ss_pdcp_log->get_service_name().c_str())
pdcp(&stack, ss_pdcp_log->get_service_name().c_str())
{
if (ue->init(all_args_t{}, logger, this, "INIT_TEST") != SRSLTE_SUCCESS) {
ue->stop();
@ -134,7 +133,7 @@ public:
// Init SS layers
pdus.init(this, log);
rlc.init(&pdcp, this, &timers, 0 /* RB_ID_SRB0 */);
rlc.init(&pdcp, this, &stack.timers, 0 /* RB_ID_SRB0 */);
pdcp.init(&rlc, this, nullptr);
return SRSLTE_SUCCESS;
@ -901,7 +900,7 @@ public:
ue->new_tb(dl_grant, (const uint8_t*)pdu->msg);
}
void step_timer() { timers.step_all(); }
void step_timer() { stack.timers.step_all(); }
void add_srb(const ttcn3_helpers::timing_info_t timing, const uint32_t lcid, const pdcp_config_t pdcp_config)
{
@ -1204,18 +1203,18 @@ private:
uint32_t run_id = 0;
int32_t tti = 0;
int32_t prach_tti = -1;
int32_t rar_tti = -1;
int32_t msg3_tti = -1;
int32_t sr_tti = -1;
uint32_t prach_preamble_index = 0;
uint16_t dl_rnti = 0;
uint16_t crnti = TTCN3_CRNTI;
int force_lcid = -1;
srslte::timer_handler timers;
bool last_dl_ndi[SRSLTE_FDD_NOF_HARQ] = {};
bool last_ul_ndi[SRSLTE_FDD_NOF_HARQ] = {};
int32_t tti = 0;
int32_t prach_tti = -1;
int32_t rar_tti = -1;
int32_t msg3_tti = -1;
int32_t sr_tti = -1;
uint32_t prach_preamble_index = 0;
uint16_t dl_rnti = 0;
uint16_t crnti = TTCN3_CRNTI;
int force_lcid = -1;
srsue::stack_test_dummy stack;
bool last_dl_ndi[SRSLTE_FDD_NOF_HARQ] = {};
bool last_ul_ndi[SRSLTE_FDD_NOF_HARQ] = {};
// For events/actions that need to be carried out in a specific TTI
typedef std::vector<move_task_t> task_list_t;

@ -23,6 +23,7 @@
#include "srslte/common/log_filter.h"
#include "srslte/common/logmap.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/test/ue_test_interfaces.h"
#include "srslte/upper/pdcp.h"
#include "srslte/upper/pdcp_entity_lte.h"
#include "srslte/upper/rlc.h"
@ -32,7 +33,6 @@
#include "srsue/hdr/stack/upper/nas.h"
#include "srsue/hdr/stack/upper/usim.h"
#include "srsue/hdr/stack/upper/usim_base.h"
#include "srsue/test/common/dummy_classes.h"
#include <assert.h>
#include <iostream>
@ -141,7 +141,7 @@ private:
bool is_connected_flag = false;
};
class test_stack_dummy : public srsue::stack_dummy_interface, public stack_interface_gw, public thread
class test_stack_dummy : public srsue::stack_test_dummy, public stack_interface_gw, public thread
{
public:
test_stack_dummy(pdcp_interface_gw* pdcp_) : pdcp(pdcp_), thread("DUMMY STACK") {}
@ -210,7 +210,7 @@ int security_command_test()
rrc_log.set_level(srslte::LOG_LEVEL_DEBUG);
rrc_log.set_hex_limit(100000);
stack_dummy_interface stack;
stack_test_dummy stack;
rrc_dummy rrc_dummy;
gw_dummy gw;
@ -352,7 +352,7 @@ int esm_info_request_test()
rrc_log.set_level(srslte::LOG_LEVEL_DEBUG);
rrc_log.set_hex_limit(100000);
srsue::stack_dummy_interface stack{};
srsue::stack_test_dummy stack{};
rrc_dummy rrc_dummy;
gw_dummy gw;
@ -406,7 +406,7 @@ int dedicated_eps_bearer_test()
rrc_log.set_level(srslte::LOG_LEVEL_DEBUG);
rrc_log.set_hex_limit(100000);
srsue::stack_dummy_interface stack;
srsue::stack_test_dummy stack;
rrc_dummy rrc_dummy;
gw_dummy gw;

@ -23,11 +23,11 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log_filter.h"
#include "srslte/common/test_common.h"
#include "srslte/test/ue_test_interfaces.h"
#include "srslte/upper/pdcp.h"
#include "srsue/hdr/stack/rrc/rrc.h"
#include "srsue/hdr/stack/rrc/rrc_meas.h"
#include "srsue/hdr/stack/upper/nas.h"
#include "srsue/test/common/dummy_classes.h"
#include <iostream>
using namespace asn1::rrc;
@ -108,14 +108,14 @@ private:
class nas_test : public srsue::nas
{
public:
nas_test(srsue::stack_interface_nas* t) : srsue::nas(t) {}
nas_test(srslte::task_handler_interface* t) : srsue::nas(t) {}
bool is_attached() override { return false; }
};
class pdcp_test : public srslte::pdcp
{
public:
pdcp_test(const char* logname, srslte::timer_handler* t) : srslte::pdcp(t, logname) {}
pdcp_test(const char* logname, srslte::task_handler_interface* t) : srslte::pdcp(t, logname) {}
void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = false) override
{
ul_dcch_msg_s ul_dcch_msg;
@ -167,14 +167,14 @@ private:
class rrc_test : public rrc
{
srsue::stack_dummy_interface* stack = nullptr;
srsue::stack_test_dummy* stack = nullptr;
public:
rrc_test(srslte::log_ref log_, stack_dummy_interface* stack_) : rrc(stack_), stack(stack_)
rrc_test(srslte::log_ref log_, stack_test_dummy* stack_) : rrc(stack_), stack(stack_)
{
pool = srslte::byte_buffer_pool::get_instance();
nastest = std::unique_ptr<nas_test>(new nas_test(stack));
pdcptest = std::unique_ptr<pdcp_test>(new pdcp_test(log_->get_service_name().c_str(), &stack->timers));
pdcptest = std::unique_ptr<pdcp_test>(new pdcp_test(log_->get_service_name().c_str(), stack));
};
void init() { rrc::init(&phytest, nullptr, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, {}); }
@ -273,8 +273,8 @@ int cell_select_test()
printf("====== Cell Select Testing ===============\n");
printf("==========================================================\n");
stack_dummy_interface stack;
rrc_test rrctest(log1, &stack);
stack_test_dummy stack;
rrc_test rrctest(log1, &stack);
rrctest.init();
rrctest.connect();
@ -303,8 +303,8 @@ int meas_obj_test()
printf("====== Object Configuration Testing ===============\n");
printf("==========================================================\n");
stack_dummy_interface stack;
rrc_test rrctest(log1, &stack);
stack_test_dummy stack;
rrc_test rrctest(log1, &stack);
rrctest.init();
rrctest.connect();
@ -728,8 +728,8 @@ int a1event_report_test(uint32_t a1_rsrp_th,
printf("============ Report Testing A1 ===============\n");
printf("==========================================================\n");
stack_dummy_interface stack;
rrc_test rrctest(log1, &stack);
stack_test_dummy stack;
rrc_test rrctest(log1, &stack);
rrctest.init();
rrctest.connect();
@ -862,8 +862,8 @@ int a3event_report_test(uint32_t a3_offset, uint32_t hyst, bool report_on_leave)
printf("============ Report Testing A3 ===============\n");
printf("==========================================================\n");
stack_dummy_interface stack;
rrc_test rrctest(log1, &stack);
stack_test_dummy stack;
rrc_test rrctest(log1, &stack);
rrctest.init();
rrctest.connect();

Loading…
Cancel
Save