From 35c9f02579e7893957239b6bdc53e6e641e77f19 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 1 Nov 2019 14:00:54 +0000 Subject: [PATCH] added quant cfg parsing and addition to measCfg --- lib/include/srslte/asn1/rrc_asn1_utils.h | 2 + lib/src/asn1/rrc_asn1_utils.cc | 45 +++++++++++++-------- srsenb/hdr/stack/rrc/rrc_mobility.h | 2 + srsenb/src/enb_cfg_parser.cc | 50 ++++++++++++------------ srsenb/src/stack/rrc/rrc_mobility.cc | 22 ++++++++++- srsenb/test/upper/rrc_mobility_test.cc | 2 +- 6 files changed, 81 insertions(+), 42 deletions(-) diff --git a/lib/include/srslte/asn1/rrc_asn1_utils.h b/lib/include/srslte/asn1/rrc_asn1_utils.h index 3d7081848..12547dec3 100644 --- a/lib/include/srslte/asn1/rrc_asn1_utils.h +++ b/lib/include/srslte/asn1/rrc_asn1_utils.h @@ -57,6 +57,7 @@ struct report_cfg_eutra_s; struct meas_obj_to_add_mod_s; struct report_cfg_to_add_mod_s; struct meas_id_to_add_mod_s; +struct quant_cfg_s; } // namespace rrc } // namespace asn1 @@ -123,6 +124,7 @@ bool operator==(const asn1::rrc::meas_obj_to_add_mod_s& lhs, const asn1::rrc::me bool operator==(const asn1::rrc::report_cfg_eutra_s& lhs, const asn1::rrc::report_cfg_eutra_s& rhs); bool operator==(const asn1::rrc::report_cfg_to_add_mod_s& lhs, const asn1::rrc::report_cfg_to_add_mod_s& rhs); bool operator==(const asn1::rrc::meas_id_to_add_mod_s& lhs, const asn1::rrc::meas_id_to_add_mod_s& rhs); +bool operator==(const asn1::rrc::quant_cfg_s& lhs, const asn1::rrc::quant_cfg_s& rhs); } // namespace rrc } // namespace asn1 diff --git a/lib/src/asn1/rrc_asn1_utils.cc b/lib/src/asn1/rrc_asn1_utils.cc index 2268d0777..5819c8460 100644 --- a/lib/src/asn1/rrc_asn1_utils.cc +++ b/lib/src/asn1/rrc_asn1_utils.cc @@ -180,7 +180,6 @@ void to_asn1(asn1::rrc::rlc_cfg_c* asn1_type, const srslte::rlc_config_t& cfg) // stays TM break; } - } /*************************** @@ -398,13 +397,13 @@ void set_phy_cfg_t_dedicated_cfg(phy_cfg_t* cfg, const asn1::rrc::phys_cfg_ded_s if (asn1_type.srs_ul_cfg_ded_present) { cfg->ul_cfg.srs.dedicated_enabled = asn1_type.srs_ul_cfg_ded.type() == asn1::rrc::setup_e::setup; if (cfg->ul_cfg.srs.dedicated_enabled) { - cfg->ul_cfg.srs.configured = cfg->ul_cfg.srs.dedicated_enabled and cfg->ul_cfg.srs.common_enabled; - cfg->ul_cfg.srs.I_srs = asn1_type.srs_ul_cfg_ded.setup().srs_cfg_idx; - cfg->ul_cfg.srs.B = asn1_type.srs_ul_cfg_ded.setup().srs_bw; - cfg->ul_cfg.srs.b_hop = asn1_type.srs_ul_cfg_ded.setup().srs_hop_bw; - cfg->ul_cfg.srs.n_rrc = asn1_type.srs_ul_cfg_ded.setup().freq_domain_position; - cfg->ul_cfg.srs.k_tc = asn1_type.srs_ul_cfg_ded.setup().tx_comb; - cfg->ul_cfg.srs.n_srs = asn1_type.srs_ul_cfg_ded.setup().cyclic_shift; + cfg->ul_cfg.srs.configured = cfg->ul_cfg.srs.dedicated_enabled and cfg->ul_cfg.srs.common_enabled; + cfg->ul_cfg.srs.I_srs = asn1_type.srs_ul_cfg_ded.setup().srs_cfg_idx; + cfg->ul_cfg.srs.B = asn1_type.srs_ul_cfg_ded.setup().srs_bw; + cfg->ul_cfg.srs.b_hop = asn1_type.srs_ul_cfg_ded.setup().srs_hop_bw; + cfg->ul_cfg.srs.n_rrc = asn1_type.srs_ul_cfg_ded.setup().freq_domain_position; + cfg->ul_cfg.srs.k_tc = asn1_type.srs_ul_cfg_ded.setup().tx_comb; + cfg->ul_cfg.srs.n_srs = asn1_type.srs_ul_cfg_ded.setup().cyclic_shift; } } @@ -508,7 +507,7 @@ void set_phy_cfg_t_common_pucch(phy_cfg_t* cfg, const asn1::rrc::pucch_cfg_commo void set_phy_cfg_t_common_srs(phy_cfg_t* cfg, const asn1::rrc::srs_ul_cfg_common_c& asn1_type) { - cfg->ul_cfg.srs.common_enabled = asn1_type.type() == asn1::rrc::setup_e::setup; + cfg->ul_cfg.srs.common_enabled = asn1_type.type() == asn1::rrc::setup_e::setup; if (cfg->ul_cfg.srs.common_enabled) { cfg->ul_cfg.srs.simul_ack = asn1_type.setup().ack_nack_srs_simul_tx; cfg->ul_cfg.srs.bw_cfg = asn1_type.setup().srs_bw_cfg.to_number(); @@ -662,14 +661,14 @@ void set_phy_cfg_t_scell_config(phy_cfg_t* cfg, const asn1::rrc::scell_to_add_mo if (ul_cfg_r10->srs_ul_cfg_ded_r10_present) { cfg->ul_cfg.srs.dedicated_enabled = ul_cfg_r10->srs_ul_cfg_ded_r10.type() == asn1::rrc::setup_e::setup; if (cfg->ul_cfg.srs.dedicated_enabled) { - auto* srs_ul_cfg_ded_r10 = &ul_cfg_r10->srs_ul_cfg_ded_r10.setup(); + auto* srs_ul_cfg_ded_r10 = &ul_cfg_r10->srs_ul_cfg_ded_r10.setup(); cfg->ul_cfg.srs.configured = cfg->ul_cfg.srs.dedicated_enabled and cfg->ul_cfg.srs.common_enabled; - cfg->ul_cfg.srs.I_srs = srs_ul_cfg_ded_r10->srs_cfg_idx; - cfg->ul_cfg.srs.B = srs_ul_cfg_ded_r10->srs_bw; - cfg->ul_cfg.srs.b_hop = srs_ul_cfg_ded_r10->srs_hop_bw; - cfg->ul_cfg.srs.n_rrc = srs_ul_cfg_ded_r10->freq_domain_position; - cfg->ul_cfg.srs.k_tc = srs_ul_cfg_ded_r10->tx_comb; - cfg->ul_cfg.srs.n_srs = srs_ul_cfg_ded_r10->cyclic_shift; + cfg->ul_cfg.srs.I_srs = srs_ul_cfg_ded_r10->srs_cfg_idx; + cfg->ul_cfg.srs.B = srs_ul_cfg_ded_r10->srs_bw; + cfg->ul_cfg.srs.b_hop = srs_ul_cfg_ded_r10->srs_hop_bw; + cfg->ul_cfg.srs.n_rrc = srs_ul_cfg_ded_r10->freq_domain_position; + cfg->ul_cfg.srs.k_tc = srs_ul_cfg_ded_r10->tx_comb; + cfg->ul_cfg.srs.n_srs = srs_ul_cfg_ded_r10->cyclic_shift; } } } @@ -874,5 +873,19 @@ bool operator==(const meas_id_to_add_mod_s& lhs, const meas_id_to_add_mod_s& rhs return lhs.meas_id == rhs.meas_id and lhs.meas_obj_id == rhs.meas_obj_id and lhs.report_cfg_id == rhs.report_cfg_id; } +bool operator==(const asn1::rrc::quant_cfg_s& lhs, const asn1::rrc::quant_cfg_s& rhs) +{ + if (lhs.ext or lhs.quant_cfg_geran_present or lhs.quant_cfg_utra_present or lhs.quant_cfg_cdma2000_present or + rhs.ext or rhs.quant_cfg_geran_present or rhs.quant_cfg_utra_present or rhs.quant_cfg_cdma2000_present) { + printf("[%d] quantCfg properties not supported\n", __LINE__); + return false; + } + return lhs.quant_cfg_eutra_present == rhs.quant_cfg_eutra_present and + lhs.quant_cfg_eutra.filt_coef_rsrp_present == rhs.quant_cfg_eutra.filt_coef_rsrp_present and + lhs.quant_cfg_eutra.filt_coef_rsrp == rhs.quant_cfg_eutra.filt_coef_rsrp and + lhs.quant_cfg_eutra.filt_coef_rsrq_present == rhs.quant_cfg_eutra.filt_coef_rsrq_present and + lhs.quant_cfg_eutra.filt_coef_rsrq == rhs.quant_cfg_eutra.filt_coef_rsrq; +} + } // namespace rrc } // namespace asn1 diff --git a/srsenb/hdr/stack/rrc/rrc_mobility.h b/srsenb/hdr/stack/rrc/rrc_mobility.h index 894e5c740..387fdf7c0 100644 --- a/srsenb/hdr/stack/rrc/rrc_mobility.h +++ b/srsenb/hdr/stack/rrc/rrc_mobility.h @@ -43,6 +43,7 @@ public: std::tuple add_cell_cfg(const meas_cell_cfg_t& cellcfg); report_cfg_t* add_report_cfg(const asn1::rrc::report_cfg_eutra_s& reportcfg); meas_id_t* add_measid_cfg(uint8_t measobjid, uint8_t repid); + asn1::rrc::quant_cfg_s* add_quant_cfg(const asn1::rrc::quant_cfg_eutra_s& quantcfg); bool compute_diff_meas_cfg(const var_meas_cfg_t& target_cfg, asn1::rrc::meas_cfg_s* meas_cfg) const; void compute_diff_meas_objs(const var_meas_cfg_t& target_cfg, asn1::rrc::meas_cfg_s* meas_cfg) const; @@ -51,6 +52,7 @@ public: asn1::rrc::meas_obj_to_add_mod_s* added_obj) const; void compute_diff_report_cfgs(const var_meas_cfg_t& target_cfg, asn1::rrc::meas_cfg_s* meas_cfg) const; void compute_diff_meas_ids(const var_meas_cfg_t& target_cfg, asn1::rrc::meas_cfg_s* meas_cfg) const; + void compute_diff_quant_cfg(const var_meas_cfg_t& target_cfg, asn1::rrc::meas_cfg_s* meas_cfg_msg) const; // getters const asn1::rrc::meas_obj_to_add_mod_list_l& meas_objs() const { return var_meas.meas_obj_list; } diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 09cdeaf15..0fabcc1a6 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -26,10 +26,12 @@ #include "srslte/srslte.h" #define HANDLEPARSERCODE(cond) \ - if ((cond) != 0) { \ - printf("[%d][%s()] Parser Error detected\n", __LINE__, __FUNCTION__); \ - return -1; \ - } + do { \ + if ((cond) != 0) { \ + printf("[%d][%s()] Parser Error detected\n", __LINE__, __FUNCTION__); \ + return -1; \ + } \ + } while (0) using namespace asn1::rrc; @@ -148,17 +150,17 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root) int cell_resel_prio; if (root[i].lookupValue("cell_resel_prio", cell_resel_prio)) { data->carrier_freqs_info_list[i].common_info.cell_resel_prio_present = true; - data->carrier_freqs_info_list[i].common_info.cell_resel_prio = cell_resel_prio; + data->carrier_freqs_info_list[i].common_info.cell_resel_prio = cell_resel_prio; } int p_max_geran; if (root[i].lookupValue("p_max_geran", p_max_geran)) { data->carrier_freqs_info_list[i].common_info.p_max_geran_present = true; - data->carrier_freqs_info_list[i].common_info.p_max_geran = p_max_geran; + data->carrier_freqs_info_list[i].common_info.p_max_geran = p_max_geran; } - field_asn1_bitstring_number, uint8_t> ncc_permitted("ncc_permitted", - &data->carrier_freqs_info_list[i].common_info.ncc_permitted); + field_asn1_bitstring_number, uint8_t> ncc_permitted( + "ncc_permitted", &data->carrier_freqs_info_list[i].common_info.ncc_permitted); if (ncc_permitted.parse(root[i])) { ERROR("Error parsing `ncc_permitted` in carrier_freqs_info_lsit=%d\n", i); return -1; @@ -191,7 +193,7 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root) } field_asn1_enum_str band_ind("band_ind", - &data->carrier_freqs_info_list[i].carrier_freqs.band_ind); + &data->carrier_freqs_info_list[i].carrier_freqs.band_ind); if (band_ind.parse(root[i])) { ERROR("Error parsing `band_ind` in carrier_freqs_info_list=%d\n", i); return -1; @@ -199,14 +201,14 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root) data->carrier_freqs_info_list[i].carrier_freqs.following_arfcns.set_explicit_list_of_arfcns(); - explicit_list_of_arfcns_l &exp_l = - data->carrier_freqs_info_list[i].carrier_freqs.following_arfcns.explicit_list_of_arfcns(); + explicit_list_of_arfcns_l& exp_l = + data->carrier_freqs_info_list[i].carrier_freqs.following_arfcns.explicit_list_of_arfcns(); if (root[i].exists("explicit_list_of_arfcns")) { exp_l.resize((uint32_t)root[i]["explicit_list_of_arfcns"].getLength()); if (exp_l.size() < 31) { /* SEQUENCE (SIZE (0..31)) OF ARFCN-ValueGERAN */ for (uint32_t j = 0; j < exp_l.size(); j++) { int arfcn = root[i]["explicit_list_of_arfcns"][j]; - if (arfcn >= 0 && arfcn <= 1024) { + if (arfcn >= 0 && arfcn <= 1024) { exp_l[j] = (short unsigned int)arfcn; } else { fprintf(stderr, "Invalid ARFCN %d in for carrier_freqs_info_list=%d explicit_list_of_arfcns\n", i, j); @@ -220,12 +222,10 @@ int field_carrier_freqs_info_list::parse(libconfig::Setting& root) } else { exp_l.resize(0); } - } return 0; } - int enb::parse_sib1(std::string filename, sib_type1_s* data) { parser::section sib1("sib1"); @@ -288,8 +288,8 @@ int mbsfn_sf_cfg_list_parser::parse(Setting& root) *enabled = true; mbsfn_list->resize(len); - field_asn1_choice_number c("subframeAllocation", "subframeAllocationNumFrames", - &extract_sf_alloc, &(*mbsfn_list)[0].sf_alloc); + field_asn1_choice_number c( + "subframeAllocation", "subframeAllocationNumFrames", &extract_sf_alloc, &(*mbsfn_list)[0].sf_alloc); c.parse(root["mbsfnSubframeConfigList"]); parser::field f("radioframeAllocationOffset", &(*mbsfn_list)[0].radioframe_alloc_offset); @@ -521,8 +521,8 @@ int enb::parse_sib3(std::string filename, sib_type3_s* data) sib3.add_subsection(&resel_serving); sib_type3_s::cell_resel_serving_freq_info_s_* freqinfo = &data->cell_resel_serving_freq_info; - resel_serving.add_field(new parser::field("s_non_intra_search", &freqinfo->s_non_intra_search, - &freqinfo->s_non_intra_search_present)); + resel_serving.add_field(new parser::field( + "s_non_intra_search", &freqinfo->s_non_intra_search, &freqinfo->s_non_intra_search_present)); resel_serving.add_field(new parser::field("thresh_serving_low", &freqinfo->thresh_serving_low)); resel_serving.add_field(new parser::field("cell_resel_prio", &freqinfo->cell_resel_prio)); @@ -535,8 +535,8 @@ int enb::parse_sib3(std::string filename, sib_type3_s* data) intra_freq.add_field(new parser::field("p_max", &intrafreq->p_max, &intrafreq->p_max_present)); intra_freq.add_field( new parser::field("s_intra_search", &intrafreq->s_intra_search, &intrafreq->s_intra_search_present)); - intra_freq.add_field(make_asn1_enum_number_parser("allowed_meas_bw", &intrafreq->allowed_meas_bw, - &intrafreq->allowed_meas_bw_present)); + intra_freq.add_field(make_asn1_enum_number_parser( + "allowed_meas_bw", &intrafreq->allowed_meas_bw, &intrafreq->allowed_meas_bw_present)); intra_freq.add_field(new parser::field("presence_ant_port_1", &intrafreq->presence_ant_port1)); intra_freq.add_field(make_asn1_bitstring_number_parser("neigh_cell_cnfg", &intrafreq->neigh_cell_cfg)); intra_freq.add_field(new parser::field("t_resel_eutra", &intrafreq->t_resel_eutra)); @@ -853,11 +853,13 @@ int enb::parse_rr(all_args_t* args, rrc_cfg_t* rrc_cfg) return SRSLTE_ERROR; } else if (args->enb.transmission_mode == 1 && args->enb.nof_ports > 1) { ERROR("Invalid number of ports (%d) for transmission mode (%d). Only one antenna port is allowed.\n", - args->enb.nof_ports, args->enb.transmission_mode); + args->enb.nof_ports, + args->enb.transmission_mode); return SRSLTE_ERROR; } else if (args->enb.transmission_mode > 1 && args->enb.nof_ports != 2) { ERROR("The selected number of ports (%d) are insufficient for the selected transmission mode (%d).\n", - args->enb.nof_ports, args->enb.transmission_mode); + args->enb.nof_ports, + args->enb.transmission_mode); return SRSLTE_ERROR; } @@ -908,8 +910,8 @@ int enb::parse_rr(all_args_t* args, rrc_cfg_t* rrc_cfg) mac_cnfg.add_subsection(&ulsch_cnfg); rrc_cfg->mac_cnfg.ul_sch_cfg.tti_bundling = false; - ulsch_cnfg.add_field(make_asn1_enum_number_parser("max_harq_tx", &rrc_cfg->mac_cnfg.ul_sch_cfg.max_harq_tx, - &rrc_cfg->mac_cnfg.ul_sch_cfg.max_harq_tx_present)); + ulsch_cnfg.add_field(make_asn1_enum_number_parser( + "max_harq_tx", &rrc_cfg->mac_cnfg.ul_sch_cfg.max_harq_tx, &rrc_cfg->mac_cnfg.ul_sch_cfg.max_harq_tx_present)); ulsch_cnfg.add_field(make_asn1_enum_number_parser("periodic_bsr_timer", &rrc_cfg->mac_cnfg.ul_sch_cfg.periodic_bsr_timer, &rrc_cfg->mac_cnfg.ul_sch_cfg.periodic_bsr_timer_present)); diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 4e8e783c9..00cc16c25 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -341,6 +341,14 @@ meas_id_to_add_mod_s* var_meas_cfg_t::add_measid_cfg(uint8_t measobjid, uint8_t return std::lower_bound(var_meas.meas_id_list.begin(), var_meas.meas_id_list.end(), new_measid.meas_id, cmp); } +asn1::rrc::quant_cfg_s* var_meas_cfg_t::add_quant_cfg(const asn1::rrc::quant_cfg_eutra_s& quantcfg) +{ + var_meas.quant_cfg_present = true; + var_meas.quant_cfg.quant_cfg_eutra_present = true; + var_meas.quant_cfg.quant_cfg_eutra = quantcfg; + return &var_meas.quant_cfg; +} + bool var_meas_cfg_t::compute_diff_meas_cfg(const var_meas_cfg_t& target_cfg, asn1::rrc::meas_cfg_s* meas_cfg) const { *meas_cfg = {}; @@ -349,7 +357,7 @@ bool var_meas_cfg_t::compute_diff_meas_cfg(const var_meas_cfg_t& target_cfg, asn compute_diff_meas_objs(target_cfg, meas_cfg); compute_diff_report_cfgs(target_cfg, meas_cfg); compute_diff_meas_ids(target_cfg, meas_cfg); - // deltaconfig_meas_quantity_config(target_cfg, meas_cfg); + compute_diff_quant_cfg(target_cfg, meas_cfg); meas_cfg->meas_gap_cfg_present = false; // NOTE: we do not support inter-freq. HO meas_cfg->s_measure_present = false; // NOTE: We do not support SCells meas_cfg->pre_regist_info_hrpd_present = false; // NOTE: not supported @@ -526,6 +534,15 @@ void var_meas_cfg_t::compute_diff_meas_ids(const var_meas_cfg_t& target_cfg, asn } } +void var_meas_cfg_t::compute_diff_quant_cfg(const var_meas_cfg_t& target_cfg, asn1::rrc::meas_cfg_s* meas_cfg_msg) const +{ + if (target_cfg.var_meas.quant_cfg_present and + (not var_meas.quant_cfg_present or not(target_cfg.var_meas.quant_cfg == var_meas.quant_cfg))) { + meas_cfg_msg->quant_cfg_present = true; + meas_cfg_msg->quant_cfg = target_cfg.var_meas.quant_cfg; + } +} + /************************************************************************************************* * mobility_cfg class ************************************************************************************************/ @@ -552,6 +569,9 @@ rrc::mobility_cfg::mobility_cfg(const rrc_cfg_t* cfg_, srslte::log* log_) : cfg( var_meas.add_measid_cfg(measobj.meas_obj_id, var_meas.rep_cfgs().begin()->report_cfg_id); } } + + // insert quantity config + var_meas.add_quant_cfg(cfg->meas_cfg.quant_cfg); } current_meas_cfg = std::make_shared(var_meas); diff --git a/srsenb/test/upper/rrc_mobility_test.cc b/srsenb/test/upper/rrc_mobility_test.cc index d52b4509f..ce41932c4 100644 --- a/srsenb/test/upper/rrc_mobility_test.cc +++ b/srsenb/test/upper/rrc_mobility_test.cc @@ -303,7 +303,7 @@ int test_mobility_class() srsenb::rrc rrc; mac_dummy mac; - rrc.init(&cfg, nullptr, &mac, nullptr, nullptr, nullptr, nullptr, &log_h); + // rrc.init(&cfg, nullptr, &mac, nullptr, nullptr, nullptr, nullptr, &log_h); return SRSLTE_SUCCESS; }