From 42b15c7bedc4c78b1c055e8e1fdde887e15ce4c3 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 6 Feb 2020 17:57:26 +0000 Subject: [PATCH] use common ue_cfg interface to set the ue antenna info --- lib/include/srslte/interfaces/enb_interfaces.h | 1 - lib/include/srslte/interfaces/sched_interface.h | 7 ++++--- srsenb/hdr/stack/mac/mac.h | 2 -- srsenb/hdr/stack/mac/scheduler.h | 1 - srsenb/src/stack/mac/mac.cc | 14 -------------- srsenb/src/stack/mac/scheduler.cc | 5 ----- srsenb/src/stack/mac/scheduler_carrier.cc | 6 +++--- srsenb/src/stack/mac/scheduler_grid.cc | 5 ++--- srsenb/src/stack/mac/scheduler_ue.cc | 10 ++-------- srsenb/src/stack/rrc/rrc.cc | 5 +++-- srsenb/test/common/dummy_classes.h | 1 - srsenb/test/mac/scheduler_test_rand.cc | 4 +++- 12 files changed, 17 insertions(+), 44 deletions(-) diff --git a/lib/include/srslte/interfaces/enb_interfaces.h b/lib/include/srslte/interfaces/enb_interfaces.h index 16eae54ab..642ae16c1 100644 --- a/lib/include/srslte/interfaces/enb_interfaces.h +++ b/lib/include/srslte/interfaces/enb_interfaces.h @@ -144,7 +144,6 @@ public: /* Manages UE bearers and associated configuration */ virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) = 0; virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0; - virtual int set_dl_ant_info(uint16_t rnti, const sched_interface::ant_info_ded_t& dl_ant_info) = 0; virtual void phy_config_enabled(uint16_t rnti, bool enabled) = 0; virtual void write_mcch(asn1::rrc::sib_type2_s* sib2, asn1::rrc::sib_type13_r9_s* sib13, asn1::rrc::mcch_msg_s* mcch) = 0; diff --git a/lib/include/srslte/interfaces/sched_interface.h b/lib/include/srslte/interfaces/sched_interface.h index d527698b8..e7d431947 100644 --- a/lib/include/srslte/interfaces/sched_interface.h +++ b/lib/include/srslte/interfaces/sched_interface.h @@ -110,7 +110,7 @@ public: }; struct ant_info_ded_t { - enum class tx_mode_t { tm1, tm2, tm3, tm4, tm5, tm6, tm7, tm8_v920, nulltype } tx_mode; + enum class tx_mode_t { tm1, tm2, tm3, tm4, tm5, tm6, tm7, tm8_v920, nulltype } tx_mode = tx_mode_t::tm1; enum class codebook_t { n2_tx_ant_tm3, n4_tx_ant_tm3, @@ -121,9 +121,9 @@ public: n2_tx_ant_tm6, n4_tx_ant_tm6, none - } cookbook_subset_type; + } cookbook_subset_type = codebook_t::none; uint64_t codebook_subset_restrict; - enum class ue_tx_ant_sel_t { release, closed_loop, open_loop } ue_tx_ant_sel; + enum class ue_tx_ant_sel_t { release, closed_loop, open_loop } ue_tx_ant_sel = ue_tx_ant_sel_t::release; }; struct ue_cfg_t { @@ -136,6 +136,7 @@ public: srslte_dl_cfg_t dl_cfg; std::array ue_bearers = {}; std::vector supported_cc_idxs; + ant_info_ded_t dl_ant_info; }; typedef struct { diff --git a/srsenb/hdr/stack/mac/mac.h b/srsenb/hdr/stack/mac/mac.h index 664470e29..0c6857ae2 100644 --- a/srsenb/hdr/stack/mac/mac.h +++ b/srsenb/hdr/stack/mac/mac.h @@ -56,8 +56,6 @@ public: int sr_detected(uint32_t tti, uint16_t rnti) final; int rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv) final; - int set_dl_ant_info(uint16_t rnti, const sched_interface::ant_info_ded_t& dl_ant_info) override; - int ri_info(uint32_t tti, uint16_t rnti, uint32_t ri_value); int pmi_info(uint32_t tti, uint16_t rnti, uint32_t pmi_value); int cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value); diff --git a/srsenb/hdr/stack/mac/scheduler.h b/srsenb/hdr/stack/mac/scheduler.h index bf4166dda..d95d9324c 100644 --- a/srsenb/hdr/stack/mac/scheduler.h +++ b/srsenb/hdr/stack/mac/scheduler.h @@ -144,7 +144,6 @@ public: int dl_rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) final; int dl_mac_buffer_state(uint16_t rnti, uint32_t ce_code) final; - int dl_ant_info(uint16_t rnti, const sched_interface::ant_info_ded_t& ant_info); int dl_ack_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t tb_idx, bool ack) final; int dl_rach_info(uint32_t cc_idx, dl_sched_rar_info_t rar_info) final; int dl_ri_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t ri_value) final; diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index adcdde529..85fdb1fcf 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -352,20 +352,6 @@ int mac::crc_info(uint32_t tti, uint16_t rnti, uint32_t nof_bytes, bool crc) return ret; } -int mac::set_dl_ant_info(uint16_t rnti, const sched_interface::ant_info_ded_t& dl_ant_info) -{ - int ret = -1; - pthread_rwlock_rdlock(&rwlock); - if (ue_db.count(rnti)) { - scheduler.dl_ant_info(rnti, dl_ant_info); - ret = 0; - } else { - Error("User rnti=0x%x not found\n", rnti); - } - pthread_rwlock_unlock(&rwlock); - return ret; -} - int mac::ri_info(uint32_t tti, uint16_t rnti, uint32_t ri_value) { // TODO: add cc_idx to interface diff --git a/srsenb/src/stack/mac/scheduler.cc b/srsenb/src/stack/mac/scheduler.cc index 967a803bb..6a6fa87fb 100644 --- a/srsenb/src/stack/mac/scheduler.cc +++ b/srsenb/src/stack/mac/scheduler.cc @@ -292,11 +292,6 @@ int sched::dl_mac_buffer_state(uint16_t rnti, uint32_t ce_code) return ue_db_access(rnti, [ce_code](sched_ue& ue) { ue.mac_buffer_state(ce_code); }); } -int sched::dl_ant_info(uint16_t rnti, const sched_interface::ant_info_ded_t& ant_info) -{ - return ue_db_access(rnti, [ant_info](sched_ue& ue) { ue.set_dl_ant_info(ant_info); }); -} - int sched::dl_ack_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t tb_idx, bool ack) { int ret = -1; diff --git a/srsenb/src/stack/mac/scheduler_carrier.cc b/srsenb/src/stack/mac/scheduler_carrier.cc index 68563e6c5..d6f10c342 100644 --- a/srsenb/src/stack/mac/scheduler_carrier.cc +++ b/srsenb/src/stack/mac/scheduler_carrier.cc @@ -417,9 +417,9 @@ void sched::carrier_sched::generate_phich(sf_sched* tti_sched) tti_sched->ul_sched_result.phich[nof_phich_elems].phich = h->get_pending_ack() ? ul_sched_phich_t::ACK : ul_sched_phich_t::NACK; tti_sched->ul_sched_result.phich[nof_phich_elems].rnti = rnti; - log_h->debug("SCHED: Allocated PHICH for rnti=0x%x, value=%d\n", - rnti, - tti_sched->ul_sched_result.phich[nof_phich_elems].phich); + log_h->info("SCHED: Allocated PHICH for rnti=0x%x, value=%s\n", + rnti, + tti_sched->ul_sched_result.phich[nof_phich_elems].phich == ul_sched_phich_t::ACK ? "ACK" : "NACK"); nof_phich_elems++; } } diff --git a/srsenb/src/stack/mac/scheduler_grid.cc b/srsenb/src/stack/mac/scheduler_grid.cc index 589a00f06..156f220ca 100644 --- a/srsenb/src/stack/mac/scheduler_grid.cc +++ b/srsenb/src/stack/mac/scheduler_grid.cc @@ -782,7 +782,7 @@ void sf_sched::set_dl_data_sched_result(const pdcch_grid_t::alloc_result_t& dci_ } if (tbs <= 0) { - log_h->warning("SCHED: Error DL %s rnti=0x%x, pid=%d, mask=%s, tbs=%d, buffer=%d\n", + log_h->warning("SCHED: sched_cell_params[CARRIER_IDX].cfg %s rnti=0x%x, pid=%d, mask=%s, tbs=%d, buffer=%d\n", is_newtx ? "tx" : "retx", user->get_rnti(), h->get_id(), @@ -833,7 +833,7 @@ void sf_sched::set_ul_sched_result(const pdcch_grid_t::alloc_result_t& dci_resul ul_harq_proc* h = user->get_ul_harq(get_tti_tx_ul(), cell_index); if (tbs <= 0) { - log_h->warning("SCHED: Error %s %s rnti=0x%x, pid=%d, dci=(%d,%d), prb=(%d,%d), tbs=%d, bsr=%d\n", + log_h->warning("SCHED: Error %s %s rnti=0x%x, pid=%d, dci=(%d,%d), prb=(%d,%d), bsr=%d\n", ul_alloc.type == ul_alloc_t::MSG3 ? "Msg3" : "UL", ul_alloc.is_retx() ? "retx" : "tx", user->get_rnti(), @@ -842,7 +842,6 @@ void sf_sched::set_ul_sched_result(const pdcch_grid_t::alloc_result_t& dci_resul pusch->dci.location.ncce, ul_alloc.alloc.RB_start, ul_alloc.alloc.RB_start + ul_alloc.alloc.L, - tbs, user->get_pending_ul_new_data(get_tti_tx_ul())); continue; } diff --git a/srsenb/src/stack/mac/scheduler_ue.cc b/srsenb/src/stack/mac/scheduler_ue.cc index b27873b3e..ba4593664 100644 --- a/srsenb/src/stack/mac/scheduler_ue.cc +++ b/srsenb/src/stack/mac/scheduler_ue.cc @@ -320,12 +320,6 @@ void sched_ue::set_dl_cqi(uint32_t tti, uint32_t cc_idx, uint32_t cqi) carriers[cc_idx].dl_cqi_tti = tti; } -void sched_ue::set_dl_ant_info(const sched_interface::ant_info_ded_t& ant_info) -{ - std::lock_guard lock(mutex); - dl_ant_info = ant_info; -} - void sched_ue::set_ul_cqi(uint32_t tti, uint32_t cc_idx, uint32_t cqi, uint32_t ul_ch_code) { std::lock_guard lock(mutex); @@ -960,7 +954,7 @@ srslte_dci_format_t sched_ue::get_dci_format() if (phy_config_dedicated_enabled) { /* TODO: Assumes UE-Specific Search Space (Not common) */ - switch (dl_ant_info.tx_mode) { + switch (cfg.dl_ant_info.tx_mode) { case sched_interface::ant_info_ded_t::tx_mode_t::tm1: case sched_interface::ant_info_ded_t::tx_mode_t::tm2: ret = SRSLTE_DCI_FORMAT1; @@ -976,7 +970,7 @@ srslte_dci_format_t sched_ue::get_dci_format() case sched_interface::ant_info_ded_t::tx_mode_t::tm7: case sched_interface::ant_info_ded_t::tx_mode_t::tm8_v920: default: - Warning("Incorrect transmission mode (rnti=%04x; tm=%d)\n", rnti, static_cast(dl_ant_info.tx_mode)); + Warning("Incorrect transmission mode (rnti=%04x; tm=%d)\n", rnti, static_cast(cfg.dl_ant_info.tx_mode)); } } diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index c0c660362..1659d3c79 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -1613,6 +1613,7 @@ void rrc::ue::send_connection_setup(bool is_setup) current_sched_ue_cfg.pucch_cfg.N_cs = parent->sib2.rr_cfg_common.pucch_cfg_common.ncs_an; current_sched_ue_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_cfg_common.pucch_cfg_common.nrb_cqi; current_sched_ue_cfg.pucch_cfg.N_pucch_1 = parent->sib2.rr_cfg_common.pucch_cfg_common.n1_pucch_an; + current_sched_ue_cfg.dl_ant_info = srslte::make_ant_info_ded(phy_cfg->ant_info.explicit_value()); // Configure MAC parent->mac->ue_cfg(rnti, ¤t_sched_ue_cfg); @@ -1625,7 +1626,6 @@ void rrc::ue::send_connection_setup(bool is_setup) // Configure PHY layer parent->phy->set_config_dedicated(rnti, phy_cfg); - parent->mac->set_dl_ant_info(rnti, srslte::make_ant_info_ded(phy_cfg->ant_info.explicit_value())); parent->mac->phy_config_enabled(rnti, false); rr_cfg->drb_to_add_mod_list_present = false; @@ -1798,7 +1798,8 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) phy_cfg->pdsch_cfg_ded.p_a = parent->cfg.pdsch_cfg; parent->phy->set_config_dedicated(rnti, phy_cfg); - parent->mac->set_dl_ant_info(rnti, srslte::make_ant_info_ded(phy_cfg->ant_info.explicit_value())); + current_sched_ue_cfg.dl_ant_info = srslte::make_ant_info_ded(phy_cfg->ant_info.explicit_value()); + parent->mac->ue_cfg(rnti, ¤t_sched_ue_cfg); parent->mac->phy_config_enabled(rnti, false); // Add SRB2 to the message diff --git a/srsenb/test/common/dummy_classes.h b/srsenb/test/common/dummy_classes.h index 2fb5d266c..7a95d1c36 100644 --- a/srsenb/test/common/dummy_classes.h +++ b/srsenb/test/common/dummy_classes.h @@ -35,7 +35,6 @@ public: int ue_rem(uint16_t rnti) override { return 0; } int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) override { return 0; } int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) override { return 0; } - int set_dl_ant_info(uint16_t rnti, const sched_interface::ant_info_ded_t& dl_ant_info) override { return 0; } void phy_config_enabled(uint16_t rnti, bool enabled) override {} void write_mcch(asn1::rrc::sib_type2_s* sib2, asn1::rrc::sib_type13_r9_s* sib13, asn1::rrc::mcch_msg_s* mcch) override { diff --git a/srsenb/test/mac/scheduler_test_rand.cc b/srsenb/test/mac/scheduler_test_rand.cc index cb30c865c..9e366cdc1 100644 --- a/srsenb/test/mac/scheduler_test_rand.cc +++ b/srsenb/test/mac/scheduler_test_rand.cc @@ -72,6 +72,7 @@ **************************/ uint32_t const seed = time(nullptr); // uint32_t const seed = 2452071795; // [{3054, 1656}, {5970, 1595}, ... {204, 3}] +// uint32_t const seed = 1581009287; // prb==25 std::default_random_engine rand_gen(seed); std::uniform_real_distribution unif_dist(0, 1.0); bool check_old_pids = false; @@ -585,7 +586,8 @@ int sched_tester::test_tti_result() auto* tti_alloc = carrier_schedulers[0]->get_sf_sched_ptr(tti_data.tti_rx); if (tti_data.used_cce != tti_alloc->get_pdcch_mask()) { std::string mask_str = tti_alloc->get_pdcch_mask().to_string(); - TESTERROR("[TESTER] The used_cce do not match: (%s!=%s)\n", mask_str.c_str(), tti_data.used_cce.to_hex().c_str()); + TESTERROR( + "[TESTER] The used_cce do not match: (%s!=%s)\n", mask_str.c_str(), tti_data.used_cce.to_string().c_str()); } // TODO: Check postponed retxs