extended dci content checks of DL and UL grants in the scheduler random tester.

This commit is contained in:
Francisco Paisana 2020-11-11 15:15:51 +00:00 committed by Andre Puschmann
parent 88105c1577
commit 64fca23eb3
5 changed files with 50 additions and 25 deletions

View File

@ -1210,8 +1210,6 @@ void sf_sched::set_ul_sched_result(const pdcch_grid_t::alloc_result_t& dci_resul
total_data_before,
old_pending_bytes);
pusch->current_tx_nb = h->nof_retx(0);
ul_result->nof_dci_elems++;
}
}

View File

@ -407,7 +407,7 @@ uint32_t sched_ue::allocate_mac_sdus(sched_interface::dl_sched_data_t* data, uin
uint32_t rem_tbs = total_tbs;
// if we do not have enough bytes to fit MAC subheader and RLC header, skip MAC SDU allocation
while (rem_tbs > MAC_MAX_HEADER_SIZE) {
while (rem_tbs > MAC_MAX_HEADER_SIZE and data->nof_pdu_elems[tbidx] < sched_interface::MAX_RLC_PDU_LIST) {
uint32_t max_sdu_bytes = rem_tbs - sched_utils::get_mac_subheader_size(rem_tbs - 2);
uint32_t alloc_sdu_bytes = lch_handler.alloc_rlc_pdu(&data->pdu[tbidx][data->nof_pdu_elems[tbidx]], max_sdu_bytes);
if (alloc_sdu_bytes == 0) {
@ -433,7 +433,7 @@ uint32_t sched_ue::allocate_mac_ces(sched_interface::dl_sched_data_t* data, uint
}
int rem_tbs = total_tbs;
while (not pending_ces.empty()) {
while (not pending_ces.empty() and data->nof_pdu_elems[0] < sched_interface::MAX_RLC_PDU_LIST) {
int toalloc = srslte::ce_total_size(pending_ces.front());
if (rem_tbs < toalloc) {
break;
@ -797,15 +797,16 @@ int sched_ue::generate_format0(sched_interface::ul_sched_data_t* data,
}
if (tbs >= 0) {
data->tbs = tbs;
dci->rnti = rnti;
dci->format = SRSLTE_DCI_FORMAT0;
dci->ue_cc_idx = ue_cc_idx;
dci->tb.ndi = h->get_ndi(0);
dci->cqi_request = cqi_request;
dci->freq_hop_fl = srslte_dci_ul_t::SRSLTE_RA_PUSCH_HOP_DISABLED;
dci->tpc_pusch = next_tpc_pusch;
next_tpc_pusch = 1;
data->tbs = tbs;
data->current_tx_nb = h->nof_retx(0);
dci->rnti = rnti;
dci->format = SRSLTE_DCI_FORMAT0;
dci->ue_cc_idx = ue_cc_idx;
dci->tb.ndi = h->get_ndi(0);
dci->cqi_request = cqi_request;
dci->freq_hop_fl = srslte_dci_ul_t::SRSLTE_RA_PUSCH_HOP_DISABLED;
dci->tpc_pusch = next_tpc_pusch;
next_tpc_pusch = 1;
dci->type2_alloc.riv = srslte_ra_type2_to_riv(alloc.length(), alloc.start(), cell.nof_prb);

View File

@ -22,6 +22,7 @@
#include "sched_common_test_suite.h"
#include "lib/include/srslte/phy/phch/prach.h"
#include "srslte/common/test_common.h"
#include <set>
using srslte::tti_point;
@ -267,18 +268,50 @@ int test_dci_content_common(const sf_output_res_t& sf_out, uint32_t enb_cc_idx)
const auto& cell_params = sf_out.cc_params[enb_cc_idx];
const auto& dl_result = sf_out.dl_cc_result[enb_cc_idx];
const auto& ul_result = sf_out.ul_cc_result[enb_cc_idx];
std::set<uint16_t> alloc_rntis;
for (uint32_t i = 0; i < ul_result.nof_dci_elems; ++i) {
const auto& pusch = ul_result.pusch[i];
uint16_t rnti = pusch.dci.rnti;
CONDERROR(pusch.tbs == 0, "Allocated PUSCH with invalid TBS=%d\n", pusch.tbs);
CONDERROR(alloc_rntis.count(rnti) > 0, "The user rnti=0x%x got allocated multiple times in UL\n", rnti);
alloc_rntis.insert(pusch.dci.rnti);
CONDERROR(not((pusch.current_tx_nb == 0) xor (pusch.dci.tb.rv != 0)), "Number of txs incorrectly set\n");
if (not pusch.needs_pdcch) {
// In case of non-adaptive retx or Msg3
continue;
}
// TODO: extend this test
if (pusch.dci.tb.rv == 0) {
// newTx
CONDERROR(pusch.dci.format != SRSLTE_DCI_FORMAT0, "Incorrect UL DCI format\n");
CONDERROR(pusch.dci.tb.mcs_idx > 28, "Incorrect UL MCS index\n");
}
}
alloc_rntis.clear();
for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) {
auto& data = dl_result.data[i];
CONDERROR(data.tbs[0] == 0, "Allocated DL data has empty TBS\n");
auto& data = dl_result.data[i];
uint16_t rnti = data.dci.rnti;
CONDERROR(data.tbs[0] == 0 and data.tbs[1] == 0, "Allocated DL data has empty TBS\n");
CONDERROR(alloc_rntis.count(rnti) > 0, "The user rnti=0x%x got allocated multiple times in DL\n", rnti);
alloc_rntis.insert(data.dci.rnti);
for (uint32_t tb = 0; tb < 2; ++tb) {
if (data.tbs[tb] == 0) {
continue;
}
if (data.dci.tb[tb].rv == 0) {
// newTx
CONDERROR(data.nof_pdu_elems[tb] == 0, "Allocated DL grant does not have MAC SDUs\n");
CONDERROR(data.nof_pdu_elems[tb] > sched_interface::MAX_RLC_PDU_LIST,
"Number of SDUs in DL grant exceeds limit\n");
uint32_t alloc_bytes = 0;
for (uint32_t pdu = 0; pdu < data.nof_pdu_elems[tb]; ++pdu) {
alloc_bytes += data.pdu[tb][pdu].nbytes;
}
CONDERROR(alloc_bytes > data.tbs[tb], "The bytes allocated to individual MAC SDUs is larger than total TBS\n");
CONDERROR(data.dci.tb[tb].mcs_idx > 28, "Incorrect DL MCS index\n");
}
}
}
for (uint32_t i = 0; i < dl_result.nof_bc_elems; ++i) {
auto& bc = dl_result.bc[i];

View File

@ -23,7 +23,7 @@
#define SRSLTE_SCHED_COMMON_TEST_SUITE_H
#include "srsenb/hdr/stack/mac/scheduler_common.h"
#include "srslte/common/bounded_bitset.h"
#include "srslte/adt/bounded_bitset.h"
#include "srslte/common/tti_point.h"
#include "srslte/interfaces/sched_interface.h"
@ -87,6 +87,7 @@ int test_pdcch_collisions(const sf_output_res_t& sf_out,
/**
* verifies correctness of DCI content for params that are independent of the UE configuration.
* - TB size is large enough
* - No repeated rntis in PDSCH and PUSCH
* @param sf_out
* @return error code
*/

View File

@ -27,8 +27,6 @@
#include "sched_common_test_suite.h"
#include "srslte/common/test_common.h"
#include <set>
using namespace srsenb;
/***************************
@ -533,21 +531,15 @@ int user_state_sched_tester::test_ctrl_info(uint32_t
}
/* TEST: All DL allocs have a correct rnti */
std::set<uint16_t> alloc_rntis;
for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) {
uint16_t rnti = dl_result.data[i].dci.rnti;
CONDERROR(alloc_rntis.count(rnti) > 0, "The user rnti=0x%x got allocated multiple times in DL\n", rnti);
CONDERROR(users.count(rnti) == 0, "The user rnti=0x%x allocated in DL does not exist\n", rnti);
alloc_rntis.insert(rnti);
}
/* TEST: All UL allocs have a correct rnti */
alloc_rntis.clear();
for (uint32_t i = 0; i < ul_result.nof_dci_elems; ++i) {
uint16_t rnti = ul_result.pusch[i].dci.rnti;
CONDERROR(alloc_rntis.count(rnti) > 0, "The user rnti=0x%x got allocated multiple times in UL\n", rnti);
CONDERROR(users.count(rnti) == 0, "The user rnti=0x%x allocated in UL does not exist\n", rnti);
alloc_rntis.insert(rnti);
}
return SRSLTE_SUCCESS;