fixed msg4 setting in sched tester

master
Francisco Paisana 5 years ago
parent 3cc94c3694
commit b37d9b9930

@ -182,24 +182,23 @@ public:
class carrier_sched; class carrier_sched;
protected: protected:
// Helper methods
template <typename Func>
int ue_db_access(uint16_t rnti, Func);
// args
srslte::log_ref log_h; srslte::log_ref log_h;
rrc_interface_mac* rrc = nullptr; rrc_interface_mac* rrc = nullptr;
sched_args_t sched_cfg = {}; sched_args_t sched_cfg = {};
std::vector<sched_cell_params_t> sched_cell_params; std::vector<sched_cell_params_t> sched_cell_params;
// Helper methods
template <typename Func>
int ue_db_access(uint16_t rnti, Func);
std::map<uint16_t, sched_ue> ue_db; std::map<uint16_t, sched_ue> ue_db;
// independent schedulers for each carrier // independent schedulers for each carrier
std::vector<std::unique_ptr<carrier_sched> > carrier_schedulers; std::vector<std::unique_ptr<carrier_sched> > carrier_schedulers;
std::array<uint32_t, 10> pdsch_re = {}; uint32_t last_tti = 0;
uint32_t current_tti = 0;
std::mutex sched_mutex; std::mutex sched_mutex;
bool configured = false; bool configured = false;
}; };

@ -240,8 +240,8 @@ void sched::ue_needs_ta_cmd(uint16_t rnti, uint32_t nof_ta_cmd)
void sched::phy_config_enabled(uint16_t rnti, bool enabled) void sched::phy_config_enabled(uint16_t rnti, bool enabled)
{ {
// TODO: Check if correct use of current_tti // TODO: Check if correct use of last_tti
ue_db_access(rnti, [this, enabled](sched_ue& ue) { ue.phy_config_enabled(current_tti, enabled); }); ue_db_access(rnti, [this, enabled](sched_ue& ue) { ue.phy_config_enabled(last_tti, enabled); });
} }
int sched::bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg_) int sched::bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg_)
@ -256,7 +256,7 @@ int sched::bearer_ue_rem(uint16_t rnti, uint32_t lc_id)
uint32_t sched::get_dl_buffer(uint16_t rnti) uint32_t sched::get_dl_buffer(uint16_t rnti)
{ {
// TODO: Check if correct use of current_tti // TODO: Check if correct use of last_tti
uint32_t ret = 0; uint32_t ret = 0;
ue_db_access(rnti, [&ret](sched_ue& ue) { ret = ue.get_pending_dl_new_data(); }); ue_db_access(rnti, [&ret](sched_ue& ue) { ret = ue.get_pending_dl_new_data(); });
return ret; return ret;
@ -264,9 +264,9 @@ uint32_t sched::get_dl_buffer(uint16_t rnti)
uint32_t sched::get_ul_buffer(uint16_t rnti) uint32_t sched::get_ul_buffer(uint16_t rnti)
{ {
// TODO: Check if correct use of current_tti // TODO: Check if correct use of last_tti
uint32_t ret = 0; uint32_t ret = 0;
ue_db_access(rnti, [this, &ret](sched_ue& ue) { ret = ue.get_pending_ul_new_data(current_tti); }); ue_db_access(rnti, [this, &ret](sched_ue& ue) { ret = ue.get_pending_ul_new_data(last_tti); });
return ret; return ret;
} }
@ -380,7 +380,7 @@ int sched::dl_sched(uint32_t tti, uint32_t cc_idx, sched_interface::dl_sched_res
std::lock_guard<std::mutex> lock(sched_mutex); std::lock_guard<std::mutex> lock(sched_mutex);
uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY); uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY);
current_tti = sched_utils::max_tti(current_tti, tti_rx); last_tti = sched_utils::max_tti(last_tti, tti_rx);
if (cc_idx < carrier_schedulers.size()) { if (cc_idx < carrier_schedulers.size()) {
// Compute scheduling Result for tti_rx // Compute scheduling Result for tti_rx

@ -299,8 +299,8 @@ alloc_outcome_t sf_grid_t::alloc_dl(uint32_t aggr_lvl, alloc_type_t alloc_type,
// Allocate DCI in PDCCH // Allocate DCI in PDCCH
if (not pdcch_alloc.alloc_dci(alloc_type, aggr_lvl, user)) { if (not pdcch_alloc.alloc_dci(alloc_type, aggr_lvl, user)) {
if (log_h->get_level() == srslte::LOG_LEVEL_DEBUG) {
if (user != nullptr) { if (user != nullptr) {
if (log_h->get_level() == srslte::LOG_LEVEL_DEBUG) {
log_h->debug("No space in PDCCH for rnti=0x%x DL tx. Current PDCCH allocation: %s\n", log_h->debug("No space in PDCCH for rnti=0x%x DL tx. Current PDCCH allocation: %s\n",
user->get_rnti(), user->get_rnti(),
pdcch_alloc.result_to_string(true).c_str()); pdcch_alloc.result_to_string(true).c_str());
@ -847,12 +847,6 @@ void sf_sched::set_ul_sched_result(const pdcch_grid_t::alloc_result_t& dci_resul
continue; continue;
} }
// Allocation was successful
if (ul_alloc.type == ul_alloc_t::NEWTX) {
// Un-trigger SR
user->unset_sr();
}
// Print Resulting UL Allocation // Print Resulting UL Allocation
log_h->info("SCHED: %s %s rnti=0x%x, cc=%d, pid=%d, dci=(%d,%d), prb=(%d,%d), n_rtx=%d, tbs=%d, bsr=%d (%d-%d)\n", log_h->info("SCHED: %s %s rnti=0x%x, cc=%d, pid=%d, dci=(%d,%d), prb=(%d,%d), n_rtx=%d, tbs=%d, bsr=%d (%d-%d)\n",
ul_alloc.is_msg3() ? "Msg3" : "UL", ul_alloc.is_msg3() ? "Msg3" : "UL",

@ -642,6 +642,8 @@ int sched_ue::generate_format0(sched_interface::ul_sched_data_t* data,
} }
h->new_tx(tti, mcs, tbs, alloc, nof_retx); h->new_tx(tti, mcs, tbs, alloc, nof_retx);
// Un-trigger SR
unset_sr();
} else { } else {
// retx // retx
h->new_retx(0, tti, &mcs, nullptr, alloc); h->new_retx(0, tti, &mcs, nullptr, alloc);

@ -86,8 +86,10 @@ struct test_scell_activation_params {
int test_scell_activation(test_scell_activation_params params) int test_scell_activation(test_scell_activation_params params)
{ {
std::array<uint32_t, 6> prb_list = {6, 15, 25, 50, 75, 100};
/* Simulation Configuration Arguments */ /* Simulation Configuration Arguments */
uint32_t nof_prb = 25; uint32_t nof_prb = prb_list[std::uniform_int_distribution<uint32_t>{0, 5}(get_rand_gen())];
uint32_t nof_ccs = 2; uint32_t nof_ccs = 2;
uint32_t start_tti = 0; // rand_int(0, 10240); uint32_t start_tti = 0; // rand_int(0, 10240);
@ -165,13 +167,15 @@ int test_scell_activation(test_scell_activation_params params)
// TEST: When a DL newtx takes place, it should also encode the CE // TEST: When a DL newtx takes place, it should also encode the CE
for (uint32_t i = 0; i < 100; ++i) { for (uint32_t i = 0; i < 100; ++i) {
TESTASSERT(tester.tti_info.dl_sched_result[params.pcell_idx].nof_data_elems > 0); if (tester.tti_info.dl_sched_result[params.pcell_idx].nof_data_elems > 0) {
// DL data was allocated
if (tester.tti_info.dl_sched_result[params.pcell_idx].data[0].nof_pdu_elems[0] > 0) { if (tester.tti_info.dl_sched_result[params.pcell_idx].data[0].nof_pdu_elems[0] > 0) {
// it is a new DL tx // it is a new DL tx
TESTASSERT(tester.tti_info.dl_sched_result[params.pcell_idx].data[0].pdu[0][0].lcid == TESTASSERT(tester.tti_info.dl_sched_result[params.pcell_idx].data[0].pdu[0][0].lcid ==
srslte::sch_subh::cetype::SCELL_ACTIVATION); srslte::sch_subh::cetype::SCELL_ACTIVATION);
break; break;
} }
}
generator.step_tti(); generator.step_tti();
tester.test_next_ttis(generator.tti_events); tester.test_next_ttis(generator.tti_events);
} }
@ -217,9 +221,9 @@ int main()
// Setup rand seed // Setup rand seed
set_randseed(seed); set_randseed(seed);
srslte::logmap::get_instance()->set_default_log_level(srslte::LOG_LEVEL_INFO); srslte::logmap::set_default_log_level(srslte::LOG_LEVEL_INFO);
printf("[TESTER] This is the chosen seed: %u\n", seed); printf("[TESTER] This is the chosen seed: %u\n", seed);
uint32_t N_runs = 5; uint32_t N_runs = 20;
for (uint32_t n = 0; n < N_runs; ++n) { for (uint32_t n = 0; n < N_runs; ++n) {
printf("Sim run number: %u\n", n + 1); printf("Sim run number: %u\n", n + 1);

@ -842,33 +842,40 @@ int common_sched_tester::process_tti_events(const tti_ev& tti_ev)
bearer_ue_cfg(ue_ev.rnti, 0, ue_ev.bearer_cfg.get()); bearer_ue_cfg(ue_ev.rnti, 0, ue_ev.bearer_cfg.get());
} }
auto* user = ue_tester->get_user_state(ue_ev.rnti);
if (user != nullptr and not user->msg4_tic.is_valid() and user->msg3_tic.is_valid() and user->msg3_tic <= tic) {
// Msg3 has been received but Msg4 has not been yet transmitted
uint32_t pending_dl_new_data = ue_db[ue_ev.rnti].get_pending_dl_new_data();
if (pending_dl_new_data == 0) {
uint32_t lcid = 0; // Use SRB0 to schedule Msg4
dl_rlc_buffer_state(ue_ev.rnti, lcid, 50, 0);
} else {
// Let SRB0 Msg4 get fully transmitted
}
}
// push UL SRs and DL packets // push UL SRs and DL packets
if (ue_ev.buffer_ev != nullptr) { if (ue_ev.buffer_ev != nullptr) {
auto* user = ue_tester->get_user_state(ue_ev.rnti);
CONDERROR(user == nullptr, "TESTER ERROR: Trying to schedule data for user that does not exist\n"); CONDERROR(user == nullptr, "TESTER ERROR: Trying to schedule data for user that does not exist\n");
if (ue_ev.buffer_ev->dl_data > 0 and user->msg4_tic.is_valid()) {
if (ue_ev.buffer_ev->dl_data > 0) { // If Msg4 has already been tx and there DL data to transmit
// If Msg3 has already been received uint32_t lcid = 2;
if (user->msg3_tic.is_valid() and user->msg3_tic <= tic) {
// If Msg4 not yet sent, allocate data in SRB0 buffer
uint32_t lcid = (user->msg4_tic.is_valid()) ? 2 : 0;
uint32_t pending_dl_new_data = ue_db[ue_ev.rnti].get_pending_dl_new_data(); uint32_t pending_dl_new_data = ue_db[ue_ev.rnti].get_pending_dl_new_data();
if (lcid == 2 and not user->drb_cfg_flag) { if (user->drb_cfg_flag or pending_dl_new_data == 0) {
// If RRCSetup finished // If RRCSetup finished
if (pending_dl_new_data == 0) { if (not user->drb_cfg_flag) {
// setup lcid==2 bearer // setup lcid==2 bearer
sched::ue_bearer_cfg_t cfg = {}; sched::ue_bearer_cfg_t cfg = {};
cfg.direction = ue_bearer_cfg_t::BOTH; cfg.direction = ue_bearer_cfg_t::BOTH;
ue_tester->bearer_cfg(ue_ev.rnti, 2, cfg); ue_tester->bearer_cfg(ue_ev.rnti, 2, cfg);
bearer_ue_cfg(ue_ev.rnti, 2, &cfg); bearer_ue_cfg(ue_ev.rnti, 2, &cfg);
} else {
// Let SRB0 get emptied
continue;
}
} }
// Update DL buffer // DRB is set. Update DL buffer
uint32_t tot_dl_data = pending_dl_new_data + ue_ev.buffer_ev->dl_data; // TODO: derive pending based on rx uint32_t tot_dl_data = pending_dl_new_data + ue_ev.buffer_ev->dl_data; // TODO: derive pending based on rx
dl_rlc_buffer_state(ue_ev.rnti, lcid, tot_dl_data, 0); // TODO: Check retx_queue dl_rlc_buffer_state(ue_ev.rnti, lcid, tot_dl_data, 0); // TODO: Check retx_queue
} else {
// Let SRB0 get emptied
} }
} }

Loading…
Cancel
Save