nr,gnb,rrc: consistent generation of search spaces 0 and 1 in phy and asn1

This commit is contained in:
Francisco 2021-11-17 13:11:10 +00:00 committed by Francisco Paisana
parent aa979708a0
commit e78c375075
3 changed files with 88 additions and 54 deletions

View File

@ -21,6 +21,9 @@ namespace srsenb {
using rlc_bearer_list_t = asn1::rrc_nr::cell_group_cfg_s::rlc_bearer_to_add_mod_list_l_;
// PHY helpers
void set_search_space_from_phy_cfg(const srsran_search_space_t& ss, asn1::rrc_nr::search_space_s& out);
// NSA helpers
int fill_sp_cell_cfg_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, asn1::rrc_nr::sp_cell_cfg_s& sp_cell);

View File

@ -31,6 +31,41 @@ srslog::basic_logger& get_logger(const rrc_nr_cfg_t& cfg)
return log_obj;
}
void set_search_space_from_phy_cfg(const srsran_search_space_t& cfg, asn1::rrc_nr::search_space_s& out)
{
out.search_space_id = cfg.id;
out.ctrl_res_set_id_present = true;
out.ctrl_res_set_id = cfg.coreset_id;
out.monitoring_slot_periodicity_and_offset_present = true;
out.monitoring_slot_periodicity_and_offset.set_sl1();
out.dur_present = false; // false for duration=1
out.monitoring_symbols_within_slot_present = true;
out.monitoring_symbols_within_slot.from_number(0b10000000000000);
out.nrof_candidates_present = true;
bool ret = asn1::number_to_enum(out.nrof_candidates.aggregation_level1, cfg.nof_candidates[0]);
srsran_assert(ret, "Failed to convert nof candidates=%d", cfg.nof_candidates[0]);
ret = asn1::number_to_enum(out.nrof_candidates.aggregation_level2, cfg.nof_candidates[1]);
srsran_assert(ret, "Failed to convert nof candidates=%d", cfg.nof_candidates[1]);
ret = asn1::number_to_enum(out.nrof_candidates.aggregation_level4, cfg.nof_candidates[2]);
srsran_assert(ret, "Failed to convert nof candidates=%d", cfg.nof_candidates[2]);
ret = asn1::number_to_enum(out.nrof_candidates.aggregation_level8, cfg.nof_candidates[3]);
srsran_assert(ret, "Failed to convert nof candidates=%d", cfg.nof_candidates[3]);
ret = asn1::number_to_enum(out.nrof_candidates.aggregation_level16, cfg.nof_candidates[4]);
srsran_assert(ret, "Failed to convert nof candidates=%d", cfg.nof_candidates[4]);
out.search_space_type_present = true;
if ((cfg.type == srsran_search_space_type_common_0) or (cfg.type == srsran_search_space_type_common_0A) or
(cfg.type == srsran_search_space_type_common_1) or (cfg.type == srsran_search_space_type_common_2) or
(cfg.type == srsran_search_space_type_common_3)) {
out.search_space_type.set_common();
out.search_space_type.common().dci_format0_minus0_and_format1_minus0_present = true;
} else {
srsran_terminate("Config Error: Unsupported search space type.");
}
}
/// Fill list of CSI-ReportConfig with gNB config
int fill_csi_report_from_enb_cfg(const rrc_nr_cfg_t& cfg, csi_meas_cfg_s& csi_meas_cfg)
{
@ -51,9 +86,8 @@ int fill_csi_report_from_enb_cfg(const rrc_nr_cfg_t& cfg, csi_meas_cfg_s& csi_me
// Report freq config (optional)
csi_report.report_freq_cfg_present = true;
csi_report.report_freq_cfg.cqi_format_ind_present = true;
csi_report.report_freq_cfg.cqi_format_ind =
asn1::rrc_nr::csi_report_cfg_s::report_freq_cfg_s_::cqi_format_ind_opts::wideband_cqi;
csi_report.time_restrict_for_ch_meass = asn1::rrc_nr::csi_report_cfg_s::time_restrict_for_ch_meass_opts::not_cfgured;
csi_report.report_freq_cfg.cqi_format_ind = csi_report_cfg_s::report_freq_cfg_s_::cqi_format_ind_opts::wideband_cqi;
csi_report.time_restrict_for_ch_meass = csi_report_cfg_s::time_restrict_for_ch_meass_opts::not_cfgured;
csi_report.time_restrict_for_interference_meass =
asn1::rrc_nr::csi_report_cfg_s::time_restrict_for_interference_meass_opts::not_cfgured;
csi_report.group_based_beam_report.set_disabled();
@ -949,23 +983,7 @@ void fill_pdcch_cfg_common(const rrc_cell_cfg_nr_t& cell_cfg, pdcch_cfg_common_s
cfg.common_search_space_list_present = true;
cfg.common_search_space_list.resize(1);
search_space_s& ss = cfg.common_search_space_list[0];
ss.search_space_id = 1;
ss.ctrl_res_set_id_present = true;
ss.ctrl_res_set_id = 0;
ss.monitoring_slot_periodicity_and_offset_present = true;
ss.monitoring_slot_periodicity_and_offset.set_sl1();
ss.monitoring_symbols_within_slot_present = true;
ss.monitoring_symbols_within_slot.from_number(0x2000);
ss.nrof_candidates_present = true;
ss.nrof_candidates.aggregation_level1.value = search_space_s::nrof_candidates_s_::aggregation_level1_opts::n0;
ss.nrof_candidates.aggregation_level2.value = search_space_s::nrof_candidates_s_::aggregation_level2_opts::n0;
ss.nrof_candidates.aggregation_level4.value = search_space_s::nrof_candidates_s_::aggregation_level4_opts::n1;
ss.nrof_candidates.aggregation_level8.value = search_space_s::nrof_candidates_s_::aggregation_level8_opts::n0;
ss.nrof_candidates.aggregation_level16.value = search_space_s::nrof_candidates_s_::aggregation_level16_opts::n0;
ss.search_space_type_present = true;
auto& common = ss.search_space_type.set_common();
common.dci_format0_minus0_and_format1_minus0_present = true;
set_search_space_from_phy_cfg(cell_cfg.phy_cell.pdcch.search_space[1], cfg.common_search_space_list[0]);
cfg.search_space_sib1_present = true;
cfg.search_space_sib1 = 0;

View File

@ -51,39 +51,6 @@ void generate_default_nr_phy_cell(phy_cell_cfg_nr_t& phy_cell)
phy_cell.prach.hs_flag = false;
phy_cell.prach.tdd_config.configured = false;
// PDCCH
// Configure CORESET ID 1
phy_cell.pdcch.coreset_present[1] = true;
phy_cell.pdcch.coreset[1].id = 1;
phy_cell.pdcch.coreset[1].duration = 1;
phy_cell.pdcch.coreset[1].mapping_type = srsran_coreset_mapping_type_non_interleaved;
phy_cell.pdcch.coreset[1].precoder_granularity = srsran_coreset_precoder_granularity_reg_bundle;
// Generate frequency resources for the full BW
for (uint32_t i = 0; i < SRSRAN_CORESET_FREQ_DOMAIN_RES_SIZE; i++) {
phy_cell.pdcch.coreset[1].freq_resources[i] = i < SRSRAN_FLOOR(phy_cell.carrier.nof_prb, 6);
}
// Configure Search Space 1 as common
phy_cell.pdcch.search_space_present[1] = true;
phy_cell.pdcch.search_space[1].id = 1;
phy_cell.pdcch.search_space[1].coreset_id = 1;
phy_cell.pdcch.search_space[1].duration = 1;
phy_cell.pdcch.search_space[1].formats[0] = srsran_dci_format_nr_0_0; // DCI format for PUSCH
phy_cell.pdcch.search_space[1].formats[1] = srsran_dci_format_nr_1_0; // DCI format for PDSCH
phy_cell.pdcch.search_space[1].nof_formats = 2;
phy_cell.pdcch.search_space[1].type = srsran_search_space_type_common_3;
// Generate 1 candidate for each aggregation level if possible
for (uint32_t L = 0; L < SRSRAN_SEARCH_SPACE_NOF_AGGREGATION_LEVELS_NR; L++) {
phy_cell.pdcch.search_space[1].nof_candidates[L] =
SRSRAN_MIN(2, srsran_pdcch_nr_max_candidates_coreset(&phy_cell.pdcch.coreset[1], L));
}
phy_cell.pdcch.ra_search_space_present = true;
phy_cell.pdcch.ra_search_space = phy_cell.pdcch.search_space[1];
phy_cell.pdcch.ra_search_space.type = srsran_search_space_type_common_1;
// PDSCH
phy_cell.pdsch.rs_power = 0;
phy_cell.pdsch.p_b = 0;
@ -269,11 +236,57 @@ int set_derived_nr_cell_params(bool is_sa, rrc_cell_cfg_nr_t& cell)
cell.phy_cell.pdcch.search_space[0].nof_candidates[0] = 1;
cell.phy_cell.pdcch.search_space[0].nof_candidates[1] = 1;
cell.phy_cell.pdcch.search_space[0].nof_candidates[2] = 1;
cell.phy_cell.pdcch.search_space[0].formats[0] = srsran_dci_format_nr_1_0;
cell.phy_cell.pdcch.search_space[0].nof_candidates[3] = 0;
cell.phy_cell.pdcch.search_space[0].nof_candidates[4] = 0;
cell.phy_cell.pdcch.search_space[0].nof_formats = 1;
cell.phy_cell.pdcch.search_space[0].formats[0] = srsran_dci_format_nr_1_0;
cell.phy_cell.pdcch.search_space[0].duration = 1;
cell.phy_cell.pdcch.search_space_present[1] = true;
cell.phy_cell.pdcch.search_space[1].id = 1;
cell.phy_cell.pdcch.search_space[1].coreset_id = 0;
cell.phy_cell.pdcch.search_space[1].type = srsran_search_space_type_common_3;
cell.phy_cell.pdcch.search_space[1].nof_candidates[0] = 0;
cell.phy_cell.pdcch.search_space[1].nof_candidates[1] = 0;
cell.phy_cell.pdcch.search_space[1].nof_candidates[2] = 1;
cell.phy_cell.pdcch.search_space[1].nof_candidates[3] = 0;
cell.phy_cell.pdcch.search_space[1].nof_candidates[4] = 0;
cell.phy_cell.pdcch.search_space[1].nof_formats = 2;
cell.phy_cell.pdcch.search_space[1].formats[0] = srsran_dci_format_nr_0_0; // DCI format for PUSCH
cell.phy_cell.pdcch.search_space[1].formats[1] = srsran_dci_format_nr_1_0; // DCI format for PDSCH
cell.phy_cell.pdcch.search_space[1].duration = 1;
} else {
// Configure CORESET#1
cell.phy_cell.pdcch.coreset_present[1] = true;
cell.phy_cell.pdcch.coreset[1].id = 1;
cell.phy_cell.pdcch.coreset[1].duration = 1;
cell.phy_cell.pdcch.coreset[1].mapping_type = srsran_coreset_mapping_type_non_interleaved;
cell.phy_cell.pdcch.coreset[1].precoder_granularity = srsran_coreset_precoder_granularity_reg_bundle;
// Generate frequency resources for the full BW
for (uint32_t i = 0; i < SRSRAN_CORESET_FREQ_DOMAIN_RES_SIZE; i++) {
cell.phy_cell.pdcch.coreset[1].freq_resources[i] = i < SRSRAN_FLOOR(cell.phy_cell.carrier.nof_prb, 6);
}
// Configure SearchSpace#1 -> CORESET#1
cell.phy_cell.pdcch.search_space_present[1] = true;
cell.phy_cell.pdcch.search_space[1].id = 1;
cell.phy_cell.pdcch.search_space[1].coreset_id = 1;
cell.phy_cell.pdcch.search_space[1].type = srsran_search_space_type_common_3;
// Generate frequency resources for the full BW
for (uint32_t L = 0; L < SRSRAN_SEARCH_SPACE_NOF_AGGREGATION_LEVELS_NR; L++) {
cell.phy_cell.pdcch.search_space[1].nof_candidates[L] =
SRSRAN_MIN(2, srsran_pdcch_nr_max_candidates_coreset(&cell.phy_cell.pdcch.coreset[1], L));
}
cell.phy_cell.pdcch.search_space[1].nof_formats = 2;
cell.phy_cell.pdcch.search_space[1].formats[0] = srsran_dci_format_nr_0_0; // DCI format for PUSCH
cell.phy_cell.pdcch.search_space[1].formats[1] = srsran_dci_format_nr_1_0; // DCI format for PDSCH
cell.phy_cell.pdcch.search_space[1].duration = 1;
}
cell.phy_cell.pdcch.ra_search_space_present = true;
cell.phy_cell.pdcch.ra_search_space = cell.phy_cell.pdcch.search_space[1];
cell.phy_cell.pdcch.ra_search_space.type = srsran_search_space_type_common_1;
// Derive remaining PHY cell params
cell.phy_cell.prach.num_ra_preambles = cell.phy_cell.num_ra_preambles;
cell.phy_cell.prach.tdd_config.configured = (cell.duplex_mode == SRSRAN_DUPLEX_MODE_TDD);