simplification of scheduling of UL acks in sched random tester

This commit is contained in:
Francisco 2020-12-08 21:06:03 +00:00 committed by Andre Puschmann
parent 86eb315102
commit 8f05982bef
4 changed files with 40 additions and 59 deletions

View File

@ -75,12 +75,17 @@ ue_sim::sync_tti_events ue_sim::get_pending_events(srslte::tti_point tti_rx, sch
cc_feedback.configured = true;
cc_feedback.ue_cc_idx = ctxt.enb_to_ue_cc_idx(enb_cc_idx);
for (uint32_t pid = 0; pid < SRSLTE_FDD_NOF_HARQ; ++pid) {
auto& h = ctxt.cc_list[cc_feedback.ue_cc_idx].dl_harqs[pid];
auto& dl_h = ctxt.cc_list[cc_feedback.ue_cc_idx].dl_harqs[pid];
auto& ul_h = ctxt.cc_list[cc_feedback.ue_cc_idx].ul_harqs[pid];
if (h.active and to_tx_dl_ack(h.last_tti_rx) == tti_rx) {
if (dl_h.active and to_tx_dl_ack(dl_h.last_tti_rx) == tti_rx) {
cc_feedback.dl_pid = pid;
cc_feedback.dl_ack = false; // default is NACK
}
if (ul_h.active and to_tx_ul(ul_h.last_tti_rx) == tti_rx) {
cc_feedback.ul_pid = pid;
cc_feedback.ul_ack = false;
}
}
}
return {this, sched};
@ -105,6 +110,7 @@ void ue_sim::push_feedback(sched_interface* sched)
if (sched->dl_ack_info(
pending_feedback.tti_rx.to_uint(), ctxt.rnti, enb_cc_idx, cc_feedback.tb, cc_feedback.dl_ack) < 0) {
log_h->error("The ACKed DL Harq pid=%d does not exist.\n", cc_feedback.dl_pid);
error_count++;
}
// set UE sim context
@ -112,11 +118,33 @@ void ue_sim::push_feedback(sched_interface* sched)
h.active = false;
}
}
if (cc_feedback.ul_pid >= 0) {
auto& h = ctxt.cc_list[cc_feedback.ue_cc_idx].ul_harqs[cc_feedback.dl_pid];
if (cc_feedback.ul_ack) {
log_h->info(
"UL ACK rnti=0x%x tti_ul_tx=%u pid=%d\n", ctxt.rnti, to_tx_ul(h.last_tti_rx).to_uint(), cc_feedback.dl_pid);
}
// update scheduler
if (sched->ul_crc_info(pending_feedback.tti_rx.to_uint(), ctxt.rnti, enb_cc_idx, cc_feedback.ul_ack) < 0) {
log_h->error("The ACKed UL Harq pid=%d does not exist.\n", cc_feedback.ul_pid);
error_count++;
}
}
}
}
int ue_sim::update(const sf_output_res_t& sf_out)
{
if (error_count > 0) {
return SRSLTE_ERROR;
}
if (pending_feedback.tti_rx != sf_out.tti_rx) {
// generate default events
auto default_events = get_pending_events(sf_out.tti_rx, nullptr);
}
update_conn_state(sf_out);
update_dl_harqs(sf_out);
update_ul_harqs(sf_out);

View File

@ -61,6 +61,8 @@ struct ue_tti_events {
int dl_pid = -1;
bool dl_ack = false;
int tb = 0;
int ul_pid = -1;
bool ul_ack = false;
};
srslte::tti_point tti_rx;
std::vector<cc_data> cc_list;
@ -110,6 +112,7 @@ private:
const std::vector<sched_interface::cell_cfg_t>* cell_params;
sim_ue_ctxt_t ctxt;
ue_tti_events pending_feedback;
uint32_t error_count = 0;
};
class ue_db_sim

View File

@ -87,7 +87,7 @@ int ue_ctxt_test::new_tti(sched* sched_ptr, srslte::tti_point tti_rx)
{
current_tti_rx = tti_rx;
TESTASSERT(fwd_pending_acks(sched_ptr) == SRSLTE_SUCCESS);
TESTASSERT(fwd_ue_feedback(sched_ptr) == SRSLTE_SUCCESS);
if (sim_cfg.periodic_cqi and (tti_rx.to_uint() % sim_cfg.cqi_Npd) == sim_cfg.cqi_Noffset) {
for (auto& cc : active_ccs) {
sched_ptr->dl_cqi_info(
@ -100,7 +100,7 @@ int ue_ctxt_test::new_tti(sched* sched_ptr, srslte::tti_point tti_rx)
return SRSLTE_SUCCESS;
}
int ue_ctxt_test::fwd_pending_acks(sched* sched_ptr)
int ue_ctxt_test::fwd_ue_feedback(sched* sched_ptr)
{
auto pending_feedback = ue_ctxt->get_pending_events(current_tti_rx, sched_ptr);
@ -115,24 +115,12 @@ int ue_ctxt_test::fwd_pending_acks(sched* sched_ptr)
auto& h = ue_ctxt->get_ctxt().cc_list[cc_feedback.ue_cc_idx].dl_harqs[cc_feedback.dl_pid];
cc_feedback.dl_ack = randf() < sim_cfg.prob_dl_ack_mask[h.nof_retxs % sim_cfg.prob_dl_ack_mask.size()];
}
}
/* Ack UL HARQs */
while (not pending_ul_acks.empty()) {
auto& p = pending_ul_acks.top();
if (p.tti_ack > current_tti_rx) {
break;
// ACK UL HARQs
if (cc_feedback.ul_pid >= 0) {
auto& h = ue_ctxt->get_ctxt().cc_list[cc_feedback.ue_cc_idx].ul_harqs[cc_feedback.ul_pid];
cc_feedback.ul_ack = randf() < sim_cfg.prob_ul_ack_mask[h.nof_retxs % sim_cfg.prob_ul_ack_mask.size()];
}
auto& h = ue_ctxt->get_ctxt().cc_list[p.ue_cc_idx].ul_harqs[p.pid];
CONDERROR(not h.active, "The ACKed UL Harq pid=%d is not active\n", h.pid);
CONDERROR(to_tx_ul(h.last_tti_rx) != p.tti_ack, "UL CRC wasn't set when expected\n");
CONDERROR(sched_ptr->ul_crc_info(current_tti_rx.to_uint(), rnti, p.cc_idx, p.ack) != SRSLTE_SUCCESS,
"Failed UL ACK\n");
if (p.ack) {
log_h->info("UL ACK tti=%u rnti=0x%x pid=%d\n", current_tti_rx.to_uint(), rnti, p.pid);
}
pending_ul_acks.pop();
}
return SRSLTE_SUCCESS;
@ -144,7 +132,6 @@ int ue_ctxt_test::test_sched_result(uint32_t enb_cc_idx,
{
cc_result result{enb_cc_idx, &dl_result, &ul_result};
TESTASSERT(test_scell_activation(result) == SRSLTE_SUCCESS);
TESTASSERT(schedule_acks(result) == SRSLTE_SUCCESS);
return SRSLTE_SUCCESS;
}
@ -184,34 +171,6 @@ int ue_ctxt_test::test_scell_activation(cc_result result)
return SRSLTE_SUCCESS;
}
int ue_ctxt_test::schedule_acks(cc_result result)
{
auto* cc = get_cc_state(result.enb_cc_idx);
if (cc == nullptr) {
return SRSLTE_SUCCESS;
}
/* Schedule UL ACKs */
for (uint32_t i = 0; i < result.ul_result->nof_dci_elems; ++i) {
const auto& pusch = result.ul_result->pusch[i];
if (pusch.dci.rnti != rnti) {
continue;
}
pending_ack_t ack_data;
ack_data.tti_ack = to_tx_ul(current_tti_rx);
ack_data.cc_idx = result.enb_cc_idx;
ack_data.ue_cc_idx = pusch.dci.ue_cc_idx;
ack_data.tb = 0;
ack_data.pid = to_tx_ul(current_tti_rx).to_uint() % (FDD_HARQ_DELAY_DL_MS + FDD_HARQ_DELAY_UL_MS);
uint32_t nof_retx = srsenb::get_nof_retx(pusch.dci.tb.rv); // 0..3
ack_data.ack = randf() < sim_cfg.prob_ul_ack_mask[nof_retx % sim_cfg.prob_ul_ack_mask.size()];
pending_ul_acks.push(ack_data);
}
return SRSLTE_SUCCESS;
}
void user_state_sched_tester::new_tti(sched* sched_ptr, tti_point tti_rx)
{
tic++;

View File

@ -67,7 +67,7 @@ struct ue_ctxt_test {
const sched::ul_sched_res_t& ul_result);
private:
int fwd_pending_acks(sched* sched_ptr);
int fwd_ue_feedback(sched* sched_ptr);
struct cc_result {
uint32_t enb_cc_idx;
@ -76,15 +76,6 @@ private:
};
//! Test correct activation of SCells
int test_scell_activation(cc_result result);
int schedule_acks(cc_result result);
struct pending_ack_t {
srslte::tti_point tti_ack;
uint32_t cc_idx, ue_cc_idx, tb, pid;
bool ack;
bool operator<(const pending_ack_t& other) const { return tti_ack > other.tti_ack; }
};
std::priority_queue<pending_ack_t> pending_ul_acks;
};
class user_state_sched_tester