cleaned up some of the log error messages in the sched tester

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent c595696ec2
commit f571b7c16b

@ -65,12 +65,12 @@ int output_sched_tester::test_pusch_collisions(const tti_params_t&
auto try_ul_fill = [&](srsenb::ul_harq_proc::ul_alloc_t alloc, const char* ch_str, bool strict = true) { auto try_ul_fill = [&](srsenb::ul_harq_proc::ul_alloc_t alloc, const char* ch_str, bool strict = true) {
CONDERROR((alloc.RB_start + alloc.L) > nof_prb, CONDERROR((alloc.RB_start + alloc.L) > nof_prb,
"[TESTER] Allocated RBs (%d,%d) out-of-bounds\n", "Allocated RBs (%d,%d) out-of-bounds\n",
alloc.RB_start, alloc.RB_start,
alloc.RB_start + alloc.L); alloc.RB_start + alloc.L);
CONDERROR(alloc.L == 0, "[TESTER] Allocations must have at least one PRB\n"); CONDERROR(alloc.L == 0, "Allocations must have at least one PRB\n");
if (strict and ul_allocs.any(alloc.RB_start, alloc.RB_start + alloc.L)) { if (strict and ul_allocs.any(alloc.RB_start, alloc.RB_start + alloc.L)) {
TESTERROR("[TESTER] Collision Detected of %s alloc=(%d,%d) and cumulative_mask=0x%s\n", TESTERROR("Collision Detected of %s alloc=(%d,%d) and cumulative_mask=0x%s\n",
ch_str, ch_str,
alloc.RB_start, alloc.RB_start,
alloc.RB_start + alloc.L, alloc.RB_start + alloc.L,
@ -116,7 +116,7 @@ int output_sched_tester::test_pdsch_collisions(const tti_params_t&
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if ((dl_allocs & alloc_mask).any()) { if ((dl_allocs & alloc_mask).any()) {
TESTERROR("[TESTER] Detected collision in the DL %s allocation (%s intersects %s)\n", TESTERROR("Detected collision in the DL %s allocation (%s intersects %s)\n",
channel, channel,
dl_allocs.to_string().c_str(), dl_allocs.to_string().c_str(),
alloc_mask.to_string().c_str()); alloc_mask.to_string().c_str());
@ -155,7 +155,7 @@ int output_sched_tester::test_pdsch_collisions(const tti_params_t&
for (uint32_t i = 0; i < cell_params.nof_rbgs; ++i) { for (uint32_t i = 0; i < cell_params.nof_rbgs; ++i) {
uint32_t lim = SRSLTE_MIN((i + 1) * cell_params.P, dl_allocs.size()); uint32_t lim = SRSLTE_MIN((i + 1) * cell_params.P, dl_allocs.size());
bool val = dl_allocs.any(i * cell_params.P, lim); bool val = dl_allocs.any(i * cell_params.P, lim);
CONDERROR(rev_alloc.any(i * cell_params.P, lim) and val, "[TESTER] No holes can be left in an RBG\n"); CONDERROR(rev_alloc.any(i * cell_params.P, lim) and val, "No holes can be left in an RBG\n");
if (val) { if (val) {
rbgmask.set(i); rbgmask.set(i);
} }
@ -216,7 +216,7 @@ int output_sched_tester::test_pdcch_collisions(const sched_interface::dl_sched_r
auto try_cce_fill = [&](const srslte_dci_location_t& dci_loc, const char* ch) { auto try_cce_fill = [&](const srslte_dci_location_t& dci_loc, const char* ch) {
uint32_t cce_start = dci_loc.ncce, cce_stop = dci_loc.ncce + (1u << dci_loc.L); uint32_t cce_start = dci_loc.ncce, cce_stop = dci_loc.ncce + (1u << dci_loc.L);
if (used_cce->any(cce_start, cce_stop)) { if (used_cce->any(cce_start, cce_stop)) {
TESTERROR("[TESTER] %s DCI collision between CCE positions (%u, %u)\n", ch, cce_start, cce_stop); TESTERROR("%s DCI collision between CCE positions (%u, %u)\n", ch, cce_start, cce_stop);
} }
used_cce->fill(cce_start, cce_stop); used_cce->fill(cce_start, cce_stop);
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
@ -256,7 +256,7 @@ int output_sched_tester::test_dci_values_consistency(const sched_interface::dl_s
continue; continue;
} }
CONDERROR(pusch.dci.location.L == 0, CONDERROR(pusch.dci.location.L == 0,
"[TESTER] Invalid aggregation level %d\n", "Invalid aggregation level %d\n",
pusch.dci.location.L); // TODO: Extend this test pusch.dci.location.L); // TODO: Extend this test
} }
for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) { for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) {
@ -331,7 +331,7 @@ int user_state_sched_tester::add_user(uint16_t r
{ {
CONDERROR(!srslte_prach_tti_opportunity_config_fdd( CONDERROR(!srslte_prach_tti_opportunity_config_fdd(
cell_params[ue_cfg.supported_cc_list[0].enb_cc_idx].prach_config, tic.tti_rx(), -1), cell_params[ue_cfg.supported_cc_list[0].enb_cc_idx].prach_config, tic.tti_rx(), -1),
"[TESTER] New user added in a non-PRACH TTI\n"); "New user added in a non-PRACH TTI\n");
TESTASSERT(users.count(rnti) == 0); TESTASSERT(users.count(rnti) == 0);
ue_state ue; ue_state ue;
ue.user_cfg = ue_cfg; ue.user_cfg = ue_cfg;
@ -430,7 +430,7 @@ int user_state_sched_tester::test_ra(uint32_t enb_
auto& data = dl_result.rar[i].msg3_grant[j].data; auto& data = dl_result.rar[i].msg3_grant[j].data;
if (data.prach_tti == (uint32_t)userinfo.prach_tic.tti_rx() and data.preamble_idx == userinfo.preamble_idx) { if (data.prach_tti == (uint32_t)userinfo.prach_tic.tti_rx() and data.preamble_idx == userinfo.preamble_idx) {
CONDERROR(userinfo.rar_tic.is_valid(), "There was more than one RAR for the same user\n"); CONDERROR(userinfo.rar_tic.is_valid(), "There was more than one RAR for the same user\n");
CONDERROR(rnti != data.temp_crnti, "[TESTER] RAR grant C-RNTI does not match the expected.\n"); CONDERROR(rnti != data.temp_crnti, "RAR grant C-RNTI does not match the expected.\n");
userinfo.msg3_riv = dl_result.rar[i].msg3_grant[j].grant.rba; userinfo.msg3_riv = dl_result.rar[i].msg3_grant[j].grant.rba;
userinfo.rar_tic = tic_tx_dl; userinfo.rar_tic = tic_tx_dl;
} }
@ -453,7 +453,7 @@ int user_state_sched_tester::test_ra(uint32_t enb_
} }
} }
} else if (expected_msg3_tti < tic.tic_tx_ul()) { } else if (expected_msg3_tti < tic.tic_tx_ul()) {
CONDERROR(not userinfo.msg3_tic.is_valid(), "[TESTER] No UL msg3 allocation was made\n"); CONDERROR(not userinfo.msg3_tic.is_valid(), "No UL msg3 allocation was made\n");
} }
} }
@ -483,7 +483,7 @@ int user_state_sched_tester::test_ra(uint32_t enb_
} }
} }
} }
CONDERROR(msg3_count > 0, "[TESTER] There are pending msg3 that do not belong to any active UE\n"); CONDERROR(msg3_count > 0, "There are pending msg3 that do not belong to any active UE\n");
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -625,10 +625,10 @@ int common_sched_tester::sim_cfg(sim_sched_args args)
int common_sched_tester::add_user(uint16_t rnti, const ue_cfg_t& ue_cfg_) int common_sched_tester::add_user(uint16_t rnti, const ue_cfg_t& ue_cfg_)
{ {
CONDERROR(ue_cfg(rnti, ue_cfg_) != SRSLTE_SUCCESS, "[TESTER] Configuring new user rnti=0x%x to sched\n", rnti); CONDERROR(ue_cfg(rnti, ue_cfg_) != SRSLTE_SUCCESS, "Configuring new user rnti=0x%x to sched\n", rnti);
// CONDERROR(!srslte_prach_tti_opportunity_config_fdd( // CONDERROR(!srslte_prach_tti_opportunity_config_fdd(
// sched_cell_params[CARRIER_IDX].cfg.prach_config, tti_info.tti_params.tti_rx, -1), // sched_cell_params[CARRIER_IDX].cfg.prach_config, tti_info.tti_params.tti_rx, -1),
// "[TESTER] New user added in a non-PRACH TTI\n"); // "New user added in a non-PRACH TTI\n");
dl_sched_rar_info_t rar_info = {}; dl_sched_rar_info_t rar_info = {};
rar_info.prach_tti = tti_info.tti_params.tti_rx; rar_info.prach_tti = tti_info.tti_params.tti_rx;
@ -640,13 +640,13 @@ int common_sched_tester::add_user(uint16_t rnti, const ue_cfg_t& ue_cfg_)
ue_tester->add_user(rnti, rar_info.preamble_idx, ue_cfg_); ue_tester->add_user(rnti, rar_info.preamble_idx, ue_cfg_);
tester_log->info("[TESTER] Adding user rnti=0x%x\n", rnti); tester_log->info("Adding user rnti=0x%x\n", rnti);
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
void common_sched_tester::rem_user(uint16_t rnti) void common_sched_tester::rem_user(uint16_t rnti)
{ {
tester_log->info("[TESTER] Removing user rnti=0x%x\n", rnti); tester_log->info("Removing user rnti=0x%x\n", rnti);
sched::ue_rem(rnti); sched::ue_rem(rnti);
ue_tester->rem_user(rnti); ue_tester->rem_user(rnti);
} }
@ -688,7 +688,7 @@ int common_sched_tester::process_ack_txs()
srsenb::dl_harq_proc* h = ue_db[dl_ack.rnti].get_dl_harq(ack_it.second.dl_harq.get_id(), dl_ack.ue_cc_idx); srsenb::dl_harq_proc* h = ue_db[dl_ack.rnti].get_dl_harq(ack_it.second.dl_harq.get_id(), dl_ack.ue_cc_idx);
const srsenb::dl_harq_proc& hack = dl_ack.dl_harq; const srsenb::dl_harq_proc& hack = dl_ack.dl_harq;
CONDERROR(hack.is_empty(), "[TESTER] The acked DL harq was not active\n"); CONDERROR(hack.is_empty(), "The acked DL harq was not active\n");
bool ret = false; bool ret = false;
for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; ++tb) { for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; ++tb) {
@ -697,18 +697,15 @@ int common_sched_tester::process_ack_txs()
} }
ret |= dl_ack_info(tti_info.tti_params.tti_rx, dl_ack.rnti, dl_ack.ue_cc_idx, tb, dl_ack.ack) > 0; ret |= dl_ack_info(tti_info.tti_params.tti_rx, dl_ack.rnti, dl_ack.ue_cc_idx, tb, dl_ack.ack) > 0;
} }
CONDERROR(not ret, "[TESTER] The dl harq proc that was ACKed does not exist\n"); CONDERROR(not ret, "The dl harq proc that was ACKed does not exist\n");
if (dl_ack.ack) { if (dl_ack.ack) {
CONDERROR(!h->is_empty(), "[TESTER] ACKed dl harq was not emptied\n"); CONDERROR(!h->is_empty(), "ACKed dl harq was not emptied\n");
CONDERROR(h->has_pending_retx(0, tti_info.tti_params.tti_tx_dl), CONDERROR(h->has_pending_retx(0, tti_info.tti_params.tti_tx_dl), "ACKed dl harq still has pending retx\n");
"[TESTER] ACKed dl harq still has pending retx\n"); tester_log->info(
tester_log->info("[TESTER] DL ACK tti=%u rnti=0x%x pid=%d\n", "DL ACK tti=%u rnti=0x%x pid=%d\n", tti_info.tti_params.tti_rx, dl_ack.rnti, dl_ack.dl_harq.get_id());
tti_info.tti_params.tti_rx,
dl_ack.rnti,
dl_ack.dl_harq.get_id());
} else { } else {
CONDERROR(h->is_empty() and hack.nof_retx(0) + 1 < hack.max_nof_retx(), "[TESTER] NACKed DL harq got emptied\n"); CONDERROR(h->is_empty() and hack.nof_retx(0) + 1 < hack.max_nof_retx(), "NACKed DL harq got emptied\n");
} }
} }
@ -721,25 +718,23 @@ int common_sched_tester::process_ack_txs()
srsenb::ul_harq_proc* h = ue_db[ul_ack.rnti].get_ul_harq(tti_info.tti_params.tti_rx, ul_ack.ue_cc_idx); srsenb::ul_harq_proc* h = ue_db[ul_ack.rnti].get_ul_harq(tti_info.tti_params.tti_rx, ul_ack.ue_cc_idx);
const srsenb::ul_harq_proc& hack = ul_ack.ul_harq; const srsenb::ul_harq_proc& hack = ul_ack.ul_harq;
CONDERROR(h == nullptr or h->get_tti() != hack.get_tti(), "[TESTER] UL Harq TTI does not match the ACK TTI\n"); CONDERROR(h == nullptr or h->get_tti() != hack.get_tti(), "UL Harq TTI does not match the ACK TTI\n");
CONDERROR(h->is_empty(0), "[TESTER] The acked UL harq is not active\n"); CONDERROR(h->is_empty(0), "The acked UL harq is not active\n");
CONDERROR(hack.is_empty(0), "[TESTER] The acked UL harq was not active\n"); CONDERROR(hack.is_empty(0), "The acked UL harq was not active\n");
ul_crc_info(tti_info.tti_params.tti_rx, ul_ack.rnti, ul_ack.ue_cc_idx, ul_ack.ack); ul_crc_info(tti_info.tti_params.tti_rx, ul_ack.rnti, ul_ack.ue_cc_idx, ul_ack.ack);
CONDERROR(!h->get_pending_data(), "[TESTER] UL harq lost its pending data\n"); CONDERROR(!h->get_pending_data(), "UL harq lost its pending data\n");
CONDERROR(!h->has_pending_ack(), "[TESTER] ACK/NACKed UL harq should have a pending ACK\n"); CONDERROR(!h->has_pending_ack(), "ACK/NACKed UL harq should have a pending ACK\n");
if (ul_ack.ack) { if (ul_ack.ack) {
CONDERROR(!h->is_empty(), "[TESTER] ACKed UL harq did not get emptied\n"); CONDERROR(!h->is_empty(), "ACKed UL harq did not get emptied\n");
CONDERROR(h->has_pending_retx(), "[TESTER] ACKed UL harq still has pending retx\n"); CONDERROR(h->has_pending_retx(), "ACKed UL harq still has pending retx\n");
tester_log->info( tester_log->info("UL ACK tti=%u rnti=0x%x pid=%d\n", tti_info.tti_params.tti_rx, ul_ack.rnti, hack.get_id());
"[TESTER] UL ACK tti=%u rnti=0x%x pid=%d\n", tti_info.tti_params.tti_rx, ul_ack.rnti, hack.get_id());
} else { } else {
// NACK // NACK
CONDERROR(!h->is_empty() and !h->has_pending_retx(), "[TESTER] If NACKed, UL harq has to have pending retx\n"); CONDERROR(!h->is_empty() and !h->has_pending_retx(), "If NACKed, UL harq has to have pending retx\n");
CONDERROR(h->is_empty() and hack.nof_retx(0) + 1 < hack.max_nof_retx(), CONDERROR(h->is_empty() and hack.nof_retx(0) + 1 < hack.max_nof_retx(), "Nacked UL harq did get emptied\n");
"[TESTER] Nacked UL harq did get emptied\n");
} }
} }
@ -747,16 +742,6 @@ int common_sched_tester::process_ack_txs()
to_ack.erase(tti_info.tti_params.tti_rx); to_ack.erase(tti_info.tti_params.tti_rx);
to_ul_ack.erase(tti_info.tti_params.tti_rx); to_ul_ack.erase(tti_info.tti_params.tti_rx);
// bool ack = true; //(tti_data.tti_rx % 3) == 0;
// if (tti_data.tti_rx >= FDD_HARQ_DELAY_MS) {
// for (auto it = ue_db.begin(); it != ue_db.end(); ++it) {
// uint16_t rnti = it->first;
// srsenb::ul_harq_proc* h = ue_db[rnti].get_ul_harq(tti_data.tti_rx);
// if (h != nullptr and not h->is_empty()) {
// ul_crc_info(tti_data.tti_rx, rnti, ack);
// }
// }
// }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -784,7 +769,7 @@ int common_sched_tester::schedule_acks()
if (it->second.rnti == ack_data.rnti and it->second.dl_harq.get_id() == ack_data.dl_harq.get_id() and if (it->second.rnti == ack_data.rnti and it->second.dl_harq.get_id() == ack_data.dl_harq.get_id() and
it->second.ue_cc_idx == ack_data.ue_cc_idx) { it->second.ue_cc_idx == ack_data.ue_cc_idx) {
CONDERROR(it->second.tti + 2 * FDD_HARQ_DELAY_MS > ack_data.tti, CONDERROR(it->second.tti + 2 * FDD_HARQ_DELAY_MS > ack_data.tti,
"[TESTER] The retx dl harq id=%d was transmitted too soon\n", "The retx dl harq id=%d was transmitted too soon\n",
ack_data.dl_harq.get_id()); ack_data.dl_harq.get_id());
auto toerase_it = it++; auto toerase_it = it++;
to_ack.erase(toerase_it); to_ack.erase(toerase_it);
@ -899,7 +884,7 @@ int common_sched_tester::process_tti_events(const tti_ev& tti_ev)
int common_sched_tester::run_tti(const tti_ev& tti_events) int common_sched_tester::run_tti(const tti_ev& tti_events)
{ {
new_test_tti(); new_test_tti();
tester_log->info("[TESTER] ---- tti=%u | nof_ues=%zd ----\n", tic.tti_rx(), ue_db.size()); tester_log->info("---- tti=%u | nof_ues=%zd ----\n", tic.tti_rx(), ue_db.size());
process_tti_events(tti_events); process_tti_events(tti_events);
process_ack_txs(); process_ack_txs();

@ -85,13 +85,13 @@ public:
void log_diagnostics() override void log_diagnostics() override
{ {
info("[TESTER] UE stats:\n"); info("UE stats:\n");
for (auto& e : ue_stats) { for (auto& e : ue_stats) {
info("0x%x: {DL RBs: %" PRIu64 ", UL RBs: %" PRIu64 "}\n", e.first, e.second.nof_dl_rbs, e.second.nof_ul_rbs); info("0x%x: {DL RBs: %" PRIu64 ", UL RBs: %" PRIu64 "}\n", e.first, e.second.nof_dl_rbs, e.second.nof_ul_rbs);
} }
info("[TESTER] Number of assertion warnings: %u\n", warn_counter); info("Number of assertion warnings: %u\n", warn_counter);
info("[TESTER] Number of assertion errors: %u\n", error_counter); info("Number of assertion errors: %u\n", error_counter);
info("[TESTER] This was the seed: %u\n", seed); info("This was the seed: %u\n", seed);
} }
}; };
srslte::scoped_log<sched_test_log> log_global{}; srslte::scoped_log<sched_test_log> log_global{};
@ -123,8 +123,6 @@ struct sched_tester : public srsenb::common_sched_tester {
// sched results // sched results
sched_tti_data tti_data; sched_tti_data tti_data;
~sched_tester() override = default;
void rem_user(uint16_t rnti) override; void rem_user(uint16_t rnti) override;
int test_pdcch_collisions(); int test_pdcch_collisions();
int assert_no_empty_allocs(); int assert_no_empty_allocs();
@ -211,7 +209,7 @@ int sched_tester::assert_no_empty_allocs()
auto& pusch = tti_info.ul_sched_result[CARRIER_IDX].pusch[i]; auto& pusch = tti_info.ul_sched_result[CARRIER_IDX].pusch[i];
if (pusch.dci.rnti == rnti and pusch.needs_pdcch) { if (pusch.dci.rnti == rnti and pusch.needs_pdcch) {
// TODO: This test does not work for adaptive re-tx // TODO: This test does not work for adaptive re-tx
TESTERROR("[TESTER] There was a user without data that got allocated in UL\n"); TESTERROR("There was a user without data that got allocated in UL\n");
} }
} }
} }
@ -219,8 +217,7 @@ int sched_tester::assert_no_empty_allocs()
iter.second.ul_retx_got_delayed = iter.second.has_ul_retx and iter.second.ul_harq.is_empty(0); iter.second.ul_retx_got_delayed = iter.second.has_ul_retx and iter.second.ul_harq.is_empty(0);
tti_data.total_ues.ul_retx_got_delayed |= iter.second.ul_retx_got_delayed; tti_data.total_ues.ul_retx_got_delayed |= iter.second.ul_retx_got_delayed;
// Retxs cannot give space to newtx allocations // Retxs cannot give space to newtx allocations
CONDERROR( CONDERROR(tti_data.total_ues.ul_retx_got_delayed, "There was a retx that was erased for user rnti=0x%x\n", rnti);
tti_data.total_ues.ul_retx_got_delayed, "[TESTER] There was a retx that was erased for user rnti=0x%x\n", rnti);
} }
// There must be allocations if there is pending data/retxs. // There must be allocations if there is pending data/retxs.
@ -256,7 +253,7 @@ int sched_tester::test_pdcch_collisions()
auto* tti_alloc = carrier_schedulers[0]->get_sf_sched_ptr(tti_info.tti_params.tti_rx); auto* tti_alloc = carrier_schedulers[0]->get_sf_sched_ptr(tti_info.tti_params.tti_rx);
if (used_cce != tti_alloc->get_pdcch_mask()) { if (used_cce != tti_alloc->get_pdcch_mask()) {
std::string mask_str = tti_alloc->get_pdcch_mask().to_string(); std::string mask_str = tti_alloc->get_pdcch_mask().to_string();
TESTERROR("[TESTER] The used_cce do not match: (%s!=%s)\n", mask_str.c_str(), used_cce.to_string().c_str()); TESTERROR("The used_cce do not match: (%s!=%s)\n", mask_str.c_str(), used_cce.to_string().c_str());
} }
// TODO: Check postponed retxs // TODO: Check postponed retxs
@ -283,23 +280,23 @@ int sched_tester::test_harqs()
uint32_t h_id = data.dci.pid; uint32_t h_id = data.dci.pid;
uint16_t rnti = data.dci.rnti; uint16_t rnti = data.dci.rnti;
const srsenb::dl_harq_proc* h = ue_db[rnti].get_dl_harq(h_id, CARRIER_IDX); const srsenb::dl_harq_proc* h = ue_db[rnti].get_dl_harq(h_id, CARRIER_IDX);
CONDERROR(h == nullptr, "[TESTER] scheduled DL harq pid=%d does not exist\n", h_id); CONDERROR(h == nullptr, "scheduled DL harq pid=%d does not exist\n", h_id);
CONDERROR(h->is_empty(), "[TESTER] Cannot schedule an empty harq proc\n"); CONDERROR(h->is_empty(), "Cannot schedule an empty harq proc\n");
CONDERROR(h->get_tti() != tti_info.tti_params.tti_tx_dl, CONDERROR(h->get_tti() != tti_info.tti_params.tti_tx_dl,
"[TESTER] The scheduled DL harq pid=%d does not a valid tti=%u\n", "The scheduled DL harq pid=%d does not a valid tti=%u\n",
h_id, h_id,
tti_info.tti_params.tti_tx_dl); tti_info.tti_params.tti_tx_dl);
CONDERROR(h->get_n_cce() != data.dci.location.ncce, "[TESTER] Harq DCI location does not match with result\n"); CONDERROR(h->get_n_cce() != data.dci.location.ncce, "Harq DCI location does not match with result\n");
if (tti_data.ue_data[rnti].dl_harqs[h_id].has_pending_retx(0, tti_info.tti_params.tti_tx_dl)) { // retx if (tti_data.ue_data[rnti].dl_harqs[h_id].has_pending_retx(0, tti_info.tti_params.tti_tx_dl)) { // retx
CONDERROR(tti_data.ue_data[rnti].dl_harqs[h_id].nof_retx(0) + 1 != h->nof_retx(0), CONDERROR(tti_data.ue_data[rnti].dl_harqs[h_id].nof_retx(0) + 1 != h->nof_retx(0),
"[TESTER] A dl harq of user rnti=0x%x was likely overwritten.\n", "A dl harq of user rnti=0x%x was likely overwritten.\n",
rnti); rnti);
CONDERROR(h->nof_retx(0) >= sim_args0.ue_cfg.maxharq_tx, CONDERROR(h->nof_retx(0) >= sim_args0.ue_cfg.maxharq_tx,
"[TESTER] The number of retx=%d exceeded its max=%d\n", "The number of retx=%d exceeded its max=%d\n",
h->nof_retx(0), h->nof_retx(0),
sim_args0.ue_cfg.maxharq_tx); sim_args0.ue_cfg.maxharq_tx);
} else { // newtx } else { // newtx
CONDERROR(h->nof_retx(0) != 0, "[TESTER] A new harq was scheduled but with invalid number of retxs\n"); CONDERROR(h->nof_retx(0) != 0, "A new harq was scheduled but with invalid number of retxs\n");
} }
} }
@ -308,36 +305,36 @@ int sched_tester::test_harqs()
uint16_t rnti = pusch.dci.rnti; uint16_t rnti = pusch.dci.rnti;
const auto& ue_data = tti_data.ue_data[rnti]; const auto& ue_data = tti_data.ue_data[rnti];
const srsenb::ul_harq_proc* h = ue_db[rnti].get_ul_harq(tti_info.tti_params.tti_tx_ul, CARRIER_IDX); const srsenb::ul_harq_proc* h = ue_db[rnti].get_ul_harq(tti_info.tti_params.tti_tx_ul, CARRIER_IDX);
CONDERROR(h == nullptr or h->is_empty(), "[TESTER] scheduled UL harq does not exist or is empty\n"); CONDERROR(h == nullptr or h->is_empty(), "scheduled UL harq does not exist or is empty\n");
CONDERROR(h->get_tti() != tti_info.tti_params.tti_tx_ul, CONDERROR(h->get_tti() != tti_info.tti_params.tti_tx_ul,
"[TESTER] The scheduled UL harq does not a valid tti=%u\n", "The scheduled UL harq does not a valid tti=%u\n",
tti_info.tti_params.tti_tx_ul); tti_info.tti_params.tti_tx_ul);
CONDERROR(h->has_pending_ack(), "[TESTER] At the end of the TTI, there shouldnt be any pending ACKs\n"); CONDERROR(h->has_pending_ack(), "At the end of the TTI, there shouldnt be any pending ACKs\n");
if (h->has_pending_retx()) { if (h->has_pending_retx()) {
// retx // retx
CONDERROR(ue_data.ul_harq.is_empty(0), "[TESTER] reTx in an UL harq that was empty\n"); CONDERROR(ue_data.ul_harq.is_empty(0), "reTx in an UL harq that was empty\n");
CONDERROR(h->nof_retx(0) != ue_data.ul_harq.nof_retx(0) + 1, CONDERROR(h->nof_retx(0) != ue_data.ul_harq.nof_retx(0) + 1,
"[TESTER] A retx UL harq was scheduled but with invalid number of retxs\n"); "A retx UL harq was scheduled but with invalid number of retxs\n");
CONDERROR(h->is_adaptive_retx() and not pusch.needs_pdcch, "[TESTER] Adaptive retxs need PDCCH alloc\n"); CONDERROR(h->is_adaptive_retx() and not pusch.needs_pdcch, "Adaptive retxs need PDCCH alloc\n");
} else { } else {
CONDERROR(h->nof_retx(0) != 0, "[TESTER] A new harq was scheduled but with invalid number of retxs\n"); CONDERROR(h->nof_retx(0) != 0, "A new harq was scheduled but with invalid number of retxs\n");
CONDERROR(not ue_data.ul_harq.is_empty(0), "[TESTER] UL new tx in a UL harq that was not empty\n"); CONDERROR(not ue_data.ul_harq.is_empty(0), "UL new tx in a UL harq that was not empty\n");
} }
} }
/* Check PHICH allocations */ /* Check PHICH allocations */
for (uint32_t i = 0; i < tti_info.ul_sched_result[CARRIER_IDX].nof_phich_elems; ++i) { for (uint32_t i = 0; i < tti_info.ul_sched_result[CARRIER_IDX].nof_phich_elems; ++i) {
const auto& phich = tti_info.ul_sched_result[CARRIER_IDX].phich[i]; const auto& phich = tti_info.ul_sched_result[CARRIER_IDX].phich[i];
CONDERROR(tti_data.ue_data.count(phich.rnti) == 0, "[TESTER] Allocated PHICH rnti no longer exists\n"); CONDERROR(tti_data.ue_data.count(phich.rnti) == 0, "Allocated PHICH rnti no longer exists\n");
const auto& hprev = tti_data.ue_data[phich.rnti].ul_harq; const auto& hprev = tti_data.ue_data[phich.rnti].ul_harq;
const auto* h = ue_db[phich.rnti].get_ul_harq(tti_info.tti_params.tti_tx_ul, CARRIER_IDX); const auto* h = ue_db[phich.rnti].get_ul_harq(tti_info.tti_params.tti_tx_ul, CARRIER_IDX);
CONDERROR(not hprev.has_pending_ack(), "[TESTER] Alloc PHICH did not have any pending ack\n"); CONDERROR(not hprev.has_pending_ack(), "Alloc PHICH did not have any pending ack\n");
bool maxretx_flag = hprev.nof_retx(0) + 1 >= hprev.max_nof_retx(); bool maxretx_flag = hprev.nof_retx(0) + 1 >= hprev.max_nof_retx();
if (phich.phich == sched_interface::ul_sched_phich_t::ACK) { if (phich.phich == sched_interface::ul_sched_phich_t::ACK) {
CONDERROR(!hprev.is_empty(), "[TESTER] ack phich for UL harq that is not empty\n"); CONDERROR(!hprev.is_empty(), "ack phich for UL harq that is not empty\n");
} else { } else {
CONDERROR(h->get_pending_data() == 0 and !maxretx_flag, "[TESTER] NACKed harq has no pending data\n"); CONDERROR(h->get_pending_data() == 0 and !maxretx_flag, "NACKed harq has no pending data\n");
} }
} }
for (const auto& ue : ue_db) { for (const auto& ue : ue_db) {
@ -353,7 +350,7 @@ int sched_tester::test_harqs()
} }
} }
CONDERROR(i == tti_info.ul_sched_result[CARRIER_IDX].nof_phich_elems, CONDERROR(i == tti_info.ul_sched_result[CARRIER_IDX].nof_phich_elems,
"[TESTER] harq had pending ack but no phich was allocked\n"); "harq had pending ack but no phich was allocked\n");
} }
// Check whether some pids got old // Check whether some pids got old
@ -363,9 +360,8 @@ int sched_tester::test_harqs()
if (not(user.second.get_dl_harq(i, CARRIER_IDX)->is_empty(0) and user.second.get_dl_harq(1, CARRIER_IDX))) { if (not(user.second.get_dl_harq(i, CARRIER_IDX)->is_empty(0) and user.second.get_dl_harq(1, CARRIER_IDX))) {
if (srslte_tti_interval(tti_info.tti_params.tti_tx_dl, user.second.get_dl_harq(i, CARRIER_IDX)->get_tti()) > if (srslte_tti_interval(tti_info.tti_params.tti_tx_dl, user.second.get_dl_harq(i, CARRIER_IDX)->get_tti()) >
49) { 49) {
TESTERROR("[TESTER] The pid=%d for rnti=0x%x got old.\n", TESTERROR(
user.second.get_dl_harq(i, CARRIER_IDX)->get_id(), "The pid=%d for rnti=0x%x got old.\n", user.second.get_dl_harq(i, CARRIER_IDX)->get_id(), user.first);
user.first);
} }
} }
} }
@ -386,7 +382,7 @@ int sched_tester::test_sch_collisions()
/* TEST: check whether cumulative UL PRB masks coincide */ /* TEST: check whether cumulative UL PRB masks coincide */
if (ul_allocs != tti_sched->get_ul_mask()) { if (ul_allocs != tti_sched->get_ul_mask()) {
TESTERROR("[TESTER] The UL PRB mask and the scheduler result UL mask are not consistent\n"); TESTERROR("The UL PRB mask and the scheduler result UL mask are not consistent\n");
} }
// update ue stats with number of allocated UL PRBs // update ue stats with number of allocated UL PRBs
@ -416,7 +412,7 @@ int sched_tester::test_sch_collisions()
// TEST: check if resulting DL mask is equal to scheduler internal DL mask // TEST: check if resulting DL mask is equal to scheduler internal DL mask
if (rbgmask != carrier_schedulers[0]->get_sf_sched_ptr(tti_info.tti_params.tti_rx)->get_dl_mask()) { if (rbgmask != carrier_schedulers[0]->get_sf_sched_ptr(tti_info.tti_params.tti_rx)->get_dl_mask()) {
TESTERROR("[TESTER] The UL PRB mask and the scheduler result UL mask are not consistent (%s!=%s)\n", TESTERROR("The UL PRB mask and the scheduler result UL mask are not consistent (%s!=%s)\n",
rbgmask.to_string().c_str(), rbgmask.to_string().c_str(),
carrier_schedulers[CARRIER_IDX] carrier_schedulers[CARRIER_IDX]
->get_sf_sched_ptr(tti_info.tti_params.tti_rx) ->get_sf_sched_ptr(tti_info.tti_params.tti_rx)
@ -493,7 +489,7 @@ int main()
{ {
// Setup seed // Setup seed
srsenb::set_randseed(seed); srsenb::set_randseed(seed);
printf("[TESTER] This is the chosen seed: %u\n", seed); printf("This is the chosen seed: %u\n", seed);
srslte::logmap::set_default_log_level(srslte::LOG_LEVEL_INFO); srslte::logmap::set_default_log_level(srslte::LOG_LEVEL_INFO);
uint32_t N_runs = 1, nof_ttis = 10240 + 10; uint32_t N_runs = 1, nof_ttis = 10240 + 10;

Loading…
Cancel
Save