rrc,nr: transfer SSB config to both UE and NR scheduler

This commit is contained in:
Francisco 2021-10-08 12:04:29 +01:00 committed by Francisco Paisana
parent b8976ca463
commit 43b12b9ffb
6 changed files with 85 additions and 56 deletions

View File

@ -114,8 +114,8 @@ bool make_phy_carrier_cfg(const asn1::rrc_nr::freq_info_dl_s& freq_info_dl, srsr
bool make_phy_ssb_cfg(const srsran_carrier_nr_t& carrier,
const asn1::rrc_nr::serving_cell_cfg_common_s& serv_cell_cfg,
phy_cfg_nr_t::ssb_cfg_t* ssb);
bool make_pdsch_cfg_from_serv_cell(asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_sch_hl_cfg_nr_t* sch_hl);
bool make_csi_cfg_from_serv_cell(asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_csi_hl_cfg_t* csi_hl);
bool make_pdsch_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_sch_hl_cfg_nr_t* sch_hl);
bool make_csi_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_csi_hl_cfg_t* csi_hl);
/***************************
* MAC Config

View File

@ -1475,7 +1475,7 @@ bool make_phy_ssb_cfg(const srsran_carrier_nr_t& carrier,
return true;
}
bool make_pdsch_cfg_from_serv_cell(asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_sch_hl_cfg_nr_t* sch_hl)
bool make_pdsch_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_sch_hl_cfg_nr_t* sch_hl)
{
if (serv_cell.csi_meas_cfg_present and
serv_cell.csi_meas_cfg.type().value ==
@ -1518,7 +1518,7 @@ bool make_pdsch_cfg_from_serv_cell(asn1::rrc_nr::serving_cell_cfg_s& serv_cell,
return true;
}
bool make_csi_cfg_from_serv_cell(asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_csi_hl_cfg_t* csi_hl)
bool make_csi_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_csi_hl_cfg_t* csi_hl)
{
if (serv_cell.csi_meas_cfg_present and
serv_cell.csi_meas_cfg.type().value ==

View File

@ -18,7 +18,7 @@
namespace srsenb {
int fill_serv_cell_from_enb_cfg(const rrc_nr_cfg_t& cfg, asn1::rrc_nr::serving_cell_cfg_s& serv_cell);
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

@ -117,7 +117,7 @@ public:
bool is_inactive() { return state == rrc_nr_state_t::RRC_INACTIVE; }
bool is_endc() { return endc; }
uint16_t get_eutra_rnti() { return eutra_rnti; }
void get_metrics(rrc_ue_metrics_t& ue_metrics) { ue_metrics = {}; /*TODO fill RRC metrics*/ };
void get_metrics(rrc_ue_metrics_t& ue_metrics) { ue_metrics = {}; /*TODO fill RRC metrics*/ };
// setters
int pack_rrc_reconfiguration();
@ -172,8 +172,6 @@ public:
int pack_recfg_with_sync_sp_cell_cfg_common_ul_cfg_common_init_ul_bwp_pusch_cfg_common(
asn1::rrc_nr::cell_group_cfg_s& cell_group_cfg_pack);
int pack_recfg_with_sync_sp_cell_cfg_common_ssb_cfg(asn1::rrc_nr::cell_group_cfg_s& cell_group_cfg_pack);
int
pack_recfg_with_sync_sp_cell_cfg_common_tdd_ul_dl_cfg_common(asn1::rrc_nr::cell_group_cfg_s& cell_group_cfg_pack);

View File

@ -14,6 +14,11 @@
using namespace asn1::rrc_nr;
#define HANDLE_ERROR(ret) \
if ((ret) != SRSRAN_SUCCESS) { \
return SRSRAN_ERROR; \
}
namespace srsenb {
srslog::basic_logger& get_logger(const rrc_nr_cfg_t& cfg)
@ -220,13 +225,69 @@ int fill_csi_meas_from_enb_cfg(const rrc_nr_cfg_t& cfg, csi_meas_cfg_s& csi_meas
int fill_serv_cell_from_enb_cfg(const rrc_nr_cfg_t& cfg, serving_cell_cfg_s& serv_cell)
{
serv_cell.csi_meas_cfg_present = true;
if (fill_csi_meas_from_enb_cfg(cfg, serv_cell.csi_meas_cfg.set_setup()) != SRSRAN_SUCCESS) {
return SRSRAN_ERROR;
}
HANDLE_ERROR(fill_csi_meas_from_enb_cfg(cfg, serv_cell.csi_meas_cfg.set_setup()));
// TODO: remaining fields
return SRSRAN_SUCCESS;
}
/// Fill ServingCellConfigCommon with gNB config
int fill_serv_cell_common_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, serving_cell_cfg_common_s& serv_common)
{
auto& cell_cfg = cfg.cell_list.at(cc);
serv_common.ss_pbch_block_pwr = 0;
serv_common.n_timing_advance_offset = asn1::rrc_nr::serving_cell_cfg_common_s::n_timing_advance_offset_opts::n0;
serv_common.dmrs_type_a_position = asn1::rrc_nr::serving_cell_cfg_common_s::dmrs_type_a_position_opts::pos2;
serv_common.pci_present = true;
serv_common.pci = cell_cfg.phy_cell.carrier.pci;
serv_common.ssb_periodicity_serving_cell_present = true;
if (not asn1::number_to_enum(serv_common.ssb_periodicity_serving_cell, cell_cfg.ssb_cfg.periodicity_ms)) {
get_logger(cfg).error("Config Error: Invalid SSB periodicity = %d\n", cell_cfg.ssb_cfg.periodicity_ms);
return SRSRAN_ERROR;
}
// Fill SSB config
serv_common.ssb_positions_in_burst_present = true;
if (cfg.cell_list[cc].duplex_mode == SRSRAN_DUPLEX_MODE_FDD) {
serv_common.ssb_positions_in_burst.set_short_bitmap().from_number(0b1000);
} else {
serv_common.ssb_positions_in_burst.set_medium_bitmap().from_number(0b10000000);
}
// Set SSB SCS
serv_common.ssb_subcarrier_spacing_present = true;
if (cfg.cell_list[cc].duplex_mode == SRSRAN_DUPLEX_MODE_FDD) {
serv_common.ssb_subcarrier_spacing = subcarrier_spacing_opts::khz15;
} else {
serv_common.ssb_subcarrier_spacing = subcarrier_spacing_opts::khz30;
}
return SRSRAN_SUCCESS;
}
/// Fill reconfigurationWithSync with gNB config
int fill_recfg_with_sync_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, recfg_with_sync_s& sync)
{
sync.sp_cell_cfg_common_present = true;
HANDLE_ERROR(fill_serv_cell_common_from_enb_cfg(cfg, cc, sync.sp_cell_cfg_common));
return SRSRAN_SUCCESS;
}
/// Fill spCellConfig with gNB config
int fill_sp_cell_cfg_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, sp_cell_cfg_s& sp_cell)
{
sp_cell.recfg_with_sync_present = true;
HANDLE_ERROR(fill_recfg_with_sync_from_enb_cfg(cfg, cc, sp_cell.recfg_with_sync));
sp_cell.sp_cell_cfg_ded_present = true;
HANDLE_ERROR(fill_serv_cell_from_enb_cfg(cfg, sp_cell.sp_cell_cfg_ded));
return SRSRAN_SUCCESS;
}
} // namespace srsenb

View File

@ -243,10 +243,16 @@ void rrc_nr::config_mac()
std::vector<srsenb::sched_nr_interface::cell_cfg_t> sched_cells_cfg = {srsenb::get_default_cells_cfg(1)};
sched_nr_interface::cell_cfg_t& cell = sched_cells_cfg[0];
asn1::rrc_nr::serving_cell_cfg_s serv_cell;
int ret = fill_serv_cell_from_enb_cfg(cfg, serv_cell);
// Derive ASN1 from config
asn1::rrc_nr::sp_cell_cfg_s sp_cell;
int ret = fill_sp_cell_cfg_from_enb_cfg(cfg, UE_PSCELL_CC_IDX, sp_cell);
srsran_assert(ret == SRSRAN_SUCCESS, "Failed to configure cell");
bool ret2 = srsran::make_pdsch_cfg_from_serv_cell(serv_cell, &cell.bwps[0].pdsch);
// Derive cell config from ASN1
bool ret2 = srsran::make_pdsch_cfg_from_serv_cell(sp_cell.sp_cell_cfg_ded, &cell.bwps[0].pdsch);
srsran_assert(ret2, "Invalid NR cell configuration.");
ret2 = srsran::make_phy_ssb_cfg(
cfg.cell_list[0].phy_cell.carrier, sp_cell.recfg_with_sync.sp_cell_cfg_common, &cell.ssb);
srsran_assert(ret2, "Invalid NR cell configuration.");
// FIXME: entire SI configuration, etc needs to be ported to NR
@ -941,8 +947,10 @@ int rrc_nr::ue::pack_sp_cell_cfg_ded(asn1::rrc_nr::cell_group_cfg_s& cell_group_
// Serving cell config (only to setup)
pack_sp_cell_cfg_ded_pdcch_serving_cell_cfg(cell_group_cfg_pack);
// CSI meas config
fill_serv_cell_from_enb_cfg(parent->cfg, cell_group_cfg_pack.sp_cell_cfg.sp_cell_cfg_ded);
// spCellConfig
if (fill_sp_cell_cfg_from_enb_cfg(parent->cfg, UE_PSCELL_CC_IDX, cell_group_cfg_pack.sp_cell_cfg) != SRSRAN_SUCCESS) {
parent->logger.error("Failed to pack spCellConfig for rnti=0x%x", rnti);
}
return SRSRAN_SUCCESS;
}
@ -1086,7 +1094,7 @@ int rrc_nr::ue::pack_recfg_with_sync_sp_cell_cfg_common_ul_cfg_common_freq_info_
freq_info_ul.freq_band_list_present = true;
freq_info_ul.freq_band_list.push_back(parent->cfg.cell_list[0].band);
freq_info_ul.absolute_freq_point_a_present = true;
freq_info_ul.absolute_freq_point_a = parent->cfg.cell_list[0].ul_absolute_freq_point_a;
freq_info_ul.absolute_freq_point_a = parent->cfg.cell_list[0].ul_absolute_freq_point_a;
freq_info_ul.scs_specific_carrier_list.resize(1);
auto& ul_carrier = freq_info_ul.scs_specific_carrier_list[0];
@ -1202,26 +1210,6 @@ int rrc_nr::ue::pack_recfg_with_sync_sp_cell_cfg_common_ul_cfg_common(
return SRSRAN_SUCCESS;
}
int rrc_nr::ue::pack_recfg_with_sync_sp_cell_cfg_common_ssb_cfg(asn1::rrc_nr::cell_group_cfg_s& cell_group_cfg_pack)
{
// SSB config (optional)
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst_present = true;
auto& ssb_pos_in_burst = cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst;
if (parent->cfg.cell_list[0].duplex_mode == SRSRAN_DUPLEX_MODE_FDD) {
ssb_pos_in_burst.set_short_bitmap().from_number(0b1000);
} else {
ssb_pos_in_burst.set_medium_bitmap().from_number(0b10000000);
}
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_periodicity_serving_cell_present = true;
// TODO: get periodicitiy from cell config
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_periodicity_serving_cell =
serving_cell_cfg_common_s::ssb_periodicity_serving_cell_opts::ms10;
return SRSRAN_SUCCESS;
}
int rrc_nr::ue::pack_recfg_with_sync_sp_cell_cfg_common_tdd_ul_dl_cfg_common(
asn1::rrc_nr::cell_group_cfg_s& cell_group_cfg_pack)
{
@ -1242,23 +1230,8 @@ int rrc_nr::ue::pack_recfg_with_sync_sp_cell_cfg_common(asn1::rrc_nr::cell_group
{
auto& pscell_cfg = parent->cfg.cell_list.at(UE_PSCELL_CC_IDX);
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common_present = true;
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ss_pbch_block_pwr = 0;
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.n_timing_advance_offset =
asn1::rrc_nr::serving_cell_cfg_common_s::n_timing_advance_offset_opts::n0;
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.dmrs_type_a_position =
asn1::rrc_nr::serving_cell_cfg_common_s::dmrs_type_a_position_opts::pos2;
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.pci_present = true;
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.pci = pscell_cfg.phy_cell.carrier.pci;
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_subcarrier_spacing_present = true;
if (parent->cfg.cell_list[0].duplex_mode == SRSRAN_DUPLEX_MODE_FDD) {
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_subcarrier_spacing =
subcarrier_spacing_opts::khz15;
} else {
if (pscell_cfg.duplex_mode == SRSRAN_DUPLEX_MODE_TDD) {
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.smtc.release();
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_subcarrier_spacing =
subcarrier_spacing_opts::khz30;
}
// DL config
@ -1267,9 +1240,6 @@ int rrc_nr::ue::pack_recfg_with_sync_sp_cell_cfg_common(asn1::rrc_nr::cell_group
// UL config
pack_recfg_with_sync_sp_cell_cfg_common_ul_cfg_common(cell_group_cfg_pack);
// SSB config (optional)
pack_recfg_with_sync_sp_cell_cfg_common_ssb_cfg(cell_group_cfg_pack);
if (parent->cfg.cell_list[0].duplex_mode == SRSRAN_DUPLEX_MODE_TDD) {
pack_recfg_with_sync_sp_cell_cfg_common_tdd_ul_dl_cfg_common(cell_group_cfg_pack);
}