sched,nr: fix msg3 retransmissions and add it to the sched nr random test.

master
Francisco Paisana 3 years ago
parent a61d59993f
commit 24cbf1a0c1

@ -92,6 +92,7 @@ public:
alloc_result alloc_pusch(slot_ue& ue, const prb_grant& dl_mask); alloc_result alloc_pusch(slot_ue& ue, const prb_grant& dl_mask);
slot_point get_pdcch_tti() const { return pdcch_slot; } slot_point get_pdcch_tti() const { return pdcch_slot; }
slot_point get_tti_rx() const { return pdcch_slot - TX_ENB_DELAY; }
const bwp_res_grid& res_grid() const { return bwp_grid; } const bwp_res_grid& res_grid() const { return bwp_grid; }
const bwp_params& cfg; const bwp_params& cfg;

@ -19,6 +19,7 @@ namespace srsenb {
namespace sched_nr_impl { namespace sched_nr_impl {
class slot_ue; class slot_ue;
class ul_harq_proc;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

@ -45,6 +45,7 @@ public:
// UE parameters that are sector specific // UE parameters that are sector specific
const bwp_ue_cfg* cfg = nullptr; const bwp_ue_cfg* cfg = nullptr;
harq_entity* harq_ent = nullptr;
slot_point pdcch_slot; slot_point pdcch_slot;
slot_point pdsch_slot; slot_point pdsch_slot;
slot_point pusch_slot; slot_point pusch_slot;

@ -54,7 +54,6 @@ alloc_result ra_sched::allocate_pending_rar(bwp_slot_allocator& slot_grid,
void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues) void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
{ {
static const uint32_t PRACH_RAR_OFFSET = 3;
slot_point pdcch_slot = slot_grid.get_pdcch_tti(); slot_point pdcch_slot = slot_grid.get_pdcch_tti();
slot_point msg3_slot = pdcch_slot + bwp_cfg->pusch_ra_list[0].msg3_delay; slot_point msg3_slot = pdcch_slot + bwp_cfg->pusch_ra_list[0].msg3_delay;
if (not slot_grid.res_grid()[pdcch_slot].is_dl or not slot_grid.res_grid()[msg3_slot].is_ul) { if (not slot_grid.res_grid()[pdcch_slot].is_dl or not slot_grid.res_grid()[msg3_slot].is_ul) {
@ -68,8 +67,8 @@ void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
// In case of RAR outside RAR window: // In case of RAR outside RAR window:
// - if window has passed, discard RAR // - if window has passed, discard RAR
// - if window hasn't started, stop loop, as RARs are ordered by TTI // - if window hasn't started, stop loop, as RARs are ordered by TTI
slot_interval rar_window{rar.prach_slot + PRACH_RAR_OFFSET, slot_point tti_start{0, rar.prach_slot.sfn(), 0};
rar.prach_slot + PRACH_RAR_OFFSET + bwp_cfg->cfg.rar_window_size}; slot_interval rar_window{tti_start, tti_start + 2 * tti_start.nof_slots_per_frame()}; // TODO: use rar_window_size
if (not rar_window.contains(pdcch_slot)) { if (not rar_window.contains(pdcch_slot)) {
if (pdcch_slot >= rar_window.stop()) { if (pdcch_slot >= rar_window.stop()) {
fmt::memory_buffer str_buffer; fmt::memory_buffer str_buffer;

@ -133,6 +133,7 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint32_t
for (const auto& grant : rar.msg3_grant) { for (const auto& grant : rar.msg3_grant) {
slot_ue& ue = ues[grant.temp_crnti]; slot_ue& ue = ues[grant.temp_crnti];
prb_interval msg3_interv{last_msg3, last_msg3 + msg3_nof_prbs}; prb_interval msg3_interv{last_msg3, last_msg3 + msg3_nof_prbs};
ue.h_ul = ue.harq_ent->find_empty_ul_harq();
bool success = ue.h_ul->new_tx(msg3_slot, msg3_slot, msg3_interv, mcs, 100, max_harq_msg3_retx); bool success = ue.h_ul->new_tx(msg3_slot, msg3_slot, msg3_interv, mcs, 100, max_harq_msg3_retx);
srsran_assert(success, "Failed to allocate Msg3"); srsran_assert(success, "Failed to allocate Msg3");
last_msg3 += msg3_nof_prbs; last_msg3 += msg3_nof_prbs;
@ -144,9 +145,7 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint32_t
success = ue.cfg->phy().get_pusch_cfg(slot_cfg, msg3_pdcch.dci, pusch.sch); success = ue.cfg->phy().get_pusch_cfg(slot_cfg, msg3_pdcch.dci, pusch.sch);
srsran_assert(success, "Error converting DCI to PUSCH grant"); srsran_assert(success, "Error converting DCI to PUSCH grant");
pusch.sch.grant.tb[0].softbuffer.rx = ue.h_ul->get_softbuffer().get(); pusch.sch.grant.tb[0].softbuffer.rx = ue.h_ul->get_softbuffer().get();
if (ue.h_ul->nof_retx() > 0) { ue.h_ul->set_tbs(pusch.sch.grant.tb[0].tbs);
bwp_pdcch_slot.ul_pdcchs.push_back(msg3_pdcch);
}
} }
bwp_msg3_slot.ul_prbs.add(msg3_rbs); bwp_msg3_slot.ul_prbs.add(msg3_rbs);

@ -38,7 +38,7 @@ void sched_nr_time_rr::sched_dl_users(slot_ue_map_t& ue_db, bwp_slot_allocator&
{ {
// Start with retxs // Start with retxs
if (round_robin_apply(ue_db, slot_alloc.get_pdcch_tti().to_uint(), [&slot_alloc](slot_ue& ue) { if (round_robin_apply(ue_db, slot_alloc.get_pdcch_tti().to_uint(), [&slot_alloc](slot_ue& ue) {
if (ue.h_dl != nullptr and not ue.h_dl->empty()) { if (ue.h_dl != nullptr and ue.h_dl->has_pending_retx(slot_alloc.get_tti_rx())) {
alloc_result res = slot_alloc.alloc_pdsch(ue, ue.h_dl->prbs()); alloc_result res = slot_alloc.alloc_pdsch(ue, ue.h_dl->prbs());
if (res == alloc_result::success) { if (res == alloc_result::success) {
return true; return true;
@ -65,7 +65,7 @@ void sched_nr_time_rr::sched_ul_users(slot_ue_map_t& ue_db, bwp_slot_allocator&
{ {
// Start with retxs // Start with retxs
if (round_robin_apply(ue_db, slot_alloc.get_pdcch_tti().to_uint(), [&slot_alloc](slot_ue& ue) { if (round_robin_apply(ue_db, slot_alloc.get_pdcch_tti().to_uint(), [&slot_alloc](slot_ue& ue) {
if (ue.h_ul != nullptr and not ue.h_ul->empty()) { if (ue.h_ul != nullptr and ue.h_ul->has_pending_retx(slot_alloc.get_tti_rx())) {
alloc_result res = slot_alloc.alloc_pusch(ue, ue.h_ul->prbs()); alloc_result res = slot_alloc.alloc_pusch(ue, ue.h_ul->prbs());
if (res == alloc_result::success) { if (res == alloc_result::success) {
return true; return true;

@ -43,6 +43,7 @@ slot_ue ue_carrier::try_reserve(slot_point pdcch_slot)
// copy cc-specific parameters and find available HARQs // copy cc-specific parameters and find available HARQs
slot_ue sfu(rnti, slot_rx, cc); slot_ue sfu(rnti, slot_rx, cc);
sfu.cfg = &bwp_cfg; sfu.cfg = &bwp_cfg;
sfu.harq_ent = &harq_ent;
sfu.pdcch_slot = pdcch_slot; sfu.pdcch_slot = pdcch_slot;
const uint32_t k0 = 0; const uint32_t k0 = 0;
sfu.pdsch_slot = sfu.pdcch_slot + k0; sfu.pdsch_slot = sfu.pdcch_slot + k0;

@ -112,12 +112,23 @@ sched_nr_sim_base::~sched_nr_sim_base()
logger.info("=========== End %s ==========\n", test_name.c_str()); logger.info("=========== End %s ==========\n", test_name.c_str());
} }
int sched_nr_sim_base::add_user(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg_, uint32_t preamble_idx) int sched_nr_sim_base::add_user(uint16_t rnti,
const sched_nr_interface::ue_cfg_t& ue_cfg_,
slot_point tti_rx,
uint32_t preamble_idx)
{ {
TESTASSERT(ue_db.count(rnti) == 0); TESTASSERT(ue_db.count(rnti) == 0);
sched_ptr->ue_cfg(rnti, ue_cfg_); sched_ptr->ue_cfg(rnti, ue_cfg_);
ue_db.insert(std::make_pair(rnti, sched_nr_ue_sim(rnti, ue_cfg_, current_slot_tx, preamble_idx))); ue_db.insert(std::make_pair(rnti, sched_nr_ue_sim(rnti, ue_cfg_, current_slot_tx, preamble_idx)));
sched_nr_interface::dl_sched_rar_info_t rach_info{};
rach_info.temp_crnti = rnti;
rach_info.prach_slot = tti_rx;
rach_info.preamble_idx = preamble_idx;
rach_info.msg3_size = 7;
sched_ptr->dl_rach_info(ue_cfg_.carriers[0].cc, rach_info);
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -106,7 +106,7 @@ public:
std::string test_name); std::string test_name);
virtual ~sched_nr_sim_base(); virtual ~sched_nr_sim_base();
int add_user(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg_, uint32_t preamble_idx); int add_user(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg_, slot_point tti_rx, uint32_t preamble_idx);
void new_slot(slot_point slot_tx); void new_slot(slot_point slot_tx);
void update(sched_nr_cc_output_res_t& cc_out); void update(sched_nr_cc_output_res_t& cc_out);

@ -88,7 +88,7 @@ void sched_nr_cfg_serialized_test()
sched_nr_interface::ue_cfg_t uecfg = get_default_ue_cfg(nof_sectors); sched_nr_interface::ue_cfg_t uecfg = get_default_ue_cfg(nof_sectors);
uecfg.fixed_dl_mcs = 15; uecfg.fixed_dl_mcs = 15;
uecfg.fixed_ul_mcs = 15; uecfg.fixed_ul_mcs = 15;
sched_tester.add_user(0x46, uecfg, 0); sched_tester.add_user(0x46, uecfg, slot_point{0, 0}, 0);
std::vector<long> count_per_cc(nof_sectors, 0); std::vector<long> count_per_cc(nof_sectors, 0);
for (uint32_t nof_slots = 0; nof_slots < max_nof_ttis; ++nof_slots) { for (uint32_t nof_slots = 0; nof_slots < max_nof_ttis; ++nof_slots) {
@ -136,7 +136,7 @@ void sched_nr_cfg_parallel_cc_test()
sched_nr_interface::ue_cfg_t uecfg = get_default_ue_cfg(cells_cfg.size()); sched_nr_interface::ue_cfg_t uecfg = get_default_ue_cfg(cells_cfg.size());
uecfg.fixed_dl_mcs = 15; uecfg.fixed_dl_mcs = 15;
uecfg.fixed_ul_mcs = 15; uecfg.fixed_ul_mcs = 15;
sched_tester.add_user(0x46, uecfg, 0); sched_tester.add_user(0x46, uecfg, slot_point{0, 0}, 0);
std::array<std::atomic<long>, SRSRAN_MAX_CARRIERS> nano_count{}; std::array<std::atomic<long>, SRSRAN_MAX_CARRIERS> nano_count{};
for (uint32_t nof_slots = 0; nof_slots < max_nof_ttis; ++nof_slots) { for (uint32_t nof_slots = 0; nof_slots < max_nof_ttis; ++nof_slots) {

Loading…
Cancel
Save