nr,gnb,sched: fix sib1 window derivation in NR sched

master
Francisco 3 years ago committed by Francisco Paisana
parent 60d4d12070
commit 72c2129cd3

@ -63,7 +63,7 @@ private:
srslog::basic_logger& logger; srslog::basic_logger& logger;
struct si_msg_ctxt_t { struct si_msg_ctxt_t {
uint32_t n = 0; /// index in schedulingInfoList in si-SchedulingInfo in SIB1 uint32_t n = 0; /// 0 for SIB1, n/index in schedulingInfoList in si-SchedulingInfo in SIB1
uint32_t len = 0; uint32_t len = 0;
uint32_t win_len = 0; uint32_t win_len = 0;
uint32_t period = 0; uint32_t period = 0;
@ -71,7 +71,7 @@ private:
alloc_result result = alloc_result::invalid_coderate; /// last attempt to schedule SI alloc_result result = alloc_result::invalid_coderate; /// last attempt to schedule SI
slot_point win_start; /// start of SI window, invalid if outside slot_point win_start; /// start of SI window, invalid if outside
}; };
srsran::bounded_vector<si_msg_ctxt_t, 10> pending_sis; srsran::bounded_vector<si_msg_ctxt_t, 10> pending_sis; /// configured SIB1 and SI messages
}; };
} // namespace sched_nr_impl } // namespace sched_nr_impl

@ -123,7 +123,14 @@ bool fill_dci_sib(prb_interval interv, uint32_t sib_id, const bwp_params_t& bwp_
si_sched::si_sched(const bwp_params_t& bwp_cfg_) : si_sched::si_sched(const bwp_params_t& bwp_cfg_) :
bwp_cfg(&bwp_cfg_), logger(srslog::fetch_basic_logger(bwp_cfg_.sched_cfg.logger_name)) bwp_cfg(&bwp_cfg_), logger(srslog::fetch_basic_logger(bwp_cfg_.sched_cfg.logger_name))
{} {
// TODO: Get SIB1 other SI msgs config from RRC
pending_sis.emplace_back();
pending_sis[0].n = 0;
pending_sis[0].len = 77;
pending_sis[0].period = 160;
pending_sis[0].win_len = 1;
}
void si_sched::run_slot(bwp_slot_allocator& bwp_alloc) void si_sched::run_slot(bwp_slot_allocator& bwp_alloc)
{ {
@ -136,37 +143,40 @@ void si_sched::run_slot(bwp_slot_allocator& bwp_alloc)
slot_point sl_pdcch = bwp_alloc.get_pdcch_tti(); slot_point sl_pdcch = bwp_alloc.get_pdcch_tti();
const prb_bitmap& prbs = bwp_alloc.res_grid()[sl_pdcch].dl_prbs.prbs(); const prb_bitmap& prbs = bwp_alloc.res_grid()[sl_pdcch].dl_prbs.prbs();
// SIB1 case
if (sl_pdcch.to_uint() % 160 == 0) {
// TODO: compute if SIB1 slot based on config
const uint32_t aggr_lvl_idx = 2;
const uint32_t sib_id = 1;
const uint32_t sib1len = 77; // TODO: extract from config
alloc_result ret = bwp_alloc.alloc_si(aggr_lvl_idx, sib_id, sib1len, prb_interval{0, 7});
if (ret != alloc_result::success) {
bwp_alloc.logger.warning("SCHED: Cannot allocate SIB1.");
}
}
// Update SI windows // Update SI windows
uint32_t N = bwp_cfg->slots.size(); uint32_t N = bwp_cfg->slots.size();
for (si_msg_ctxt_t& si : pending_sis) { for (si_msg_ctxt_t& si : pending_sis) {
uint32_t x = (si.n - 1) * si.win_len; uint32_t x = (si.n - 1) * si.win_len;
if (not si.win_start.valid() and (sl_pdcch.sfn() % si.period == x / N) and if (not si.win_start.valid()) {
sl_pdcch.slot_idx() == x % bwp_cfg->slots.size()) { bool start_window;
if (si.n == 0) {
// SIB1
start_window = sl_pdcch.to_uint() % si.period == 0;
} else {
// SI messages
start_window = (sl_pdcch.sfn() % si.period == x / N) and sl_pdcch.slot_idx() == x % bwp_cfg->slots.size();
}
if (start_window) {
// If start of SI message window // If start of SI message window
si.win_start = sl_pdcch; si.win_start = sl_pdcch;
} else if (si.win_start.valid() and si.win_start + si.win_len >= sl_pdcch) { }
} else if (si.win_start + si.win_len >= sl_pdcch) {
// If end of SI message window // If end of SI message window
if (si.n == 0) {
logger.error("SCHED: Could not allocate SIB1, len=%d. Cause: %s", si.n, si.len, to_string(si.result));
} else {
logger.warning( logger.warning(
"SCHED: Could not allocate SI message idx=%d, len=%d. Cause: %s", si.n, si.len, to_string(si.result)); "SCHED: Could not allocate SI message idx=%d, len=%d. Cause: %s", si.n, si.len, to_string(si.result));
}
si.win_start.clear(); si.win_start.clear();
} }
} }
// Schedule pending SIs // Schedule pending SIBs
if (bwp_cfg->slots[sl_pdcch.slot_idx()].is_dl) { if (not bwp_cfg->slots[sl_pdcch.slot_idx()].is_dl) {
return;
}
for (si_msg_ctxt_t& si : pending_sis) { for (si_msg_ctxt_t& si : pending_sis) {
if (not si.win_start.valid()) { if (not si.win_start.valid()) {
continue; continue;
@ -190,6 +200,10 @@ void si_sched::run_slot(bwp_slot_allocator& bwp_alloc)
// SIB scheduled successfully // SIB scheduled successfully
si.win_start.clear(); si.win_start.clear();
si.n_tx++; si.n_tx++;
if (si.n == 0) {
logger.debug("SCHED: Allocated SIB1, len=%d.", si.n, si.len);
} else {
logger.debug("SCHED: Allocated SI message idx=%d, len=%d.", si.n, si.len);
} }
} }
} }

Loading…
Cancel
Save