nr,gnb,sched: fix logging of tbs. check if sched args are supported at sched startup. change the tti logging to be equal to tti_rx

This commit is contained in:
Francisco 2021-10-18 13:26:14 +01:00 committed by Francisco Paisana
parent 3bf09021f9
commit d5acf73c46
6 changed files with 35 additions and 39 deletions

View File

@ -48,17 +48,13 @@ public:
void new_slot(slot_point slot_rx); void new_slot(slot_point slot_rx);
void reset(); void reset();
bool new_tx(slot_point slot_tx, bool new_tx(slot_point slot_tx, slot_point slot_ack, const prb_grant& grant, uint32_t mcs, uint32_t max_retx);
slot_point slot_ack,
const prb_grant& grant,
uint32_t mcs,
uint32_t tbs,
uint32_t max_retx);
bool new_retx(slot_point slot_tx, slot_point slot_ack, const prb_grant& grant); bool new_retx(slot_point slot_tx, slot_point slot_ack, const prb_grant& grant);
bool new_retx(slot_point slot_tx, slot_point slot_ack); bool new_retx(slot_point slot_tx, slot_point slot_ack);
// NOTE: Has to be used before first tx is dispatched // NOTE: Has to be used before first tx is dispatched
bool set_tbs(uint32_t tbs, int mcs = -1); bool set_tbs(uint32_t tbs);
bool set_mcs(uint32_t mcs);
const uint32_t pid; const uint32_t pid;
@ -87,12 +83,7 @@ public:
tx_harq_softbuffer& get_softbuffer() { return *softbuffer; } tx_harq_softbuffer& get_softbuffer() { return *softbuffer; }
srsran::unique_byte_buffer_t* get_tx_pdu() { return &pdu; } srsran::unique_byte_buffer_t* get_tx_pdu() { return &pdu; }
bool new_tx(slot_point slot_tx, bool new_tx(slot_point slot_tx, slot_point slot_ack, const prb_grant& grant, uint32_t mcs, uint32_t max_retx);
slot_point slot_ack,
const prb_grant& grant,
uint32_t mcs,
uint32_t tbs,
uint32_t max_retx);
private: private:
srsran::unique_pool_ptr<tx_harq_softbuffer> softbuffer; srsran::unique_pool_ptr<tx_harq_softbuffer> softbuffer;
@ -110,7 +101,7 @@ public:
bool set_tbs(uint32_t tbs) bool set_tbs(uint32_t tbs)
{ {
softbuffer->reset(tbs * 8u); softbuffer->reset(tbs);
return harq_proc::set_tbs(tbs); return harq_proc::set_tbs(tbs);
} }

View File

@ -291,7 +291,7 @@ int mac_nr::slot_indication(const srsran_slot_cfg_t& slot_cfg)
int mac_nr::get_dl_sched(const srsran_slot_cfg_t& slot_cfg, dl_sched_t& dl_sched) int mac_nr::get_dl_sched(const srsran_slot_cfg_t& slot_cfg, dl_sched_t& dl_sched)
{ {
logger.set_context(slot_cfg.idx); logger.set_context(slot_cfg.idx - TX_ENB_DELAY);
slot_point pdsch_slot = srsran::slot_point{NUMEROLOGY_IDX, slot_cfg.idx}; slot_point pdsch_slot = srsran::slot_point{NUMEROLOGY_IDX, slot_cfg.idx};
sched_nr_interface::dl_sched_res_t dl_res; sched_nr_interface::dl_sched_res_t dl_res;

View File

@ -101,7 +101,11 @@ cell_params_t::cell_params_t(uint32_t cc_, const cell_cfg_t& cell, const sched_a
srsran_assert(not bwps.empty(), "No BWPs were configured"); srsran_assert(not bwps.empty(), "No BWPs were configured");
} }
sched_params::sched_params(const sched_args_t& sched_cfg_) : sched_cfg(sched_cfg_) {} sched_params::sched_params(const sched_args_t& sched_cfg_) : sched_cfg(sched_cfg_)
{
srsran_assert(sched_cfg.fixed_dl_mcs >= 0, "Dynamic DL MCS not supported");
srsran_assert(sched_cfg.fixed_ul_mcs >= 0, "Dynamic DL MCS not supported");
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -172,7 +172,7 @@ alloc_result bwp_slot_allocator::alloc_rar_and_msg3(uint16_t
prb_interval msg3_interv{last_msg3, last_msg3 + msg3_nof_prbs}; prb_interval msg3_interv{last_msg3, last_msg3 + msg3_nof_prbs};
last_msg3 += msg3_nof_prbs; last_msg3 += msg3_nof_prbs;
ue.h_ul = ue.harq_ent->find_empty_ul_harq(); ue.h_ul = ue.harq_ent->find_empty_ul_harq();
success = ue.h_ul->new_tx(msg3_slot, msg3_slot, msg3_interv, mcs, 100, max_harq_msg3_retx); success = ue.h_ul->new_tx(msg3_slot, msg3_slot, msg3_interv, mcs, max_harq_msg3_retx);
srsran_assert(success, "Failed to allocate Msg3"); srsran_assert(success, "Failed to allocate Msg3");
fill_dci_msg3(ue, *bwp_grid.cfg, rar_grant.msg3_dci); fill_dci_msg3(ue, *bwp_grid.cfg, rar_grant.msg3_dci);
@ -240,22 +240,20 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, const prb_grant& dl_gr
} }
// Allocate HARQ // Allocate HARQ
int mcs = ue.cfg->fixed_pdsch_mcs();
if (ue.h_dl->empty()) { if (ue.h_dl->empty()) {
int mcs = ue.cfg->fixed_pdsch_mcs(); bool ret = ue.h_dl->new_tx(ue.pdsch_slot, ue.uci_slot, dl_grant, mcs, 4);
srsran_assert(mcs >= 0, "Dynamic MCS not yet supported");
int tbs = 100;
bool ret = ue.h_dl->new_tx(ue.pdsch_slot, ue.uci_slot, dl_grant, mcs, tbs, 4);
srsran_assert(ret, "Failed to allocate DL HARQ"); srsran_assert(ret, "Failed to allocate DL HARQ");
} else { } else {
bool ret = ue.h_dl->new_retx(ue.pdsch_slot, ue.uci_slot, dl_grant); bool ret = ue.h_dl->new_retx(ue.pdsch_slot, ue.uci_slot, dl_grant);
mcs = ue.h_dl->mcs();
srsran_assert(ret, "Failed to allocate DL HARQ retx"); srsran_assert(ret, "Failed to allocate DL HARQ retx");
} }
// Allocation Successful // Allocation Successful
int mcs = ue.h_dl->mcs();
const static float max_R = 0.93; const static float max_R = 0.93;
do { while (true) {
// Generate PDCCH // Generate PDCCH
pdcch_dl_t& pdcch = bwp_pdcch_slot.dl_pdcchs.back(); pdcch_dl_t& pdcch = bwp_pdcch_slot.dl_pdcchs.back();
fill_dl_dci_ue_fields(ue, *bwp_grid.cfg, ss_id, pdcch.dci.ctx.location, pdcch.dci); fill_dl_dci_ue_fields(ue, *bwp_grid.cfg, ss_id, pdcch.dci.ctx.location, pdcch.dci);
@ -288,15 +286,15 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, const prb_grant& dl_gr
} else { } else {
srsran_assert(pdsch.sch.grant.tb[0].tbs == (int)ue.h_dl->tbs(), "The TBS did not remain constant in retx"); srsran_assert(pdsch.sch.grant.tb[0].tbs == (int)ue.h_dl->tbs(), "The TBS did not remain constant in retx");
} }
if (bwp_pdsch_slot.pdschs.back().sch.grant.tb[0].R_prime < max_R or mcs == 0) { if (ue.h_dl->nof_retx() > 0 or bwp_pdsch_slot.pdschs.back().sch.grant.tb[0].R_prime < max_R or mcs <= 0) {
break; break;
} }
// Decrease MCS if rate is too high // Decrease MCS if first tx and rate is too high
mcs--; mcs--;
ue.h_dl->set_tbs(100, mcs); ue.h_dl->set_mcs(mcs);
bwp_pdsch_slot.pdschs.pop_back(); bwp_pdsch_slot.pdschs.pop_back();
bwp_uci_slot.pending_acks.pop_back(); bwp_uci_slot.pending_acks.pop_back();
} while (true); }
if (mcs == 0) { if (mcs == 0) {
logger.warning("Couldn't find mcs that leads to R<0.9"); logger.warning("Couldn't find mcs that leads to R<0.9");
} }
@ -338,10 +336,9 @@ alloc_result bwp_slot_allocator::alloc_pusch(slot_ue& ue, const prb_grant& ul_pr
} }
if (ue.h_ul->empty()) { if (ue.h_ul->empty()) {
int mcs = ue.cfg->fixed_pusch_mcs(); int mcs = ue.cfg->fixed_pusch_mcs();
srsran_assert(mcs >= 0, "Dynamic MCS not yet supported");
int tbs = 100; int tbs = 100;
bool success = ue.h_ul->new_tx(ue.pusch_slot, ue.pusch_slot, ul_prbs, mcs, tbs, ue.cfg->ue_cfg()->maxharq_tx); bool success = ue.h_ul->new_tx(ue.pusch_slot, ue.pusch_slot, ul_prbs, mcs, ue.cfg->ue_cfg()->maxharq_tx);
srsran_assert(success, "Failed to allocate UL HARQ"); srsran_assert(success, "Failed to allocate UL HARQ");
} else { } else {
bool success = ue.h_ul->new_retx(ue.pusch_slot, ue.pusch_slot, ul_prbs); bool success = ue.h_ul->new_retx(ue.pusch_slot, ue.pusch_slot, ul_prbs);

View File

@ -48,7 +48,6 @@ bool harq_proc::new_tx(slot_point slot_tx_,
slot_point slot_ack_, slot_point slot_ack_,
const prb_grant& grant, const prb_grant& grant,
uint32_t mcs, uint32_t mcs,
uint32_t tbs,
uint32_t max_retx_) uint32_t max_retx_)
{ {
if (not empty()) { if (not empty()) {
@ -61,20 +60,26 @@ bool harq_proc::new_tx(slot_point slot_tx_,
prbs_ = grant; prbs_ = grant;
tb[0].ndi = !tb[0].ndi; tb[0].ndi = !tb[0].ndi;
tb[0].mcs = mcs; tb[0].mcs = mcs;
tb[0].tbs = tbs; tb[0].tbs = 0;
tb[0].active = true; tb[0].active = true;
return true; return true;
} }
bool harq_proc::set_tbs(uint32_t tbs, int mcs) bool harq_proc::set_tbs(uint32_t tbs)
{ {
if (empty() or nof_retx() > 0) { if (empty() or nof_retx() > 0) {
return false; return false;
} }
tb[0].tbs = tbs; tb[0].tbs = tbs;
if (mcs >= 0) { return true;
tb[0].mcs = mcs; }
bool harq_proc::set_mcs(uint32_t mcs)
{
if (empty() or nof_retx() > 0) {
return false;
} }
tb[0].mcs = mcs;
return true; return true;
} }
@ -112,10 +117,9 @@ bool dl_harq_proc::new_tx(slot_point slot_tx,
slot_point slot_ack, slot_point slot_ack,
const prb_grant& grant, const prb_grant& grant,
uint32_t mcs, uint32_t mcs,
uint32_t tbs,
uint32_t max_retx) uint32_t max_retx)
{ {
if (harq_proc::new_tx(slot_tx, slot_ack, grant, mcs, tbs, max_retx)) { if (harq_proc::new_tx(slot_tx, slot_ack, grant, mcs, max_retx)) {
softbuffer->reset(); softbuffer->reset();
pdu->clear(); pdu->clear();
return true; return true;

View File

@ -156,7 +156,7 @@ void log_sched_bwp_result(srslog::basic_logger& logger,
ue.h_dl->prbs(), ue.h_dl->prbs(),
ue.h_dl->nof_retx(), ue.h_dl->nof_retx(),
pdcch.dci.dai, pdcch.dci.dai,
ue.h_dl->tbs(), ue.h_dl->tbs() / 8u,
ue.dl_pending_bytes, ue.dl_pending_bytes,
ue.pdsch_slot, ue.pdsch_slot,
ue.uci_slot); ue.uci_slot);
@ -193,7 +193,7 @@ void log_sched_bwp_result(srslog::basic_logger& logger,
pdcch.dci.ctx.coreset_id, pdcch.dci.ctx.coreset_id,
srsran_dci_format_nr_string(pdcch.dci.ctx.format), srsran_dci_format_nr_string(pdcch.dci.ctx.format),
ue.h_ul->nof_retx(), ue.h_ul->nof_retx(),
ue.h_ul->tbs(), ue.h_ul->tbs() / 8u,
ue.ul_pending_bytes, ue.ul_pending_bytes,
ue.pusch_slot); ue.pusch_slot);
} else if (pdcch.dci.ctx.rnti_type == srsran_rnti_type_tc) { } else if (pdcch.dci.ctx.rnti_type == srsran_rnti_type_tc) {