mirror of https://github.com/PentHertz/srsLTE.git
sched,nr: fix handling of DL BSR in NR scheduler and computation of UCI
This commit is contained in:
parent
7b079fe289
commit
bdf18856d1
|
@ -257,8 +257,7 @@ public:
|
|||
|
||||
// Combined interface for PHY to access stack (MAC and RRC)
|
||||
class stack_interface_phy_lte : public mac_interface_phy_lte
|
||||
{
|
||||
};
|
||||
{};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
|
|
|
@ -1269,7 +1269,7 @@ static uint32_t dci_nr_format_1_0_to_str(const srsran_dci_dl_nr_t* dci, char* st
|
|||
|
||||
// HARQ process number – 4 bits
|
||||
if (rnti_type == srsran_rnti_type_c || rnti_type == srsran_rnti_type_tc) {
|
||||
len = srsran_print_check(str, str_len, len, "harq_id=%d ", dci->harq_feedback);
|
||||
len = srsran_print_check(str, str_len, len, "harq_id=%d ", dci->pid);
|
||||
}
|
||||
|
||||
// System information indicator – 1 bit
|
||||
|
|
|
@ -61,7 +61,6 @@ public:
|
|||
int rlc_buffer_state(uint16_t rnti, uint32_t lcid, uint32_t tx_queue, uint32_t retx_queue) override;
|
||||
|
||||
// Interface for PHY
|
||||
void process_pdus();
|
||||
int slot_indication(const srsran_slot_cfg_t& slot_cfg) override;
|
||||
int get_dl_sched(const srsran_slot_cfg_t& slot_cfg, dl_sched_t& dl_sched) override;
|
||||
int get_ul_sched(const srsran_slot_cfg_t& slot_cfg, ul_sched_t& ul_sched) override;
|
||||
|
|
|
@ -267,6 +267,12 @@ bool mac_nr::is_rnti_active_unsafe(uint16_t rnti)
|
|||
return ue_db[rnti]->is_active();
|
||||
}
|
||||
|
||||
int mac_nr::rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue)
|
||||
{
|
||||
sched.dl_buffer_state(rnti, lc_id, tx_queue, retx_queue);
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
int mac_nr::slot_indication(const srsran_slot_cfg_t& slot_cfg)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -86,6 +86,10 @@ ue::ue(uint16_t rnti_, const ue_cfg_t& cfg, const sched_params& sched_cfg_) :
|
|||
rnti(rnti_), sched_cfg(sched_cfg_), buffers(srslog::fetch_basic_logger(sched_cfg_.sched_cfg.logger_name))
|
||||
{
|
||||
set_cfg(cfg);
|
||||
|
||||
mac_lc_ch_cfg_t lch{};
|
||||
lch.direction = mac_lc_ch_cfg_t::BOTH;
|
||||
buffers.config_lcid(0, lch);
|
||||
}
|
||||
|
||||
void ue::set_cfg(const ue_cfg_t& cfg)
|
||||
|
|
|
@ -152,49 +152,50 @@ void slot_cc_worker::postprocess_decisions()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ue.h_ul != nullptr and ue.h_ul->harq_slot_tx() == ue.pusch_slot) {
|
||||
// PUSCH was allocated. Insert UCI in PUSCH
|
||||
for (auto& pusch : bwp_slot.puschs) {
|
||||
if (pusch.sch.grant.rnti == ue.rnti) {
|
||||
// Put UCI configuration in PUSCH config
|
||||
if (not ue.cfg->phy().get_pusch_uci_cfg(slot_cfg, uci_cfg, pusch.sch)) {
|
||||
logger.error("Error setting UCI configuration in PUSCH");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If any UCI information is triggered, schedule PUCCH
|
||||
if (uci_cfg.ack.count > 0 || uci_cfg.nof_csi > 0 || uci_cfg.o_sr > 0) {
|
||||
bwp_slot.pucch.emplace_back();
|
||||
mac_interface_phy_nr::pucch_t& pucch = bwp_slot.pucch.back();
|
||||
if (uci_cfg.ack.count == 0 and uci_cfg.nof_csi == 0 and uci_cfg.o_sr == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uci_cfg.pucch.rnti = ue.rnti;
|
||||
bool has_pusch = false;
|
||||
for (auto& pusch : bwp_slot.puschs) {
|
||||
if (pusch.sch.grant.rnti == ue.rnti) {
|
||||
// Put UCI configuration in PUSCH config
|
||||
has_pusch = true;
|
||||
if (not ue.cfg->phy().get_pusch_uci_cfg(slot_cfg, uci_cfg, pusch.sch)) {
|
||||
logger.error("Error setting UCI configuration in PUSCH");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (not has_pusch) {
|
||||
// If any UCI information is triggered, schedule PUCCH
|
||||
bwp_slot.pucch.emplace_back();
|
||||
mac_interface_phy_nr::pucch_t& pucch = bwp_slot.pucch.back();
|
||||
|
||||
uci_cfg.pucch.rnti = ue.rnti;
|
||||
pucch.candidates.emplace_back();
|
||||
pucch.candidates.back().uci_cfg = uci_cfg;
|
||||
if (not ue.cfg->phy().get_pucch_uci_cfg(slot_cfg, uci_cfg, pucch.pucch_cfg, pucch.candidates.back().resource)) {
|
||||
logger.error("Error getting UCI CFG");
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this slot has a SR opportunity and the selected PUCCH format is 1, consider positive SR.
|
||||
if (uci_cfg.o_sr > 0 and uci_cfg.ack.count > 0 and
|
||||
pucch.candidates.back().resource.format == SRSRAN_PUCCH_NR_FORMAT_1) {
|
||||
// Set SR negative
|
||||
if (uci_cfg.o_sr > 0) {
|
||||
uci_cfg.sr_positive_present = false;
|
||||
}
|
||||
|
||||
// Append new resource
|
||||
pucch.candidates.emplace_back();
|
||||
pucch.candidates.back().uci_cfg = uci_cfg;
|
||||
if (not ue.cfg->phy().get_pucch_uci_cfg(slot_cfg, uci_cfg, pucch.pucch_cfg, pucch.candidates.back().resource)) {
|
||||
logger.error("Error getting UCI CFG");
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this slot has a SR opportunity and the selected PUCCH format is 1, consider positive SR.
|
||||
if (uci_cfg.o_sr > 0 and uci_cfg.ack.count > 0 and
|
||||
pucch.candidates.back().resource.format == SRSRAN_PUCCH_NR_FORMAT_1) {
|
||||
// Set SR negative
|
||||
if (uci_cfg.o_sr > 0) {
|
||||
uci_cfg.sr_positive_present = false;
|
||||
}
|
||||
|
||||
// Append new resource
|
||||
pucch.candidates.emplace_back();
|
||||
pucch.candidates.back().uci_cfg = uci_cfg;
|
||||
if (not ue.cfg->phy().get_pucch_uci_cfg(
|
||||
slot_cfg, uci_cfg, pucch.pucch_cfg, pucch.candidates.back().resource)) {
|
||||
logger.error("Error getting UCI CFG");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
std::unique_ptr<srsenb::mac_nr> mac;
|
||||
srsran::slot_point pdsch_slot, pusch_slot;
|
||||
srslog::basic_logger& sched_logger;
|
||||
bool autofill_pdsch_bsr = false;
|
||||
|
||||
std::mutex metrics_mutex;
|
||||
metrics_t metrics = {};
|
||||
|
@ -337,6 +338,8 @@ public:
|
|||
sched_logger.set_level(srslog::str_to_basic_level(args.log_level));
|
||||
srslog::fetch_basic_logger("MAC-NR").set_level(srslog::str_to_basic_level(args.log_level));
|
||||
|
||||
autofill_pdsch_bsr = args.pdsch.slots != "" and args.pdsch.slots != "none";
|
||||
|
||||
// create sched object
|
||||
mac.reset(new srsenb::mac_nr{&task_sched});
|
||||
srsenb::mac_nr_args_t mac_args{};
|
||||
|
@ -444,6 +447,10 @@ public:
|
|||
}
|
||||
|
||||
if (not use_dummy_sched) {
|
||||
if (autofill_pdsch_bsr) {
|
||||
mac->rlc_buffer_state(rnti, 0, 10000, 0);
|
||||
}
|
||||
|
||||
int ret = mac->get_dl_sched(slot_cfg, dl_sched);
|
||||
|
||||
for (pdsch_t& pdsch : dl_sched.pdsch) {
|
||||
|
|
Loading…
Reference in New Issue