From 5a3a2a6d6fa9e0fce33fb170cc318bb98a2ac419 Mon Sep 17 00:00:00 2001 From: David Rupprecht Date: Fri, 9 Apr 2021 15:34:57 +0200 Subject: [PATCH] Added functions for adding phr and tag config --- lib/include/srsran/asn1/rrc_nr_utils.h | 2 ++ .../srsran/interfaces/mac_interface_types.h | 20 +++++++++++ .../srsran/interfaces/ue_nr_interfaces.h | 3 ++ lib/src/asn1/rrc_nr_utils.cc | 9 +++++ srsue/hdr/stack/mac_nr/mac_nr.h | 3 ++ srsue/src/stack/mac_nr/mac_nr.cc | 18 ++++++++++ srsue/src/stack/rrc/rrc_nr.cc | 33 +++++++++++++++++-- 7 files changed, 86 insertions(+), 2 deletions(-) diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index a739a287c..6f101550f 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -31,6 +31,7 @@ struct rlc_cfg_c; struct pdcp_cfg_s; struct lc_ch_cfg_s; struct rach_cfg_common_s; +struct phr_cfg_s; // Phy struct tdd_ul_dl_cfg_common_s; @@ -92,6 +93,7 @@ bool make_phy_pusch_scaling(const asn1::rrc_nr::uci_on_pusch_s& uci_on_pusch, fl **************************/ logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const asn1::rrc_nr::lc_ch_cfg_s& asn1_type); rach_nr_cfg_t make_mac_rach_cfg(const asn1::rrc_nr::rach_cfg_common_s& asn1_type); +bool make_mac_phr_cfg_t(const asn1::rrc_nr::phr_cfg_s& asn1_type, phr_cfg_nr_t* phr_cfg_nr); /*************************** * RLC Config **************************/ diff --git a/lib/include/srsran/interfaces/mac_interface_types.h b/lib/include/srsran/interfaces/mac_interface_types.h index e328476b9..964b8ef34 100644 --- a/lib/include/srsran/interfaces/mac_interface_types.h +++ b/lib/include/srsran/interfaces/mac_interface_types.h @@ -150,6 +150,26 @@ struct sr_cfg_nr_t { sr_cfg_item_nr_t item[SRSRAN_MAX_MAX_NR_OF_SR_CFG_PER_CELL_GROUP]; }; +struct tag_cfg_nr_t { + uint8_t tag_id; + uint32_t time_align_timer; +}; + +struct phr_cfg_nr_t { + int periodic_timer; + int prohibit_timer; + int tx_pwr_factor_change; + bool extended; + phr_cfg_nr_t() { reset(); } + void reset() + { + periodic_timer = -1; + prohibit_timer = -1; + tx_pwr_factor_change = -1; + extended = false; + } +}; + struct bsr_cfg_nr_t { // mandatory BSR config int periodic_timer; diff --git a/lib/include/srsran/interfaces/ue_nr_interfaces.h b/lib/include/srsran/interfaces/ue_nr_interfaces.h index d04461098..b743fb986 100644 --- a/lib/include/srsran/interfaces/ue_nr_interfaces.h +++ b/lib/include/srsran/interfaces/ue_nr_interfaces.h @@ -111,6 +111,9 @@ public: virtual int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) = 0; virtual int set_config(const srsran::sr_cfg_nr_t& sr_cfg) = 0; virtual void set_config(const srsran::rach_nr_cfg_t& rach_cfg) = 0; + virtual int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg) = 0; + virtual int set_config(const srsran::phr_cfg_nr_t& phr_cfg) = 0; + virtual int remove_tag_config(const uint32_t tag_id) = 0; // RRC triggers MAC ra procedure virtual void start_ra_procedure() = 0; diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index 76e474114..66d7ef932 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -66,6 +66,15 @@ logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const lc_c return logical_channel_config; } +bool make_mac_phr_cfg_t(const phr_cfg_s& asn1_type, phr_cfg_nr_t* phr_cfg_nr) +{ + phr_cfg_nr->extended = asn1_type.ext; + phr_cfg_nr->periodic_timer = asn1_type.phr_periodic_timer.to_number(); + phr_cfg_nr->prohibit_timer = asn1_type.phr_prohibit_timer.to_number(); + phr_cfg_nr->tx_pwr_factor_change = asn1_type.phr_tx_pwr_factor_change.to_number(); + return true; +} + rach_nr_cfg_t make_mac_rach_cfg(const rach_cfg_common_s& asn1_type) { rach_nr_cfg_t rach_nr_cfg = {}; diff --git a/srsue/hdr/stack/mac_nr/mac_nr.h b/srsue/hdr/stack/mac_nr/mac_nr.h index 59550711a..5e4dd84c2 100644 --- a/srsue/hdr/stack/mac_nr/mac_nr.h +++ b/srsue/hdr/stack/mac_nr/mac_nr.h @@ -76,6 +76,9 @@ public: void set_config(const srsran::rach_nr_cfg_t& rach_cfg); void set_contention_id(const uint64_t ue_identity); bool set_crnti(const uint16_t crnti); + int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg); + int set_config(const srsran::phr_cfg_nr_t& phr_cfg); + int remove_tag_config(const uint32_t tag_id); void start_ra_procedure(); /// procedure ra nr interface + mux diff --git a/srsue/src/stack/mac_nr/mac_nr.cc b/srsue/src/stack/mac_nr/mac_nr.cc index f1b5060fe..18cea6d1f 100644 --- a/srsue/src/stack/mac_nr/mac_nr.cc +++ b/srsue/src/stack/mac_nr/mac_nr.cc @@ -337,6 +337,24 @@ int mac_nr::setup_lcid(const srsran::logical_channel_config_t& config) return SRSRAN_SUCCESS; } +int mac_nr::add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg) +{ + logger.warning("Add tag config not supported yet"); + return SRSRAN_SUCCESS; +} + +int mac_nr::remove_tag_config(const uint32_t tag_id) +{ + logger.warning("Remove tag config not supported yet"); + return SRSRAN_SUCCESS; +} + +int mac_nr::set_config(const srsran::phr_cfg_nr_t& phr_cfg) +{ + logger.warning("Add phr config not supported yet"); + return SRSRAN_SUCCESS; +} + int mac_nr::set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) { return proc_bsr.set_config(bsr_cfg); diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index 5efb79d13..78c0e9c86 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -518,11 +518,40 @@ bool rrc_nr::apply_mac_cell_group(const mac_cell_group_cfg_s& mac_cell_group_cfg } if (mac_cell_group_cfg.tag_cfg_present) { - logger.warning("Not handling tag cfg in MAC cell group config"); + if (mac_cell_group_cfg.tag_cfg.tag_to_add_mod_list_present) { + for (uint32_t i = 0; i < mac_cell_group_cfg.tag_cfg.tag_to_add_mod_list.size(); i++) { + tag_cfg_nr_t tag_cfg_nr = {}; + tag_cfg_nr.tag_id = mac_cell_group_cfg.tag_cfg.tag_to_add_mod_list[i].tag_id; + tag_cfg_nr.time_align_timer = mac_cell_group_cfg.tag_cfg.tag_to_add_mod_list[i].time_align_timer.to_number(); + if (mac->add_tag_config(tag_cfg_nr) != SRSRAN_SUCCESS) { + logger.warning("Unable to add TAG config with tag_id %d", tag_cfg_nr.tag_id); + return false; + } + } + } + if (mac_cell_group_cfg.tag_cfg.tag_to_release_list_present) { + for (uint32_t i = 0; i < mac_cell_group_cfg.tag_cfg.tag_to_release_list.size(); i++) { + uint32_t tag_id = mac_cell_group_cfg.tag_cfg.tag_to_release_list[i]; + if (mac->remove_tag_config(tag_id) != SRSRAN_SUCCESS) { + logger.warning("Unable to release TAG config with tag_id %d", tag_id); + return false; + } + } + } } if (mac_cell_group_cfg.phr_cfg_present) { - logger.warning("Not handling phr cfg in MAC cell group config"); + if (mac_cell_group_cfg.phr_cfg.type() == setup_release_c::types_opts::setup) { + phr_cfg_nr_t phr_cfg_nr; + if (make_mac_phr_cfg_t(mac_cell_group_cfg.phr_cfg.setup(), &phr_cfg_nr) != true) { + logger.warning("Unable to build PHR config"); + return false; + } + if (mac->set_config(phr_cfg_nr) != SRSRAN_SUCCESS) { + logger.warning("Unable to set PHR config"); + return false; + } + } } if (mac_cell_group_cfg.skip_ul_tx_dynamic) {