From a587d202521a2382bcbff119f178cf1738ebe68d Mon Sep 17 00:00:00 2001 From: Francisco Date: Wed, 26 May 2021 09:24:47 +0100 Subject: [PATCH] allow specification of subset of valid measurement gap offsets in rr.conf --- .../interfaces/enb_rrc_interface_types.h | 1 + srsenb/hdr/stack/rrc/rrc_cell_cfg.h | 8 +++--- srsenb/rr.conf.example | 1 + srsenb/src/enb_cfg_parser.cc | 8 ++++++ srsenb/src/stack/rrc/rrc_cell_cfg.cc | 26 +++++++++++++++++-- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/lib/include/srsran/interfaces/enb_rrc_interface_types.h b/lib/include/srsran/interfaces/enb_rrc_interface_types.h index 182e52824..6674fc43b 100644 --- a/lib/include/srsran/interfaces/enb_rrc_interface_types.h +++ b/lib/include/srsran/interfaces/enb_rrc_interface_types.h @@ -42,6 +42,7 @@ struct rrc_meas_cfg_t { std::vector meas_reports; asn1::rrc::quant_cfg_eutra_s quant_cfg; uint32_t meas_gap_period; + std::vector meas_gap_offset_subframe; uint32_t allowed_meas_bw; }; diff --git a/srsenb/hdr/stack/rrc/rrc_cell_cfg.h b/srsenb/hdr/stack/rrc/rrc_cell_cfg.h index ba6ecede3..de72d6b9b 100644 --- a/srsenb/hdr/stack/rrc/rrc_cell_cfg.h +++ b/srsenb/hdr/stack/rrc/rrc_cell_cfg.h @@ -73,10 +73,10 @@ public: const static uint32_t N_PUCCH_MAX_PRB = 4; // Maximum number of PRB to use for PUCCH ACK/NACK in CS mode const static uint32_t N_PUCCH_MAX_RES = 3 * SRSRAN_NRE * N_PUCCH_MAX_PRB; - uint32_t next_measgap_offset = 0; - pucch_idx_sched_t sr_sched = {}; - pucch_idx_sched_t cqi_sched = {}; - std::array n_pucch_cs_used = {}; + pucch_idx_sched_t sr_sched = {}; + pucch_idx_sched_t cqi_sched = {}; + std::array n_pucch_cs_used = {}; + std::array meas_gap_alloc_map = {}; }; /** Storage of CQI/SR/PUCCH CS resources across multiple frequencies and for multiple users */ diff --git a/srsenb/rr.conf.example b/srsenb/rr.conf.example index 37db345cd..bdf62cc9a 100644 --- a/srsenb/rr.conf.example +++ b/srsenb/rr.conf.example @@ -62,6 +62,7 @@ cell_list = //ul_earfcn = 21400; ho_active = false; //meas_gap_period = 0; // 0 (inactive), 40 or 80 + //meas_gap_offset_subframe = [6, 12, 18, 24, 30]; // target_pusch_sinr = -1; // target_pucch_sinr = -1; // allowed_meas_bw = 6; diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 4aac6d7b6..3149f0360 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -760,6 +760,14 @@ static int parse_cell_list(all_args_t* args, rrc_cfg_t* rrc_cfg, Setting& root) cell_cfg.root_seq_idx, cellroot, "root_seq_idx", rrc_cfg->sibs[1].sib2().rr_cfg_common.prach_cfg.root_seq_idx); parse_default_field(cell_cfg.initial_dl_cqi, cellroot, "initial_dl_cqi", 5u); parse_default_field(cell_cfg.meas_cfg.meas_gap_period, cellroot, "meas_gap_period", 0u); + if (cellroot.exists("meas_gap_offset_subframe")) { + cell_cfg.meas_cfg.meas_gap_offset_subframe.resize(cellroot["meas_gap_offset_subframe"].getLength()); + for (uint32_t j = 0; j < (uint32_t)cellroot["meas_gap_offset_subframe"].getLength(); ++j) { + cell_cfg.meas_cfg.meas_gap_offset_subframe[j] = (uint32_t)cellroot["meas_gap_offset_subframe"][j]; + srsran_assert(cell_cfg.meas_cfg.meas_gap_offset_subframe[j] < cell_cfg.meas_cfg.meas_gap_period, + "meas gap offsets must be smaller than meas gap period"); + } + } HANDLEPARSERCODE(parse_default_field(cell_cfg.target_pusch_sinr_db, cellroot, "target_pusch_sinr", -1)); HANDLEPARSERCODE(parse_default_field(cell_cfg.target_pucch_sinr_db, cellroot, "target_pucch_sinr", -1)); HANDLEPARSERCODE(parse_default_field(cell_cfg.enable_phr_handling, cellroot, "enable_phr_handling", false)); diff --git a/srsenb/src/stack/rrc/rrc_cell_cfg.cc b/srsenb/src/stack/rrc/rrc_cell_cfg.cc index 770942d4d..096978e1b 100644 --- a/srsenb/src/stack/rrc/rrc_cell_cfg.cc +++ b/srsenb/src/stack/rrc/rrc_cell_cfg.cc @@ -218,6 +218,7 @@ bool ue_cell_ded_list::rem_last_cell() bool ue_cell_ded_list::alloc_cell_resources(uint32_t ue_cc_idx) { + const uint32_t meas_gap_duration = 6; // Allocate CQI, SR, and PUCCH CS resources. If failure, do not add new cell if (ue_cc_idx == UE_PCELL_CC_IDX) { if (not alloc_sr_resources(cfg.sr_cfg.period)) { @@ -226,9 +227,30 @@ bool ue_cell_ded_list::alloc_cell_resources(uint32_t ue_cc_idx) } ue_cell_ded* cell = get_ue_cc_idx(UE_PCELL_CC_IDX); + cell->meas_gap_offset = 0; cell->meas_gap_period = cell->cell_common->cell_cfg.meas_cfg.meas_gap_period; - cell->meas_gap_offset = pucch_res->next_measgap_offset; - pucch_res->next_measgap_offset += 6; + if (cell->meas_gap_period > 0) { + if (not cell->cell_common->cell_cfg.meas_cfg.meas_gap_offset_subframe.empty()) { + // subframes specified + uint32_t min_users = std::numeric_limits::max(); + for (uint32_t i = 0; i < cell->cell_common->cell_cfg.meas_cfg.meas_gap_offset_subframe.size(); ++i) { + uint32_t idx_offset = cell->cell_common->cell_cfg.meas_cfg.meas_gap_offset_subframe[i] / meas_gap_duration; + if (pucch_res->meas_gap_alloc_map[idx_offset] < min_users) { + min_users = pucch_res->meas_gap_alloc_map[idx_offset]; + cell->meas_gap_offset = cell->cell_common->cell_cfg.meas_cfg.meas_gap_offset_subframe[i]; + } + } + } else { + uint32_t min_users = std::numeric_limits::max(); + for (uint32_t meas_offset = 0; meas_offset < cell->cell_common->cell_cfg.meas_cfg.meas_gap_period; + meas_offset += meas_gap_duration) { + if (pucch_res->meas_gap_alloc_map[meas_offset / meas_gap_duration] < min_users) { + min_users = pucch_res->meas_gap_alloc_map[meas_offset / meas_gap_duration]; + cell->meas_gap_offset = meas_offset; + } + } + } + } } else { if (ue_cc_idx == 1 and not n_pucch_cs_present) { // Allocate resources for Format1b CS (will be optional PUCCH3/CS)