mirror of https://github.com/PentHertz/srsLTE.git
move write_pdu_pcch and write_pdu_bcch_bch to stack thread
This commit is contained in:
parent
de3c28e52d
commit
7f6bde59fc
|
@ -50,11 +50,7 @@ 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,
|
||||
srslte::timer_handler* timers_,
|
||||
stack_interface_mac* stack);
|
||||
bool init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc, stack_interface_mac* stack_);
|
||||
void stop();
|
||||
|
||||
void get_metrics(mac_metrics_t m[SRSLTE_MAX_CARRIERS]);
|
||||
|
@ -169,10 +165,10 @@ private:
|
|||
srslte::timer_handler::unique_timer timer_alignment;
|
||||
void setup_timers(int time_alignment_timer);
|
||||
void timer_alignment_expire();
|
||||
srslte::timer_handler* timers = nullptr;
|
||||
|
||||
/* Queue to dispatch stack tasks */
|
||||
srslte::byte_buffer_pool* pool = nullptr;
|
||||
srslte::task_multiqueue::queue_handler stack_task_dispatch_queue;
|
||||
srslte::byte_buffer_pool* pool = nullptr;
|
||||
|
||||
// pointer to MAC PCAP object
|
||||
srslte::mac_pcap* pcap = nullptr;
|
||||
|
|
|
@ -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, srslte::timer_handler* timers_db);
|
||||
void init(rlc_interface_mac* rlc, srslte::log_ref log_h, srsue::task_handler_interface_lte* 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;
|
||||
srslte::timer_handler* timers_db;
|
||||
srslte::log_ref log_h;
|
||||
rlc_interface_mac* rlc;
|
||||
bool reset_sr;
|
||||
srsue::task_handler_interface_lte* task_handler;
|
||||
srslte::log_ref log_h;
|
||||
rlc_interface_mac* rlc;
|
||||
|
||||
srslte::bsr_cfg_t bsr_cfg;
|
||||
|
||||
|
@ -113,6 +113,7 @@ private:
|
|||
|
||||
srslte::timer_handler::unique_timer timer_periodic;
|
||||
srslte::timer_handler::unique_timer timer_retx;
|
||||
srslte::timer_handler::unique_timer timer_queue_status_print;
|
||||
};
|
||||
|
||||
} // namespace srsue
|
||||
|
|
|
@ -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_, srslte::timer_handler* timers_db_);
|
||||
void init(phy_interface_mac_lte* phy_h, srslte::log_ref log_h_, srsue::task_handler_interface_lte* 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;
|
||||
srslte::timer_handler* timers_db;
|
||||
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;
|
||||
srsue::task_handler_interface_lte* 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;
|
||||
|
|
|
@ -70,7 +70,6 @@ public:
|
|||
srslte::log_ref log_h,
|
||||
mac_interface_rrc::ue_rnti_t* rntis,
|
||||
srslte::timer_handler::unique_timer* time_alignment_timer_,
|
||||
srslte::timer_handler::unique_timer contention_resolution_timer_,
|
||||
mux* mux_unit,
|
||||
stack_interface_mac* stack_);
|
||||
|
||||
|
@ -167,7 +166,7 @@ private:
|
|||
mux* mux_unit;
|
||||
srslte::mac_pcap* pcap;
|
||||
rrc_interface_mac* rrc;
|
||||
stack_interface_mac* stack;
|
||||
stack_interface_mac* stack = nullptr;
|
||||
|
||||
srslte::timer_handler::unique_timer* time_alignment_timer = nullptr;
|
||||
srslte::timer_handler::unique_timer contention_resolution_timer;
|
||||
|
|
|
@ -72,27 +72,23 @@ mac::~mac()
|
|||
srslte_softbuffer_rx_free(&mch_softbuffer);
|
||||
}
|
||||
|
||||
bool mac::init(phy_interface_mac_lte* phy,
|
||||
rlc_interface_mac* rlc,
|
||||
rrc_interface_mac* rrc,
|
||||
srslte::timer_handler* timers_,
|
||||
stack_interface_mac* stack_)
|
||||
bool mac::init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc, stack_interface_mac* stack_)
|
||||
{
|
||||
phy_h = phy;
|
||||
rlc_h = rlc;
|
||||
rrc_h = rrc;
|
||||
timers = timers_;
|
||||
stack_h = stack_;
|
||||
|
||||
timer_alignment = timers->get_unique_timer();
|
||||
srslte::timer_handler::unique_timer contention_resolution_timer = timers->get_unique_timer();
|
||||
timer_alignment = stack_h->get_unique_timer();
|
||||
|
||||
bsr_procedure.init(rlc_h, log_h, timers);
|
||||
phr_procedure.init(phy_h, log_h, timers);
|
||||
// Create Stack task dispatch queue
|
||||
stack_task_dispatch_queue = stack_h->make_task_queue();
|
||||
|
||||
bsr_procedure.init(rlc_h, log_h, stack_h);
|
||||
phr_procedure.init(phy_h, log_h, stack_h);
|
||||
mux_unit.init(rlc_h, &bsr_procedure, &phr_procedure);
|
||||
demux_unit.init(phy_h, rlc_h, this, &timer_alignment);
|
||||
ra_procedure.init(
|
||||
phy_h, rrc, log_h, &uernti, &timer_alignment, std::move(contention_resolution_timer), &mux_unit, stack_h);
|
||||
ra_procedure.init(phy_h, rrc, log_h, &uernti, &timer_alignment, &mux_unit, stack_h);
|
||||
sr_procedure.init(phy_h, rrc, log_h);
|
||||
|
||||
// Create UL/DL unique HARQ pointers
|
||||
|
@ -377,7 +373,11 @@ void mac::bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len)
|
|||
memcpy(buf->msg, payload, len);
|
||||
buf->N_bytes = len;
|
||||
buf->set_timestamp();
|
||||
rlc_h->write_pdu_bcch_bch(std::move(buf));
|
||||
auto p = stack_task_dispatch_queue.try_push(std::bind(
|
||||
[this](srslte::unique_byte_buffer_t& buf) { rlc_h->write_pdu_bcch_bch(std::move(buf)); }, std::move(buf)));
|
||||
if (not p.first) {
|
||||
Warning("Failed to dispatch rlc::write_pdu_bcch_bch task to stack\n");
|
||||
}
|
||||
} else {
|
||||
log_h->error("Fatal error: Out of buffers from the pool in write_pdu_bcch_bch()\n");
|
||||
}
|
||||
|
@ -411,6 +411,7 @@ void mac::mch_decoded(uint32_t len, bool crc)
|
|||
if (pcap) {
|
||||
pcap->write_dl_mch(mch_payload_buffer, len, true, phy_h->get_current_tti(), 0);
|
||||
}
|
||||
|
||||
metrics[0].rx_brate += len * 8;
|
||||
} else {
|
||||
metrics[0].rx_errors++;
|
||||
|
@ -431,7 +432,12 @@ void mac::tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSLTE_MAX_
|
|||
memcpy(pdu->msg, pch_payload_buffer, grant.tb[0].tbs);
|
||||
pdu->N_bytes = grant.tb[0].tbs;
|
||||
pdu->set_timestamp();
|
||||
rlc_h->write_pdu_pcch(std::move(pdu));
|
||||
|
||||
auto ret = stack_task_dispatch_queue.try_push(std::bind(
|
||||
[this](srslte::unique_byte_buffer_t& pdu) { rlc_h->write_pdu_pcch(std::move(pdu)); }, std::move(pdu)));
|
||||
if (not ret.first) {
|
||||
Warning("Failed to dispatch rlc::write_pdu_pcch task to stack\n");
|
||||
}
|
||||
} else {
|
||||
log_h->error("Fatal error: Out of buffers from the pool in write_pdu_pcch()\n");
|
||||
}
|
||||
|
|
|
@ -40,19 +40,20 @@ bsr_proc::bsr_proc()
|
|||
pthread_mutex_init(&mutex, NULL);
|
||||
}
|
||||
|
||||
void bsr_proc::init(rlc_interface_mac* rlc_, srslte::log_ref log_h_, srslte::timer_handler* timers_db_)
|
||||
void bsr_proc::init(rlc_interface_mac* rlc_, srslte::log_ref log_h_, srsue::task_handler_interface_lte* task_handler_)
|
||||
{
|
||||
log_h = log_h_;
|
||||
rlc = rlc_;
|
||||
timers_db = timers_db_;
|
||||
log_h = log_h_;
|
||||
rlc = rlc_;
|
||||
task_handler = task_handler_;
|
||||
|
||||
timer_periodic = timers_db->get_unique_timer();
|
||||
timer_retx = timers_db->get_unique_timer();
|
||||
timer_periodic = task_handler->get_unique_timer();
|
||||
timer_retx = task_handler->get_unique_timer();
|
||||
timer_queue_status_print = task_handler->get_unique_timer();
|
||||
|
||||
reset();
|
||||
|
||||
// Print periodically the LCID queue status
|
||||
auto queue_status_print_task = [this]() {
|
||||
auto queue_status_print_task = [this](uint32_t tid) {
|
||||
char str[128];
|
||||
str[0] = '\0';
|
||||
int n = 0;
|
||||
|
@ -62,11 +63,10 @@ void bsr_proc::init(rlc_interface_mac* rlc_, srslte::log_ref log_h_, srslte::tim
|
|||
}
|
||||
}
|
||||
Info("BSR: triggered_bsr_type=%d, LCID QUEUE status: %s\n", triggered_bsr_type, str);
|
||||
timer_queue_status_print.run();
|
||||
};
|
||||
timers_db->defer_callback(QUEUE_STATUS_PERIOD_MS, [this, queue_status_print_task]() {
|
||||
queue_status_print_task();
|
||||
timers_db->defer_callback(QUEUE_STATUS_PERIOD_MS, queue_status_print_task);
|
||||
});
|
||||
timer_queue_status_print.set(QUEUE_STATUS_PERIOD_MS, queue_status_print_task);
|
||||
timer_queue_status_print.run();
|
||||
|
||||
initiated = true;
|
||||
}
|
||||
|
@ -89,19 +89,19 @@ void bsr_proc::reset()
|
|||
trigger_tti = 0;
|
||||
}
|
||||
|
||||
void bsr_proc::set_config(srslte::bsr_cfg_t& bsr_cfg)
|
||||
void bsr_proc::set_config(srslte::bsr_cfg_t& bsr_cfg_)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
|
||||
this->bsr_cfg = bsr_cfg;
|
||||
bsr_cfg = bsr_cfg_;
|
||||
|
||||
if (bsr_cfg.periodic_timer > 0) {
|
||||
timer_periodic.set(bsr_cfg.periodic_timer, [this](uint32_t tid) { timer_expired(tid); });
|
||||
Info("BSR: Configured timer periodic %d ms\n", bsr_cfg.periodic_timer);
|
||||
if (bsr_cfg_.periodic_timer > 0) {
|
||||
timer_periodic.set(bsr_cfg_.periodic_timer, [this](uint32_t tid) { timer_expired(tid); });
|
||||
Info("BSR: Configured timer periodic %d ms\n", bsr_cfg_.periodic_timer);
|
||||
}
|
||||
if (bsr_cfg.retx_timer > 0) {
|
||||
timer_retx.set(bsr_cfg.retx_timer, [this](uint32_t tid) { timer_expired(tid); });
|
||||
Info("BSR: Configured timer reTX %d ms\n", bsr_cfg.retx_timer);
|
||||
if (bsr_cfg_.retx_timer > 0) {
|
||||
timer_retx.set(bsr_cfg_.retx_timer, [this](uint32_t tid) { timer_expired(tid); });
|
||||
Info("BSR: Configured timer reTX %d ms\n", bsr_cfg_.retx_timer);
|
||||
}
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
|
|
@ -38,15 +38,17 @@ phr_proc::phr_proc()
|
|||
phr_cfg = {};
|
||||
}
|
||||
|
||||
void phr_proc::init(phy_interface_mac_lte* phy_h_, srslte::log_ref log_h_, srslte::timer_handler* timers_db_)
|
||||
void phr_proc::init(phy_interface_mac_lte* phy_h_,
|
||||
srslte::log_ref log_h_,
|
||||
srsue::task_handler_interface_lte* task_handler_)
|
||||
{
|
||||
phy_h = phy_h_;
|
||||
log_h = log_h_;
|
||||
timers_db = timers_db_;
|
||||
initiated = true;
|
||||
phy_h = phy_h_;
|
||||
log_h = log_h_;
|
||||
task_handler = task_handler_;
|
||||
initiated = true;
|
||||
|
||||
timer_periodic = timers_db->get_unique_timer();
|
||||
timer_prohibit = timers_db->get_unique_timer();
|
||||
timer_periodic = task_handler->get_unique_timer();
|
||||
timer_prohibit = task_handler->get_unique_timer();
|
||||
|
||||
reset();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ void ra_proc::init(phy_interface_mac_lte* phy_h_,
|
|||
srslte::log_ref log_h_,
|
||||
mac_interface_rrc::ue_rnti_t* rntis_,
|
||||
srslte::timer_handler::unique_timer* time_alignment_timer_,
|
||||
srslte::timer_handler::unique_timer contention_resolution_timer_,
|
||||
mux* mux_unit_,
|
||||
stack_interface_mac* stack_)
|
||||
{
|
||||
|
@ -74,7 +73,7 @@ void ra_proc::init(phy_interface_mac_lte* phy_h_,
|
|||
stack = stack_;
|
||||
|
||||
time_alignment_timer = time_alignment_timer_;
|
||||
contention_resolution_timer = std::move(contention_resolution_timer_);
|
||||
contention_resolution_timer = stack->get_unique_timer();
|
||||
|
||||
srslte_softbuffer_rx_init(&softbuffer_rar, 10);
|
||||
|
||||
|
@ -99,10 +98,10 @@ void ra_proc::start_pcap(srslte::mac_pcap* pcap_)
|
|||
}
|
||||
|
||||
/* Sets a new configuration. The configuration is applied by initialization() function */
|
||||
void ra_proc::set_config(srslte::rach_cfg_t& rach_cfg)
|
||||
void ra_proc::set_config(srslte::rach_cfg_t& rach_cfg_)
|
||||
{
|
||||
std::unique_lock<std::mutex> ul(mutex);
|
||||
new_cfg = rach_cfg;
|
||||
new_cfg = rach_cfg_;
|
||||
}
|
||||
|
||||
/* Reads the configuration and configures internal variables */
|
||||
|
|
|
@ -131,7 +131,7 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_)
|
|||
return SRSLTE_ERROR;
|
||||
}
|
||||
|
||||
mac.init(phy, &rlc, &rrc, &timers, this);
|
||||
mac.init(phy, &rlc, &rrc, this);
|
||||
rlc.init(&pdcp, &rrc, &timers, 0 /* RB_ID_SRB0 */);
|
||||
pdcp.init(&rlc, &rrc, gw);
|
||||
nas.init(usim.get(), &rrc, gw, args.nas);
|
||||
|
|
|
@ -382,8 +382,7 @@ int mac_unpack_test()
|
|||
0xc3, 0xb3, 0x5c, 0xa3, 0x23, 0xad, 0x00, 0x03, 0x20, 0x1b, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x13, 0x89, 0x00, 0x00};
|
||||
|
||||
srslte::log_filter rlc_log("RLC");
|
||||
srslte::timer_handler timers(64);
|
||||
srslte::log_filter rlc_log("RLC");
|
||||
|
||||
rlc_log.set_level(srslte::LOG_LEVEL_DEBUG);
|
||||
rlc_log.set_hex_limit(100000);
|
||||
|
@ -397,7 +396,7 @@ int mac_unpack_test()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
|
||||
// create dummy DL action and grant and push MAC PDU
|
||||
mac_interface_phy_lte::tb_action_dl_t dl_action;
|
||||
|
@ -420,7 +419,7 @@ int mac_unpack_test()
|
|||
// make sure MAC PDU thread picks up before stopping
|
||||
sleep(1);
|
||||
mac.run_tti(0);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
mac.stop();
|
||||
|
||||
// check length of both received RLC PDUs
|
||||
|
@ -452,7 +451,7 @@ int mac_ul_sch_pdu_test1()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -518,7 +517,7 @@ int mac_ul_logical_channel_prioritization_test1()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -629,7 +628,7 @@ int mac_ul_logical_channel_prioritization_test2()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -727,7 +726,7 @@ int mac_ul_logical_channel_prioritization_test3()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -813,7 +812,7 @@ int mac_ul_sch_pdu_with_short_bsr_test()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -897,7 +896,7 @@ int mac_ul_sch_pdu_with_padding_bsr_test()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -990,7 +989,7 @@ int mac_ul_sch_pdu_one_byte_test()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -1048,7 +1047,7 @@ int mac_ul_sch_pdu_two_byte_test()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -1106,7 +1105,7 @@ int mac_ul_sch_pdu_three_byte_test()
|
|||
// the actual MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
const uint16_t crnti = 0x1001;
|
||||
mac.set_ho_rnti(crnti, 0);
|
||||
|
||||
|
@ -1357,7 +1356,7 @@ int mac_random_access_test()
|
|||
// Configure MAC
|
||||
mac mac("MAC");
|
||||
stack.init(&mac, &phy);
|
||||
mac.init(&phy, &rlc, &rrc, &timers, &stack);
|
||||
mac.init(&phy, &rlc, &rrc, &stack);
|
||||
srslte::mac_cfg_t mac_cfg;
|
||||
set_mac_cfg_t_rach_cfg_common(&mac_cfg, rach_cfg);
|
||||
mac.set_config(mac_cfg);
|
||||
|
@ -1396,12 +1395,12 @@ int mac_random_access_test()
|
|||
mac_log->info("\n=========== Test %d =============\n", test_id++);
|
||||
my_test.rach_cfg = rach_cfg;
|
||||
my_test.nof_prachs = rach_cfg.ra_supervision_info.preamb_trans_max.to_number();
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
|
||||
// Make sure it triggers RRC signal
|
||||
mac.run_tti(tti++);
|
||||
TESTASSERT(rrc.rach_problem == 1);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
|
||||
// Reset MAC
|
||||
mac.reset();
|
||||
|
@ -1415,7 +1414,7 @@ int mac_random_access_test()
|
|||
my_test.rar_nof_rapid = 1;
|
||||
my_test.nof_prachs = 1;
|
||||
my_test.rar_nof_invalid_rapid = rach_cfg.ra_supervision_info.ra_resp_win_size.to_number();
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
|
||||
// Test 3: RAR received but no matching RAPID. Test Msg3 retransmissions
|
||||
// On each HARQ retx, contention resolution timer must be restarted (5.1.5)
|
||||
|
@ -1423,7 +1422,7 @@ int mac_random_access_test()
|
|||
mac_log->info("\n=========== Test %d =============\n", test_id++);
|
||||
my_test.rar_nof_invalid_rapid = 0;
|
||||
my_test.nof_msg3_retx = rach_cfg.max_harq_msg3_tx;
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
|
||||
// Test 4: RAR with valid RAPID. Msg3 transmitted, Msg4 received but invalid ConRes
|
||||
// Contention resolution is defined in 5.1.5. If ConResID does not match, the ConRes is considered
|
||||
|
@ -1432,7 +1431,7 @@ int mac_random_access_test()
|
|||
phy.reset();
|
||||
my_test.nof_msg3_retx = 0;
|
||||
my_test.msg4_enable = true;
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
|
||||
// Test 5: Msg4 received and valid ConRes. In this case a valid ConResID is received and RA procedure is successful
|
||||
mac_log->info("\n=========== Test %d =============\n", test_id++);
|
||||
|
@ -1440,7 +1439,7 @@ int mac_random_access_test()
|
|||
my_test.msg4_valid_conres = true;
|
||||
my_test.check_ra_successful = true;
|
||||
my_test.assume_prach_transmitted = 0;
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
|
||||
// Test 6: RA with existing C-RNTI (Sends C-RNTI MAC CE)
|
||||
// The transmission of C-RNTI MAC CE is only done if no CCCH is present (5.1.4).
|
||||
|
@ -1452,7 +1451,7 @@ int mac_random_access_test()
|
|||
my_test.temp_rnti++; // Temporal C-RNTI has to change to avoid duplicate
|
||||
my_test.assume_prach_transmitted = -1;
|
||||
my_test.send_valid_ul_grant = true;
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
|
||||
// Test 7: Test Contention based Random Access. This is used eg in HO where preamble is chosen by UE.
|
||||
// It is similar to Test 5 because C-RNTI is available to the UE when start the RA but
|
||||
|
@ -1463,7 +1462,7 @@ int mac_random_access_test()
|
|||
phy.set_crnti(0);
|
||||
mac.start_cont_ho();
|
||||
mac.run_tti(tti++);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
rrc.ho_finish = false;
|
||||
my_test.nof_prachs = rach_cfg.ra_supervision_info.preamb_trans_max.to_number();
|
||||
my_test.temp_rnti++; // Temporal C-RNTI has to change to avoid duplicate
|
||||
|
@ -1471,7 +1470,7 @@ int mac_random_access_test()
|
|||
my_test.assume_prach_transmitted = 0;
|
||||
my_test.check_ra_successful = false;
|
||||
my_test.send_valid_ul_grant = false;
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
TESTASSERT(!rrc.ho_finish_successful && rrc.ho_finish);
|
||||
|
||||
// Test 8: Test Contention based Random Access. Same as above but we let the procedure finish successfully.
|
||||
|
@ -1480,12 +1479,12 @@ int mac_random_access_test()
|
|||
phy.set_crnti(0);
|
||||
mac.start_cont_ho();
|
||||
mac.run_tti(tti++);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
rrc.ho_finish = false;
|
||||
my_test.nof_prachs = 1;
|
||||
my_test.temp_rnti++; // Temporal C-RNTI has to change to avoid duplicate
|
||||
my_test.send_valid_ul_grant = true;
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
TESTASSERT(rrc.ho_finish_successful && rrc.ho_finish);
|
||||
|
||||
// Test 9: Test non-Contention based HO. Used in HO but preamble is given by the network. In addition to checking
|
||||
|
@ -1494,7 +1493,7 @@ int mac_random_access_test()
|
|||
mac_log->info("\n=========== Test %d =============\n", test_id++);
|
||||
phy.set_prach_tti(tti + phy.prach_delay);
|
||||
mac.run_tti(tti++);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
phy.set_crnti(0);
|
||||
rrc.ho_finish = false;
|
||||
my_test.preamble_idx = 3;
|
||||
|
@ -1502,9 +1501,9 @@ int mac_random_access_test()
|
|||
my_test.nof_prachs = rach_cfg.ra_supervision_info.preamb_trans_max.to_number();
|
||||
my_test.rar_nof_invalid_rapid = rach_cfg.ra_supervision_info.ra_resp_win_size.to_number();
|
||||
my_test.temp_rnti++; // Temporal C-RNTI has to change to avoid duplicate
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
mac.run_tti(tti++);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
TESTASSERT(!rrc.ho_finish_successful && rrc.ho_finish);
|
||||
|
||||
// Test 10: Test non-Contention based HO. Used in HO but preamble is given by the network. We check that
|
||||
|
@ -1512,7 +1511,7 @@ int mac_random_access_test()
|
|||
mac_log->info("\n=========== Test %d =============\n", test_id++);
|
||||
phy.set_prach_tti(tti + phy.prach_delay);
|
||||
mac.run_tti(tti++);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
phy.set_crnti(0);
|
||||
rrc.ho_finish = false;
|
||||
my_test.preamble_idx = 3;
|
||||
|
@ -1521,9 +1520,9 @@ int mac_random_access_test()
|
|||
my_test.rar_nof_invalid_rapid = 0;
|
||||
my_test.check_ra_successful = true;
|
||||
my_test.temp_rnti++; // Temporal C-RNTI has to change to avoid duplicate
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &timers));
|
||||
TESTASSERT(!run_mac_ra_test(my_test, &mac, &phy, &tti, &stack.timers));
|
||||
mac.run_tti(tti++);
|
||||
timers.step_all();
|
||||
stack.timers.step_all();
|
||||
TESTASSERT(rrc.ho_finish_successful && rrc.ho_finish);
|
||||
|
||||
mac.stop();
|
||||
|
|
Loading…
Reference in New Issue