From f64c268a6934b33632ba0d30866248a0a804e068 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 9 Nov 2020 16:59:22 +0100 Subject: [PATCH] SRSUE: Refactored MAC/RRC SCell Activation/Deactivation --- lib/include/srslte/interfaces/ue_interfaces.h | 4 ++-- lib/include/srslte/test/ue_test_interfaces.h | 2 +- srsue/hdr/phy/phy.h | 3 ++- srsue/hdr/stack/mac/demux.h | 6 +++--- srsue/src/phy/phy.cc | 9 ++++++++- srsue/src/stack/mac/demux.cc | 12 ++++++------ srsue/src/stack/mac/dl_harq.cc | 2 +- srsue/src/stack/rrc/rrc_procedures.cc | 4 ++-- srsue/test/mac_test.cc | 2 +- srsue/test/ttcn3/hdr/lte_ttcn3_phy.h | 3 ++- srsue/test/ttcn3/src/lte_ttcn3_phy.cc | 7 ++++++- srsue/test/upper/rrc_meas_test.cc | 2 +- 12 files changed, 35 insertions(+), 21 deletions(-) diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 9bc175fb9..ee6a7253f 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -552,7 +552,7 @@ public: virtual void set_timeadv(uint32_t ta_cmd) = 0; /* Activate / Disactivate SCell*/ - virtual void set_activation_deactivation_scell(uint32_t cmd) = 0; + virtual void set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) = 0; /* Sets RAR dci payload */ virtual void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti) = 0; @@ -595,7 +595,7 @@ public: virtual void set_config_mbsfn_sib13(const srslte::sib13_t& sib13) = 0; virtual void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch) = 0; - virtual void set_activation_deactivation_scell(uint32_t cmd) = 0; + virtual void deactivate_scells() = 0; /* Measurements interface */ virtual void set_cells_to_meas(uint32_t earfcn, const std::set& pci) = 0; diff --git a/lib/include/srslte/test/ue_test_interfaces.h b/lib/include/srslte/test/ue_test_interfaces.h index ba5ed2b9a..6834261b7 100644 --- a/lib/include/srslte/test/ue_test_interfaces.h +++ b/lib/include/srslte/test/ue_test_interfaces.h @@ -73,7 +73,7 @@ class phy_dummy_interface : public phy_interface_rrc_lte void set_config_mbsfn_sib2(srslte::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override {} void set_config_mbsfn_sib13(const srslte::sib13_t& sib13) override {} void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch) override {} - void set_activation_deactivation_scell(uint32_t cmd) override {} + void deactivate_scells() override {} /* Measurements interface */ void set_cells_to_meas(uint32_t earfcn, const std::set& pci) override {} diff --git a/srsue/hdr/phy/phy.h b/srsue/hdr/phy/phy.h index 702986a47..481c12f1c 100644 --- a/srsue/hdr/phy/phy.h +++ b/srsue/hdr/phy/phy.h @@ -145,7 +145,8 @@ public: void set_timeadv(uint32_t ta_cmd) final; /* Activate / Disactivate SCell*/ - void set_activation_deactivation_scell(uint32_t ta_cmd) final; + void deactivate_scells() final; + void set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) final; /* Sets RAR dci payload */ void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti) final; diff --git a/srsue/hdr/stack/mac/demux.h b/srsue/hdr/stack/mac/demux.h index 510e0499c..5f2bfde2e 100644 --- a/srsue/hdr/stack/mac/demux.h +++ b/srsue/hdr/stack/mac/demux.h @@ -54,7 +54,7 @@ public: uint8_t* request_buffer_bcch(uint32_t len); void deallocate(uint8_t* payload_buffer_ptr); - void push_pdu(uint8_t* buff, uint32_t nof_bytes); + void push_pdu(uint8_t* buff, uint32_t nof_bytes, uint32_t tti); void push_pdu_bcch(uint8_t* buff, uint32_t nof_bytes); void push_pdu_mch(uint8_t* buff, uint32_t nof_bytes); void push_pdu_temp_crnti(uint8_t* buff, uint32_t nof_bytes); @@ -79,10 +79,10 @@ private: srslte::mch_pdu mch_mac_msg; srslte::sch_pdu pending_mac_msg; uint8_t mch_lcids[SRSLTE_N_MCH_LCIDS] = {}; - void process_sch_pdu_rt(uint8_t* buff, uint32_t nof_bytes); + void process_sch_pdu_rt(uint8_t* buff, uint32_t nof_bytes, uint32_t tti); void process_sch_pdu(srslte::sch_pdu* pdu); void process_mch_pdu(srslte::mch_pdu* pdu); - bool process_ce(srslte::sch_subh* subheader); + bool process_ce(srslte::sch_subh* subheader, uint32_t tti); void parse_ta_cmd(srslte::sch_subh* subh); bool is_uecrid_successful = false; diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 7840f4db6..1d903b67b 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -267,7 +267,14 @@ void phy::set_timeadv(uint32_t ta_cmd) common.ta.add_ta_cmd_new(ta_cmd); } -void phy::set_activation_deactivation_scell(uint32_t cmd) +void phy::deactivate_scells() +{ + for (uint32_t i = 1; i < SRSLTE_MAX_CARRIERS; i++) { + common.enable_scell(i, false); + } +} + +void phy::set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) { /* Implements 3GPP 36.321 section 6.1.3.8. Activation/Deactivation MAC Control Element*/ for (uint32_t i = 1; i < SRSLTE_MAX_CARRIERS; i++) { diff --git a/srsue/src/stack/mac/demux.cc b/srsue/src/stack/mac/demux.cc index 603dad96e..093156545 100644 --- a/srsue/src/stack/mac/demux.cc +++ b/srsue/src/stack/mac/demux.cc @@ -125,11 +125,11 @@ void demux::push_pdu_temp_crnti(uint8_t* buff, uint32_t nof_bytes) * This function enqueues the packet and returns quickly because ACK * deadline is important here. */ -void demux::push_pdu(uint8_t* buff, uint32_t nof_bytes) +void demux::push_pdu(uint8_t* buff, uint32_t nof_bytes, uint32_t tti) { // Process Real-Time PDUs - process_sch_pdu_rt(buff, nof_bytes); + process_sch_pdu_rt(buff, nof_bytes, tti); return pdus.push(buff, nof_bytes, srslte::pdu_queue::DCH); } @@ -180,7 +180,7 @@ void demux::process_pdu(uint8_t* mac_pdu, uint32_t nof_bytes, srslte::pdu_queue: } } -void demux::process_sch_pdu_rt(uint8_t* buff, uint32_t nof_bytes) +void demux::process_sch_pdu_rt(uint8_t* buff, uint32_t nof_bytes, uint32_t tti) { srslte::sch_pdu mac_msg_rt(20, log_h); @@ -192,7 +192,7 @@ void demux::process_sch_pdu_rt(uint8_t* buff, uint32_t nof_bytes) // Ignore SDU } else { // Process MAC Control Element - if (!process_ce(mac_msg_rt.get())) { + if (!process_ce(mac_msg_rt.get(), tti)) { Warning("Received Subheader with invalid or unknown LCID\n"); } } @@ -274,7 +274,7 @@ void demux::mch_start_rx(uint32_t lcid) } } -bool demux::process_ce(srslte::sch_subh* subh) +bool demux::process_ce(srslte::sch_subh* subh, uint32_t tti) { switch (subh->dl_sch_ce_type()) { case srslte::dl_sch_lcid::CON_RES_ID: @@ -287,7 +287,7 @@ bool demux::process_ce(srslte::sch_subh* subh) uint32_t cmd = (uint32_t)subh->get_activation_deactivation_cmd(); srslte::console("SCELL Activation / Deactivation CMD: %x\n", cmd); log_h->info("SCELL Activation / Deactivation CMD: %x\n", cmd); - phy_h->set_activation_deactivation_scell(cmd); + phy_h->set_activation_deactivation_scell(cmd, tti); break; } case srslte::dl_sch_lcid::PADDING: diff --git a/srsue/src/stack/mac/dl_harq.cc b/srsue/src/stack/mac/dl_harq.cc index 2f3a40cd1..0f61678ad 100644 --- a/srsue/src/stack/mac/dl_harq.cc +++ b/srsue/src/stack/mac/dl_harq.cc @@ -341,7 +341,7 @@ void dl_harq_entity::dl_harq_process::dl_tb_process::tb_decoded(mac_interface_ph } else { Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit\n", cur_grant.tb[tid].tbs); - harq_entity->demux_unit->push_pdu(payload_buffer_ptr, cur_grant.tb[tid].tbs); + harq_entity->demux_unit->push_pdu(payload_buffer_ptr, cur_grant.tb[tid].tbs, grant.tti); // Compute average number of retransmissions per packet harq_entity->average_retx = SRSLTE_VEC_CMA((float)n_retx, harq_entity->average_retx, harq_entity->nof_pkts++); diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index 72c6160e1..8493c069e 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -1332,7 +1332,7 @@ proc_outcome_t rrc::connection_reest_proc::init(asn1::rrc::reest_cause_e cause) // configure lower layers to consider the SCell(s), if configured, to be in deactivated state; if (nof_scells_active > 0) { - rrc_ptr->phy->set_activation_deactivation_scell(0); + rrc_ptr->phy->deactivate_scells(); } // 1> apply the default physical channel configuration as specified in 9.2.4; @@ -1596,7 +1596,7 @@ srslte::proc_outcome_t rrc::ho_proc::init(const asn1::rrc::rrc_conn_recfg_s& rrc // configure lower layers to consider the SCell(s), if configured, to be in deactivated state; if (nof_scells_active > 0) { - rrc_ptr->phy->set_activation_deactivation_scell(0); + rrc_ptr->phy->deactivate_scells(); } // apply the value of the newUE-Identity as the C-RNTI; diff --git a/srsue/test/mac_test.cc b/srsue/test/mac_test.cc index 8d046370c..27f247f87 100644 --- a/srsue/test/mac_test.cc +++ b/srsue/test/mac_test.cc @@ -163,7 +163,7 @@ public: void set_crnti(uint16_t rnti) { last_crnti = rnti; } void set_timeadv_rar(uint32_t ta_cmd) { rar_time_adv = ta_cmd; } void set_timeadv(uint32_t ta_cmd){}; - void set_activation_deactivation_scell(uint32_t cmd) { scell_cmd = cmd; }; + void set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) override { scell_cmd = cmd; }; void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti) { memcpy(rar_payload, grant_payload, SRSLTE_RAR_GRANT_LEN); diff --git a/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h b/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h index 75ef2efc3..a1c7130e3 100644 --- a/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h +++ b/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h @@ -64,7 +64,8 @@ public: // phy_interface_rrc_lte void enable_pregen_signals(bool enable) override; - void set_activation_deactivation_scell(uint32_t cmd) override; + void deactivate_scells() override; + void set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) override; bool set_config(srslte::phy_cfg_t config, uint32_t cc_idx = 0) override; bool set_scell(srslte_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override; void set_config_tdd(srslte_tdd_config_t& tdd_config) override; diff --git a/srsue/test/ttcn3/src/lte_ttcn3_phy.cc b/srsue/test/ttcn3/src/lte_ttcn3_phy.cc index 2d2635e72..7d4be9b47 100644 --- a/srsue/test/ttcn3/src/lte_ttcn3_phy.cc +++ b/srsue/test/ttcn3/src/lte_ttcn3_phy.cc @@ -75,7 +75,12 @@ void lte_ttcn3_phy::enable_pregen_signals(bool enable) log.debug("%s not implemented.\n", __FUNCTION__); } -void lte_ttcn3_phy::set_activation_deactivation_scell(uint32_t cmd) +void lte_ttcn3_phy::deactivate_scells() +{ + log.debug("%s not implemented.\n", __FUNCTION__); +} + +void lte_ttcn3_phy::set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) { log.debug("%s not implemented.\n", __FUNCTION__); } diff --git a/srsue/test/upper/rrc_meas_test.cc b/srsue/test/upper/rrc_meas_test.cc index 55ab6370c..0f7ba8c58 100644 --- a/srsue/test/upper/rrc_meas_test.cc +++ b/srsue/test/upper/rrc_meas_test.cc @@ -51,7 +51,7 @@ public: void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch) override {} bool cell_search() override { return true; } bool cell_is_camping() override { return true; } - void set_activation_deactivation_scell(uint32_t cmd) override {} + void deactivate_scells() override {} bool cell_select(phy_cell_t cell) override { last_selected_cell = cell;