From b589c0d184a8fdb548a1732699f225d256c0450a Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Wed, 21 Jul 2021 12:36:04 +0100 Subject: [PATCH] sched,nr: ack/crc info included in nr_phy_test --- srsenb/hdr/stack/gnb_stack_nr.h | 10 +++---- srsenb/hdr/stack/mac/nr/sched_nr.h | 1 + srsenb/hdr/stack/mac/nr/sched_nr_harq.h | 1 + srsenb/hdr/stack/mac/nr/sched_nr_interface.h | 1 + srsenb/src/stack/mac/nr/sched_nr.cc | 5 ++++ test/phy/dummy_gnb_stack.h | 29 ++++++++++++++++++-- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/srsenb/hdr/stack/gnb_stack_nr.h b/srsenb/hdr/stack/gnb_stack_nr.h index c0dc96a69..8394ef374 100644 --- a/srsenb/hdr/stack/gnb_stack_nr.h +++ b/srsenb/hdr/stack/gnb_stack_nr.h @@ -72,11 +72,11 @@ public: void toggle_padding() override { srsran::console("padding not available for NR\n"); } - 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; - int pucch_info(const srsran_slot_cfg_t& slot_cfg, const pucch_info_t& pucch_info) override; - int pusch_info(const srsran_slot_cfg_t& slot_cfg, const pusch_info_t& pusch_info) override; + 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; + int pucch_info(const srsran_slot_cfg_t& slot_cfg, const pucch_info_t& pucch_info) override; + int pusch_info(const srsran_slot_cfg_t& slot_cfg, const pusch_info_t& pusch_info) override; void rach_detected(const rach_info_t& rach_info) override; private: diff --git a/srsenb/hdr/stack/mac/nr/sched_nr.h b/srsenb/hdr/stack/mac/nr/sched_nr.h index cccd50e5c..9e82c82eb 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr.h @@ -42,6 +42,7 @@ public: void ue_cfg(uint16_t rnti, const ue_cfg_t& cfg) override; void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) override; + void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) override; void ul_sr_info(tti_point tti_rx, uint16_t rnti) override; int get_dl_sched(tti_point pdsch_tti, uint32_t cc, dl_sched_t& result) override; diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_harq.h b/srsenb/hdr/stack/mac/nr/sched_nr_harq.h index 15dee8aaf..326a50f5a 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_harq.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_harq.h @@ -116,6 +116,7 @@ public: void new_tti(tti_point tti_rx_); void dl_ack_info(uint32_t pid, uint32_t tb_idx, bool ack) { dl_harqs[pid].ack_info(tb_idx, ack); } + void ul_crc_info(uint32_t pid, bool ack) { ul_harqs[pid].ack_info(0, ack); } dl_harq_proc* find_pending_dl_retx() { diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_interface.h b/srsenb/hdr/stack/mac/nr/sched_nr_interface.h index 2c99fa06d..ad3b9efcf 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_interface.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_interface.h @@ -100,6 +100,7 @@ public: virtual int get_ul_sched(tti_point tti_rx, uint32_t cc, ul_sched_t& result) = 0; virtual void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) = 0; + virtual void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) = 0; virtual void ul_sr_info(tti_point, uint16_t rnti) = 0; }; diff --git a/srsenb/src/stack/mac/nr/sched_nr.cc b/srsenb/src/stack/mac/nr/sched_nr.cc index b97523623..702210928 100644 --- a/srsenb/src/stack/mac/nr/sched_nr.cc +++ b/srsenb/src/stack/mac/nr/sched_nr.cc @@ -164,6 +164,11 @@ void sched_nr::dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb rnti, cc, [pid, tb_idx, ack](ue_carrier& ue_cc) { ue_cc.harq_ent.dl_ack_info(pid, tb_idx, ack); }); } +void sched_nr::ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) +{ + sched_workers->enqueue_cc_feedback(rnti, cc, [pid, crc](ue_carrier& ue_cc) { ue_cc.harq_ent.ul_crc_info(pid, crc); }); +} + void sched_nr::ul_sr_info(tti_point tti_rx, uint16_t rnti) { sched_workers->enqueue_event(rnti, [this, rnti, tti_rx]() { ue_db[rnti]->ul_sr_info(tti_rx); }); diff --git a/test/phy/dummy_gnb_stack.h b/test/phy/dummy_gnb_stack.h index d2ce46c4b..649419d15 100644 --- a/test/phy/dummy_gnb_stack.h +++ b/test/phy/dummy_gnb_stack.h @@ -71,8 +71,9 @@ private: srsran::phy_cfg_nr_t phy_cfg = {}; bool valid = false; - srsenb::sched_nr sched; - srsran::tti_point pdsch_tti, pusch_tti; + srsenb::sched_nr sched; + srsran::tti_point pdsch_tti, pusch_tti; + srslog::basic_logger& sched_logger; std::mutex metrics_mutex; metrics_t metrics = {}; @@ -287,6 +288,8 @@ private: metrics.mac.tx_errors += tb_count; logger.debug("NACK received!"); } + + sched.dl_ack_info(rnti, 0, ack_bit->pid, 0, is_ok); } // Process SR @@ -320,9 +323,11 @@ public: phy_cfg(args.phy_cfg), ss_id(args.ss_id), sched(srsenb::sched_nr_interface::sched_cfg_t{}), - use_dummy_sched(args.use_dummy_sched) + use_dummy_sched(args.use_dummy_sched), + sched_logger(srslog::fetch_basic_logger("MAC")) { logger.set_level(srslog::str_to_basic_level(args.log_level)); + sched_logger.set_level(srslog::basic_levels::debug); // create sched object std::vector cells_cfg = srsenb::get_default_cells_cfg(1, phy_cfg); @@ -400,6 +405,7 @@ public: int get_dl_sched(const srsran_slot_cfg_t& slot_cfg, dl_sched_t& dl_sched) override { logger.set_context(slot_cfg.idx); + sched_logger.set_context(slot_cfg.idx); if (not pdsch_tti.is_valid()) { pdsch_tti = srsran::tti_point{slot_cfg.idx}; } else { @@ -445,6 +451,7 @@ public: int get_ul_sched(const srsran_slot_cfg_t& slot_cfg, ul_sched_t& ul_sched) override { logger.set_context(slot_cfg.idx); + sched_logger.set_context(slot_cfg.idx); if (not pusch_tti.is_valid()) { pusch_tti = srsran::tti_point{slot_cfg.idx}; } else { @@ -537,6 +544,20 @@ public: return SRSRAN_SUCCESS; } + void dl_ack_info(uint16_t rnti_, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) + { + if (not use_dummy_sched) { + sched.dl_ack_info(rnti_, cc, pid, tb_idx, ack); + } + } + + void ul_crc_info(uint16_t rnti_, uint32_t cc, uint32_t pid, bool crc) + { + if (not use_dummy_sched) { + sched.ul_crc_info(rnti_, cc, pid, crc); + } + } + int pucch_info(const srsran_slot_cfg_t& slot_cfg, const pucch_info_t& pucch_info) override { // Handle UCI data @@ -579,6 +600,8 @@ public: metrics.mac.rx_brate += rx_harq_proc[pusch_info.pid].get_tbs(); metrics.mac.rx_pkts++; + ul_crc_info(rnti, 0, pusch_info.pid, pusch_info.pusch_data.tb[0].crc); + return SRSRAN_SUCCESS; }