diff --git a/lib/include/srslte/interfaces/enb_interfaces.h b/lib/include/srslte/interfaces/enb_interfaces.h index 2d899523f..5a1193e1a 100644 --- a/lib/include/srslte/interfaces/enb_interfaces.h +++ b/lib/include/srslte/interfaces/enb_interfaces.h @@ -262,6 +262,13 @@ public: * @param dedicated_list Physical layer configuration for the indicated eNb cell */ virtual void set_config_dedicated(uint16_t rnti, const phy_rrc_dedicated_list_t& dedicated_list) = 0; + + /** + * Instructs the physical layer the configuration has been complete from upper layers for a given RNTI + * + * @param rnti the given UE identifier (RNTI) + */ + virtual void complete_config_dedicated(uint16_t rnti) = 0; }; class mac_interface_rrc diff --git a/srsenb/hdr/phy/phy.h b/srsenb/hdr/phy/phy.h index 0164f1845..da73c68cb 100644 --- a/srsenb/hdr/phy/phy.h +++ b/srsenb/hdr/phy/phy.h @@ -64,6 +64,7 @@ public: void start_plot() override; void set_config_dedicated(uint16_t rnti, const phy_rrc_dedicated_list_t& dedicated_list) override; + void complete_config_dedicated(uint16_t rnti) override; void get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]) override; diff --git a/srsenb/hdr/phy/phy_ue_db.h b/srsenb/hdr/phy/phy_ue_db.h index a8b51055e..82901555f 100644 --- a/srsenb/hdr/phy/phy_ue_db.h +++ b/srsenb/hdr/phy/phy_ue_db.h @@ -34,11 +34,30 @@ class phy_ue_db { private: /** - * SCell Configuration state indicates whether the SCell has been configured from the RRC set and activated from the - * MAC layer. + * Primary serving cell configuration flow + * ---------------------------------------- + * Initially UEs are created with a default configuration. When it receives a new configuration for a UE from the + * stack, it does not apply the primary serving cell straightforward. The primary cell configuration is stashed and + * not applied. However, some parameters are copied to the actual configuration order to allow PHY transmitting the + * upper layers messages and receiving the messages before applying the full configuration. * - * Initially the the state is default and it goes to deactivated as soon as it is configured from RRC, then it can - * transition to active as soon as the MAC indicates so. + * The stashed primary cell configuration is applied as soon as the stack indicates the completion of the + * configuration procedure. + * + * +---------+ Stack set config +--------------+ Stack Config complete +--------------------+ + * | Default |----------------->| Stash config |---------------------->| Full configuration | + * +---------+ +--------------+ +--------------------+ + * ^ | + * | User reconfiguration | + * +------------------------------------------+ + * + * Secondary serving cell configuration flow + * ------------------------------------------ + * Secondary serving cell configuration uses the cell_state attribute for indicating whether the they have been + * configured from the stack set and activated/deactivated. + * + * Initially the the state is default (none) and it goes to inactive as soon as it is configured from the stack, then + * it can transition to active as soon as the stack indicates so. * * +---------+ Set SCell Configuration +-------------+ SCell activation +--------+ * | Default | --------------------------->| Deactivated |--------------------->| Active | @@ -62,19 +81,20 @@ private: * Cell information for the UE database */ typedef struct { - cell_state_t state = cell_state_none; ///< Configuration state - uint32_t enb_cc_idx = 0; ///< Corresponding eNb cell/carrier index - uint8_t last_ri = 0; ///< Last reported rank indicator - srslte_ra_tb_t last_tb[SRSLTE_MAX_HARQ_PROC] = {}; ///< Stores last PUSCH Resource allocation - srslte::phy_cfg_t phy_cfg; ///< Configuration, it has a default constructor + cell_state_t state = cell_state_none; ///< Configuration state + uint32_t enb_cc_idx = 0; ///< Corresponding eNb cell/carrier index + uint8_t last_ri = 0; ///< Last reported rank indicator + std::array last_tb = {}; ///< Stores last PUSCH Resource allocation + srslte::phy_cfg_t phy_cfg; ///< Configuration, it has a default constructor } cell_info_t; /** * UE object stored in the PHY common database */ struct common_ue { - srslte_pdsch_ack_t pdsch_ack[TTIMOD_SZ] = {}; ///< Pending acknowledgements for this Cell - cell_info_t cell_info[SRSLTE_MAX_CARRIERS]; ///< Cell information, indexed by cell_idx + std::array pdsch_ack = {}; ///< Pending acknowledgements for this Cell + std::array cell_info = {}; ///< Cell information, indexed by ue_cell_idx + srslte::phy_cfg_t pcell_cfg_stash = {}; ///< Stashed Cell information }; /** @@ -118,11 +138,13 @@ private: inline void _clear_tti_pending_rnti(uint32_t tti, uint16_t rnti); /** - * Helper method to set the constant attributes of a given RNTI after the configuration is set + * Helper method to set the constant attributes of a given RNTI after the configuration is set, it does not modify + * internal states. * * @param rnti identifier of the UE (requires assertion prior to call) + * @param phy_cfg points to the PHY configuration for a given cell/carrier */ - inline void _set_common_config_rnti(uint16_t rnti); + inline void _set_common_config_rnti(uint16_t rnti, srslte::phy_cfg_t& phy_cfg) const; /** * Gets the SCell index for a given RNTI and a eNb cell/carrier. It returns the SCell index (0 if PCell) if the cc_idx @@ -193,6 +215,16 @@ private: */ inline int _assert_cell_list_cfg() const; + /** + * Internal eNb general configuration getter, returns default configuration if the UE does not exist in the given cell + * + * @param rnti provides UE identifier + * @param enb_cc_idx eNb cell index + * @param stashed if it is true, it returns the stashed configuration. Otherwise, it return the current configuration. + * @return The PHY configuration of the indicated UE for the indicated eNb carrier/call index. + */ + inline srslte::phy_cfg_t _get_rnti_config(uint16_t rnti, uint32_t enb_cc_idx, bool stashed) const; + public: /** * Initialises the UE database with the stack and cell list @@ -219,8 +251,16 @@ public: void rem_rnti(uint16_t rnti); /** - * Activates or deactivates configured SCells for a given RNTI and SCell index (UE SCell index), index 0 is reserved - * for PCell + * Stack callback for indicating the completion of the configuration process and apply the stashed configuration in + * the primary cell. + * + * @param rnti identifier of the user + */ + void complete_config(uint16_t rnti); + + /** + * Activates or deactivates configured secondary cells for a given RNTI and SCell index (UE SCell index), index 0 is + * reserved for primary cell * @param rnti identifier of the UE * @param scell_idx * @param activate @@ -228,12 +268,36 @@ public: void activate_deactivate_scell(uint16_t rnti, uint32_t ue_cc_idx, bool activate); /** - * Get the current physical layer configuration for an RNTI and an eNb cell/carrier + * Get the current down-link physical layer configuration for an RNTI and an eNb cell/carrier + * + * @param rnti identifier of the UE + * @param cc_idx the eNb cell/carrier identifier + */ + srslte_dl_cfg_t get_dl_config(uint16_t rnti, uint32_t enb_cc_idx) const; + + /** + * Get the current DCI configuration for PDSCH physical layer configuration for an RNTI and an eNb cell/carrier + * + * @param rnti identifier of the UE + * @param cc_idx the eNb cell/carrier identifier + */ + srslte_dci_cfg_t get_dci_dl_config(uint16_t rnti, uint32_t enb_cc_idx) const; + + /** + * Get the current PUCCH physical layer configuration for an RNTI and an eNb cell/carrier. + * + * @param rnti identifier of the UE + * @param cc_idx the eNb cell/carrier identifier + */ + srslte_ul_cfg_t get_ul_config(uint16_t rnti, uint32_t enb_cc_idx) const; + + /** + * Get the current DCI configuration for PUSCH physical layer configuration for an RNTI and an eNb cell/carrier * * @param rnti identifier of the UE * @param cc_idx the eNb cell/carrier identifier */ - srslte::phy_cfg_t get_config(uint16_t rnti, uint32_t enb_cc_idx) const; + srslte_dci_cfg_t get_dci_ul_config(uint16_t rnti, uint32_t enb_cc_idx) const; /** * Removes all the pending ACKs of all the RNTIs for a given TTI diff --git a/srsenb/src/phy/cc_worker.cc b/srsenb/src/phy/cc_worker.cc index 7114e1f28..2541f03d3 100644 --- a/srsenb/src/phy/cc_worker.cc +++ b/srsenb/src/phy/cc_worker.cc @@ -285,17 +285,16 @@ int cc_worker::decode_pusch(stack_interface_phy_lte::ul_sched_grant_t* grants, u if (rnti && ue_db.count(rnti)) { // Get UE configuration - srslte::phy_cfg_t phy_cfg = phy->ue_db.get_config(rnti, cc_idx); - srslte_ul_cfg_t& ul_cfg = phy_cfg.ul_cfg; + srslte_ul_cfg_t ul_cfg = phy->ue_db.get_ul_config(rnti, cc_idx); // mark this tti as having an ul dci to avoid pucch ue_db[rnti]->is_grant_available = true; // Fill UCI configuration - phy->ue_db.fill_uci_cfg(tti_rx, cc_idx, rnti, grants->dci.cqi_request, true, phy_cfg.ul_cfg.pusch.uci_cfg); + phy->ue_db.fill_uci_cfg(tti_rx, cc_idx, rnti, grants->dci.cqi_request, true, ul_cfg.pusch.uci_cfg); // Compute UL grant - srslte_pusch_grant_t& grant = phy_cfg.ul_cfg.pusch.grant; + srslte_pusch_grant_t& grant = ul_cfg.pusch.grant; if (srslte_ra_ul_dci_to_grant(&enb_ul.cell, &ul_sf, &ul_cfg.hopping, &ul_grant.dci, &grant)) { Error("Computing PUSCH dci\n"); return SRSLTE_ERROR; @@ -378,7 +377,7 @@ int cc_worker::decode_pucch() // If it's a User RNTI and doesn't have PUSCH grant in this TTI if (SRSLTE_RNTI_ISUSER(rnti) && !ue_db[rnti]->is_grant_available && ue_db[rnti]->is_pcell()) { - srslte_ul_cfg_t ul_cfg = phy->ue_db.get_config(rnti, cc_idx).ul_cfg; + srslte_ul_cfg_t ul_cfg = phy->ue_db.get_ul_config(rnti, cc_idx); // Check if user needs to receive PUCCH if (phy->ue_db.fill_uci_cfg(tti_rx, cc_idx, rnti, false, false, ul_cfg.pucch.uci_cfg)) { @@ -402,9 +401,11 @@ int cc_worker::decode_pucch() phy->ue_db.send_uci_data(tti_rx, rnti, cc_idx, ul_cfg.pucch.uci_cfg, pucch_res.uci_data); // Logging - char str[512]; - srslte_pucch_rx_info(&ul_cfg.pucch, &pucch_res, str, 512); - Info("PUCCH: cc=%d; %s\n", cc_idx, str); + if (log_h->get_level() >= srslte::LOG_LEVEL_INFO) { + char str[512]; + srslte_pucch_rx_info(&ul_cfg.pucch, &pucch_res, str, sizeof(str)); + log_h->info("PUCCH: cc=%d; %s\n", cc_idx, str); + } } } } @@ -432,7 +433,7 @@ int cc_worker::encode_pdcch_ul(stack_interface_phy_lte::ul_sched_grant_t* grants { for (uint32_t i = 0; i < nof_grants; i++) { if (grants[i].needs_pdcch) { - srslte_dci_cfg_t dci_cfg = phy->ue_db.get_config(grants[i].dci.rnti, cc_idx).dl_cfg.dci; + srslte_dci_cfg_t dci_cfg = phy->ue_db.get_dci_ul_config(grants[i].dci.rnti, cc_idx); if (srslte_enb_dl_put_pdcch_ul(&enb_dl, &dci_cfg, &grants[i].dci)) { ERROR("Error putting PUSCH %d\n", i); return SRSLTE_ERROR; @@ -454,7 +455,7 @@ int cc_worker::encode_pdcch_dl(stack_interface_phy_lte::dl_sched_grant_t* grants for (uint32_t i = 0; i < nof_grants; i++) { uint16_t rnti = grants[i].dci.rnti; if (rnti) { - srslte_dci_cfg_t dci_cfg = phy->ue_db.get_config(rnti, cc_idx).dl_cfg.dci; + srslte_dci_cfg_t dci_cfg = phy->ue_db.get_dci_dl_config(grants[i].dci.rnti, cc_idx); if (srslte_enb_dl_put_pdcch_dl(&enb_dl, &dci_cfg, &grants[i].dci)) { ERROR("Error putting PDCCH %d\n", i); return SRSLTE_ERROR; @@ -508,7 +509,7 @@ int cc_worker::encode_pdsch(stack_interface_phy_lte::dl_sched_grant_t* grants, u uint16_t rnti = grants[i].dci.rnti; if (rnti && ue_db.count(rnti)) { - srslte_dl_cfg_t dl_cfg = phy->ue_db.get_config(rnti, cc_idx).dl_cfg; + srslte_dl_cfg_t dl_cfg = phy->ue_db.get_dl_config(rnti, cc_idx); // Compute DL grant if (srslte_ra_dl_dci_to_grant( diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index 21d305472..87d212b92 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -247,6 +247,12 @@ void phy::set_config_dedicated(uint16_t rnti, const phy_rrc_dedicated_list_t& de } } +void phy::complete_config_dedicated(uint16_t rnti) +{ + // Forwards call to the UE Database + workers_common.ue_db.complete_config(rnti); +} + void phy::configure_mbsfn(sib_type2_s* sib2, sib_type13_r9_s* sib13, const mcch_msg_s& mcch) { if (sib2->mbsfn_sf_cfg_list_present) { diff --git a/srsenb/src/phy/phy_ue_db.cc b/srsenb/src/phy/phy_ue_db.cc index 9f2f3c9a5..cfaaae7c4 100644 --- a/srsenb/src/phy/phy_ue_db.cc +++ b/srsenb/src/phy/phy_ue_db.cc @@ -51,7 +51,7 @@ inline void phy_ue_db::_add_rnti(uint16_t rnti) ue.cell_info[0].phy_cfg.set_defaults(); // Set constant configuration fields - _set_common_config_rnti(rnti); + _set_common_config_rnti(rnti, ue.cell_info[0].phy_cfg); // Configure as PCell ue.cell_info[0].state = cell_state_primary; @@ -88,27 +88,20 @@ inline void phy_ue_db::_clear_tti_pending_rnti(uint32_t tti, uint16_t rnti) pdsch_ack.simul_cqi_ack = ue.cell_info[0].phy_cfg.ul_cfg.pucch.simul_cqi_ack; } -inline void phy_ue_db::_set_common_config_rnti(uint16_t rnti) +inline void phy_ue_db::_set_common_config_rnti(uint16_t rnti, srslte::phy_cfg_t& phy_cfg) const { - // Private function not mutexed, no need to assert RNTI or TTI - - // Get UE - common_ue& ue = ue_db[rnti]; - - // Iterate all cells/carriers - for (auto& scell_info : ue.cell_info) { - scell_info.phy_cfg.dl_cfg.pdsch.rnti = rnti; - scell_info.phy_cfg.ul_cfg.pucch.rnti = rnti; - scell_info.phy_cfg.ul_cfg.pusch.rnti = rnti; - scell_info.phy_cfg.ul_cfg.pusch.meas_time_en = true; - scell_info.phy_cfg.ul_cfg.pusch.meas_epre_en = phy_args->pusch_meas_epre; - scell_info.phy_cfg.ul_cfg.pusch.meas_ta_en = phy_args->pusch_meas_ta; - scell_info.phy_cfg.ul_cfg.pusch.meas_evm_en = phy_args->pusch_meas_evm; - scell_info.phy_cfg.ul_cfg.pucch.threshold_format1 = SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT1; - scell_info.phy_cfg.ul_cfg.pucch.threshold_data_valid_format1a = SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT1A; - scell_info.phy_cfg.ul_cfg.pucch.threshold_data_valid_format2 = SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT2; - scell_info.phy_cfg.ul_cfg.pucch.threshold_dmrs_detection = SRSLTE_PUCCH_DEFAULT_THRESHOLD_DMRS; - } + // Set common parameters + phy_cfg.dl_cfg.pdsch.rnti = rnti; + phy_cfg.ul_cfg.pucch.rnti = rnti; + phy_cfg.ul_cfg.pusch.rnti = rnti; + phy_cfg.ul_cfg.pusch.meas_time_en = true; + phy_cfg.ul_cfg.pusch.meas_epre_en = phy_args->pusch_meas_epre; + phy_cfg.ul_cfg.pusch.meas_ta_en = phy_args->pusch_meas_ta; + phy_cfg.ul_cfg.pusch.meas_evm_en = phy_args->pusch_meas_evm; + phy_cfg.ul_cfg.pucch.threshold_format1 = SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT1; + phy_cfg.ul_cfg.pucch.threshold_data_valid_format1a = SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT1A; + phy_cfg.ul_cfg.pucch.threshold_data_valid_format2 = SRSLTE_PUCCH_DEFAULT_THRESHOLD_FORMAT2; + phy_cfg.ul_cfg.pucch.threshold_dmrs_detection = SRSLTE_PUCCH_DEFAULT_THRESHOLD_DMRS; } inline uint32_t phy_ue_db::_get_ue_cc_idx(uint16_t rnti, uint32_t enb_cc_idx) const @@ -116,7 +109,7 @@ inline uint32_t phy_ue_db::_get_ue_cc_idx(uint16_t rnti, uint32_t enb_cc_idx) co uint32_t ue_cc_idx = 0; const common_ue& ue = ue_db.at(rnti); - for (ue_cc_idx = 0; ue_cc_idx < SRSLTE_MAX_CARRIERS; ue_cc_idx++) { + for (; ue_cc_idx < SRSLTE_MAX_CARRIERS; ue_cc_idx++) { const cell_info_t& scell_info = ue.cell_info[ue_cc_idx]; if (scell_info.enb_cc_idx == enb_cc_idx and scell_info.state != cell_state_secondary_inactive) { return ue_cc_idx; @@ -232,6 +225,35 @@ inline int phy_ue_db::_assert_cell_list_cfg() const return SRSLTE_SUCCESS; } +inline srslte::phy_cfg_t phy_ue_db::_get_rnti_config(uint16_t rnti, uint32_t enb_cc_idx, bool stashed) const +{ + srslte::phy_cfg_t default_cfg = {}; + default_cfg.set_defaults(); + default_cfg.dl_cfg.pdsch.rnti = rnti; + default_cfg.ul_cfg.pucch.rnti = rnti; + default_cfg.ul_cfg.pusch.rnti = rnti; + + // Use default configuration for non-user C-RNTI + if (not SRSLTE_RNTI_ISUSER(rnti)) { + return default_cfg; + } + + // Make sure the C-RNTI exists and the cell is active for the user + if (_assert_active_enb_cc(rnti, enb_cc_idx) != SRSLTE_SUCCESS) { + return default_cfg; + } + + uint32_t ue_cc_idx = _get_ue_cc_idx(rnti, enb_cc_idx); + + // Return Stashed configuration if PCell and stashed is true + if (ue_cc_idx == 0 and stashed) { + return ue_db.at(rnti).pcell_cfg_stash; + } + + // Otherwise return current configuration + return ue_db.at(rnti).cell_info[ue_cc_idx].phy_cfg; +} + void phy_ue_db::clear_tti_pending_ack(uint32_t tti) { std::lock_guard lock(mutex); @@ -262,16 +284,21 @@ void phy_ue_db::addmod_rnti(uint16_t for (uint32_t ue_cc_idx = 0; ue_cc_idx < phy_rrc_dedicated_list.size() && ue_cc_idx < SRSLTE_MAX_CARRIERS; ue_cc_idx++) { auto& phy_rrc_dedicated = phy_rrc_dedicated_list[ue_cc_idx]; - // Configured, add/modify entry in the scell_info map - auto& cell_info = ue.cell_info[ue_cc_idx]; + // Configured, add/modify entry in the cell_info map + cell_info_t& cell_info = ue.cell_info[ue_cc_idx]; if (phy_rrc_dedicated.configured or cell_info.state == cell_state_primary) { // Set cell information cell_info.enb_cc_idx = phy_rrc_dedicated.enb_cc_idx; - cell_info.phy_cfg = phy_rrc_dedicated.phy_cfg; - // Set constant configuration fields - _set_common_config_rnti(rnti); + // Apply PCell configuration is stash + if (cell_info.state == cell_state_primary) { + ue.pcell_cfg_stash = phy_rrc_dedicated.phy_cfg; + _set_common_config_rnti(rnti, ue.pcell_cfg_stash); + } else { + ue.cell_info[ue_cc_idx].phy_cfg = phy_rrc_dedicated.phy_cfg; + _set_common_config_rnti(rnti, ue.cell_info[ue_cc_idx].phy_cfg); + } // Set Cell state, all inactive by default except PCell if (cell_info.state != cell_state_primary) { @@ -293,10 +320,26 @@ void phy_ue_db::addmod_rnti(uint16_t // Enable/Disable extended CSI field in DCI according to 3GPP 36.212 R10 5.3.3.1.1 Format 0 for (uint32_t ue_cc_idx = 0; ue_cc_idx < SRSLTE_MAX_CARRIERS; ue_cc_idx++) { - if (ue.cell_info[ue_cc_idx].state != cell_state_none) { + if (ue.cell_info[ue_cc_idx].state == cell_state_secondary_inactive || + ue.cell_info[ue_cc_idx].state == cell_state_secondary_active) { ue.cell_info[ue_cc_idx].phy_cfg.dl_cfg.dci.multiple_csi_request_enabled = (nof_configured_scell > 1); + } else if (ue.cell_info[ue_cc_idx].state == cell_state_primary) { + ue.pcell_cfg_stash.dl_cfg.dci.multiple_csi_request_enabled = (nof_configured_scell > 1); } } + + // Copy necessary PCell configuration for receiving Configuration Completion from UE + srslte::phy_cfg_t& pcell_cfg = ue.cell_info[0].phy_cfg; + + // Setup Temporal PUCCH configuration + srslte_pucch_cfg_t tmp_pucch_cfg = ue.pcell_cfg_stash.ul_cfg.pucch; + tmp_pucch_cfg.N_pucch_1 = pcell_cfg.ul_cfg.pucch.N_pucch_1; ///< Used for ACK + + // Load new UL configuration + pcell_cfg.ul_cfg = ue.pcell_cfg_stash.ul_cfg; + + // Overwrite PUCCH with tenporal PUCCH + pcell_cfg.ul_cfg.pucch = tmp_pucch_cfg; } void phy_ue_db::rem_rnti(uint16_t rnti) @@ -308,6 +351,19 @@ void phy_ue_db::rem_rnti(uint16_t rnti) } } +void phy_ue_db::complete_config(uint16_t rnti) +{ + std::lock_guard lock(mutex); + + // Makes sure the RNTI exists + if (_assert_rnti(rnti) != SRSLTE_SUCCESS) { + return; + } + + // Apply stashed configuration + ue_db[rnti].cell_info[0].phy_cfg = ue_db[rnti].pcell_cfg_stash; +} + void phy_ue_db::activate_deactivate_scell(uint16_t rnti, uint32_t ue_cc_idx, bool activate) { // Assert RNTI and SCell are valid @@ -327,27 +383,28 @@ void phy_ue_db::activate_deactivate_scell(uint16_t rnti, uint32_t ue_cc_idx, boo cell_info.state = (activate) ? cell_state_secondary_active : cell_state_secondary_inactive; } -srslte::phy_cfg_t phy_ue_db::get_config(uint16_t rnti, uint32_t enb_cc_idx) const +srslte_dl_cfg_t phy_ue_db::get_dl_config(uint16_t rnti, uint32_t enb_cc_idx) const { std::lock_guard lock(mutex); + return _get_rnti_config(rnti, enb_cc_idx, false).dl_cfg; +} - srslte::phy_cfg_t default_cfg = {}; - default_cfg.set_defaults(); - default_cfg.dl_cfg.pdsch.rnti = rnti; - default_cfg.ul_cfg.pusch.rnti = rnti; - default_cfg.ul_cfg.pucch.rnti = rnti; - - // Use default configuration for non-user C-RNTI - if (not SRSLTE_RNTI_ISUSER(rnti)) { - return default_cfg; - } +srslte_dci_cfg_t phy_ue_db::get_dci_dl_config(uint16_t rnti, uint32_t enb_cc_idx) const +{ + std::lock_guard lock(mutex); + return _get_rnti_config(rnti, enb_cc_idx, false).dl_cfg.dci; +} - // Make sure the C-RNTI exists and the cell is active for the user - if (_assert_active_enb_cc(rnti, enb_cc_idx) != SRSLTE_SUCCESS) { - return default_cfg; - } +srslte_ul_cfg_t phy_ue_db::get_ul_config(uint16_t rnti, uint32_t enb_cc_idx) const +{ + std::lock_guard lock(mutex); + return _get_rnti_config(rnti, enb_cc_idx, false).ul_cfg; +} - return ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].phy_cfg; +srslte_dci_cfg_t phy_ue_db::get_dci_ul_config(uint16_t rnti, uint32_t enb_cc_idx) const +{ + std::lock_guard lock(mutex); + return _get_rnti_config(rnti, enb_cc_idx, true).dl_cfg.dci; } void phy_ue_db::set_ack_pending(uint32_t tti, uint32_t enb_cc_idx, const srslte_dci_dl_t& dci) diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index f7456864e..da49df69a 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -1228,6 +1228,9 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_r8_ies_s* msg) void rrc::ue::handle_rrc_con_setup_complete(rrc_conn_setup_complete_s* msg, srslte::unique_byte_buffer_t pdu) { + // Inform PHY about the configuration completion + parent->phy->complete_config_dedicated(rnti); + parent->rrc_log->info("RRCConnectionSetupComplete transaction ID: %d\n", msg->rrc_transaction_id); rrc_conn_setup_complete_r8_ies_s* msg_r8 = &msg->crit_exts.c1().rrc_conn_setup_complete_r8(); @@ -1252,6 +1255,9 @@ void rrc::ue::handle_rrc_con_setup_complete(rrc_conn_setup_complete_s* msg, srsl void rrc::ue::handle_rrc_reconf_complete(rrc_conn_recfg_complete_s* msg, srslte::unique_byte_buffer_t pdu) { + // Inform PHY about the configuration completion + parent->phy->complete_config_dedicated(rnti); + if (last_rrc_conn_recfg.rrc_transaction_id == msg->rrc_transaction_id) { // Finally, add secondary carriers // TODO: For now the ue supports all cc diff --git a/srsenb/test/common/dummy_classes.h b/srsenb/test/common/dummy_classes.h index 69511dbf9..a8b997c97 100644 --- a/srsenb/test/common/dummy_classes.h +++ b/srsenb/test/common/dummy_classes.h @@ -115,6 +115,7 @@ public: const asn1::rrc::mcch_msg_s& mcch) override {} void set_config_dedicated(uint16_t rnti, const phy_rrc_dedicated_list_t& dedicated_list) override {} + void complete_config_dedicated(uint16_t rnti) override{}; }; class gtpu_dummy : public gtpu_interface_rrc