nr,gnb,mac: use mac cell config to generate ue phy cfg common

master
Francisco 3 years ago committed by Francisco Paisana
parent 9ecb3f516d
commit dc77260956

@ -111,7 +111,7 @@ private:
mac_nr_args_t args = {}; mac_nr_args_t args = {};
srslog::basic_logger& logger; srslog::basic_logger& logger;
// derived // initial UE config, before RRC setup (without UE-dedicated)
srsran::phy_cfg_nr_t default_ue_phy_cfg; srsran::phy_cfg_nr_t default_ue_phy_cfg;
std::unique_ptr<srsran::mac_pcap> pcap = nullptr; std::unique_ptr<srsran::mac_pcap> pcap = nullptr;

@ -61,6 +61,9 @@ public:
srsran_pdcch_cfg_nr_t pdcch = {}; srsran_pdcch_cfg_nr_t pdcch = {};
srsran_sch_hl_cfg_nr_t pdsch = {}; srsran_sch_hl_cfg_nr_t pdsch = {};
srsran_sch_hl_cfg_nr_t pusch = {}; srsran_sch_hl_cfg_nr_t pusch = {};
srsran_pucch_nr_hl_cfg_t pucch = {};
srsran_prach_cfg_t prach = {};
srsran_harq_ack_cfg_hl_t harq_ack = {};
uint32_t rar_window_size = 10; // See TS 38.331, ra-ResponseWindow: {1, 2, 4, 8, 10, 20, 40, 80} uint32_t rar_window_size = 10; // See TS 38.331, ra-ResponseWindow: {1, 2, 4, 8, 10, 20, 40, 80}
uint32_t numerology_idx = 0; uint32_t numerology_idx = 0;
}; };

@ -31,6 +31,8 @@ view_active_search_spaces(const srsran_pdcch_cfg_nr_t& pdcch)
return srsran::split_optional_span<const srsran_search_space_t>{pdcch.search_space, pdcch.search_space_present}; return srsran::split_optional_span<const srsran_search_space_t>{pdcch.search_space, pdcch.search_space_present};
} }
srsran::phy_cfg_nr_t get_common_ue_phy_cfg(const sched_nr_interface::cell_cfg_t& cfg);
} // namespace srsenb } // namespace srsenb
#endif // SRSRAN_SCHED_NR_INTERFACE_HELPERS_H #endif // SRSRAN_SCHED_NR_INTERFACE_HELPERS_H

@ -20,7 +20,8 @@ set(SOURCES mac_nr.cc
sched_nr_rb.cc sched_nr_rb.cc
sched_nr_time_rr.cc sched_nr_time_rr.cc
harq_softbuffer.cc harq_softbuffer.cc
sched_nr_signalling.cc) sched_nr_signalling.cc
sched_nr_interface_utils.cc)
add_library(srsgnb_mac STATIC ${SOURCES}) add_library(srsgnb_mac STATIC ${SOURCES})
target_link_libraries(srsgnb_mac srsenb_mac_common srsran_mac) target_link_libraries(srsgnb_mac srsenb_mac_common srsran_mac)

@ -298,21 +298,7 @@ int mac_nr::cell_cfg(const std::vector<srsenb::sched_nr_interface::cell_cfg_t>&
rx.reset(new mac_nr_rx{rlc, rrc, stack_task_queue, sched.get(), *this, logger}); rx.reset(new mac_nr_rx{rlc, rrc, stack_task_queue, sched.get(), *this, logger});
srsran::phy_cfg_nr_default_t::reference_cfg_t ref_args{}; default_ue_phy_cfg = get_common_ue_phy_cfg(cell_config[0]);
ref_args.duplex = cell_config[0].duplex.mode == SRSRAN_DUPLEX_MODE_TDD
? srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_TDD_CUSTOM_6_4
: srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_FDD;
default_ue_phy_cfg = srsran::phy_cfg_nr_default_t{ref_args};
default_ue_phy_cfg.pdcch = cell_config[0].bwps[0].pdcch;
// remove UE-specific SearchSpaces (they will be added later via RRC)
for (uint32_t i = 0; i < SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE; ++i) {
if (default_ue_phy_cfg.pdcch.search_space_present[i] and
default_ue_phy_cfg.pdcch.search_space[i].type == srsran_search_space_type_ue) {
default_ue_phy_cfg.pdcch.search_space_present[i] = false;
default_ue_phy_cfg.pdcch.search_space[i] = {};
}
}
default_ue_phy_cfg.csi = {}; // disable CSI until RA is complete
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -0,0 +1,45 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2021 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#include "srsgnb/hdr/stack/mac/sched_nr_interface_utils.h"
namespace srsenb {
srsran::phy_cfg_nr_t get_common_ue_phy_cfg(const sched_nr_interface::cell_cfg_t& cfg)
{
srsran::phy_cfg_nr_t ue_phy_cfg;
ue_phy_cfg.csi = {}; // disable CSI until RA is complete
ue_phy_cfg.carrier = cfg.carrier;
ue_phy_cfg.duplex = cfg.duplex;
ue_phy_cfg.ssb = cfg.ssb;
ue_phy_cfg.pdcch = cfg.bwps[0].pdcch;
ue_phy_cfg.pdsch = cfg.bwps[0].pdsch;
ue_phy_cfg.pusch = cfg.bwps[0].pusch;
ue_phy_cfg.pucch = cfg.bwps[0].pucch;
ue_phy_cfg.prach = cfg.bwps[0].prach;
ue_phy_cfg.harq_ack = cfg.bwps[0].harq_ack;
// remove UE-specific SearchSpaces (they will be added later via RRC)
for (uint32_t i = 0; i < SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE; ++i) {
if (ue_phy_cfg.pdcch.search_space_present[i] and
ue_phy_cfg.pdcch.search_space[i].type == srsran_search_space_type_ue) {
ue_phy_cfg.pdcch.search_space_present[i] = false;
ue_phy_cfg.pdcch.search_space[i] = {};
}
}
return ue_phy_cfg;
}
} // namespace srsenb

@ -45,6 +45,9 @@ inline sched_nr_interface::cell_cfg_t get_default_cell_cfg(
cell_cfg.bwps[0].pdcch = phy_cfg.pdcch; cell_cfg.bwps[0].pdcch = phy_cfg.pdcch;
cell_cfg.bwps[0].pdsch = phy_cfg.pdsch; cell_cfg.bwps[0].pdsch = phy_cfg.pdsch;
cell_cfg.bwps[0].pusch = phy_cfg.pusch; cell_cfg.bwps[0].pusch = phy_cfg.pusch;
cell_cfg.bwps[0].pucch = phy_cfg.pucch;
cell_cfg.bwps[0].prach = phy_cfg.prach;
cell_cfg.bwps[0].harq_ack = phy_cfg.harq_ack;
cell_cfg.bwps[0].rb_width = phy_cfg.carrier.nof_prb; cell_cfg.bwps[0].rb_width = phy_cfg.carrier.nof_prb;
return cell_cfg; return cell_cfg;

@ -898,11 +898,11 @@ int fill_mib_from_enb_cfg(const rrc_cell_cfg_nr_t& cell_cfg, asn1::rrc_nr::mib_s
switch (cell_cfg.phy_cell.carrier.scs) { switch (cell_cfg.phy_cell.carrier.scs) {
case srsran_subcarrier_spacing_15kHz: case srsran_subcarrier_spacing_15kHz:
case srsran_subcarrier_spacing_60kHz: case srsran_subcarrier_spacing_60kHz:
mib.sub_carrier_spacing_common.value = asn1::rrc_nr::mib_s::sub_carrier_spacing_common_opts::scs15or60; mib.sub_carrier_spacing_common.value = mib_s::sub_carrier_spacing_common_opts::scs15or60;
break; break;
case srsran_subcarrier_spacing_30kHz: case srsran_subcarrier_spacing_30kHz:
case srsran_subcarrier_spacing_120kHz: case srsran_subcarrier_spacing_120kHz:
mib.sub_carrier_spacing_common.value = asn1::rrc_nr::mib_s::sub_carrier_spacing_common_opts::scs30or120; mib.sub_carrier_spacing_common.value = mib_s::sub_carrier_spacing_common_opts::scs30or120;
break; break;
default: default:
srsran_terminate("Invalid carrier SCS=%d Hz", SRSRAN_SUBC_SPACING_NR(cell_cfg.phy_cell.carrier.scs)); srsran_terminate("Invalid carrier SCS=%d Hz", SRSRAN_SUBC_SPACING_NR(cell_cfg.phy_cell.carrier.scs));

@ -262,21 +262,31 @@ void rrc_nr::config_mac()
{ {
// Fill MAC scheduler configuration for SIBs // Fill MAC scheduler configuration for SIBs
// TODO: use parsed cell NR cfg configuration // TODO: use parsed cell NR cfg configuration
std::vector<srsenb::sched_nr_interface::cell_cfg_t> sched_cells_cfg = {srsenb::get_default_cells_cfg(1)}; srsran::phy_cfg_nr_default_t::reference_cfg_t ref_args{};
ref_args.duplex = cfg.cell_list[0].duplex_mode == SRSRAN_DUPLEX_MODE_TDD
? srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_TDD_CUSTOM_6_4
: srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_FDD;
std::vector<sched_nr_interface::cell_cfg_t> sched_cells_cfg(
1, get_default_cell_cfg(srsran::phy_cfg_nr_default_t{ref_args}));
sched_nr_interface::cell_cfg_t& cell = sched_cells_cfg[0]; sched_nr_interface::cell_cfg_t& cell = sched_cells_cfg[0];
// Derive cell config from rrc_nr_cfg_t // Derive cell config from rrc_nr_cfg_t
cell.bwps[0].pdcch = cfg.cell_list[0].phy_cell.pdcch; cell.bwps[0].pdcch = cfg.cell_list[0].phy_cell.pdcch;
bool valid_cfg = srsran::make_phy_mib(cell_ctxt->mib, &cell.mib);
srsran_assert(valid_cfg, "Invalid NR cell MIB configuration.");
cell.ssb.periodicity_ms = cfg.cell_list[0].ssb_cfg.periodicity_ms;
cell.ssb.position_in_burst[0] = true;
cell.ssb.scs = cfg.cell_list[0].ssb_cfg.scs;
cell.ssb.pattern = cfg.cell_list[0].ssb_cfg.pattern;
cell.duplex.mode = SRSRAN_DUPLEX_MODE_FDD;
if (not cfg.is_standalone) {
// Derive cell config from ASN1 // Derive cell config from ASN1
bool ret2 = srsran::make_pdsch_cfg_from_serv_cell(base_sp_cell_cfg.sp_cell_cfg_ded, &cell.bwps[0].pdsch); valid_cfg = srsran::make_pdsch_cfg_from_serv_cell(base_sp_cell_cfg.sp_cell_cfg_ded, &cell.bwps[0].pdsch);
srsran_assert(ret2, "Invalid NR cell configuration."); srsran_assert(valid_cfg, "Invalid NR cell configuration.");
ret2 = srsran::make_phy_ssb_cfg( valid_cfg =
cfg.cell_list[0].phy_cell.carrier, base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &cell.ssb); srsran::make_duplex_cfg_from_serv_cell(base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &cell.duplex);
srsran_assert(ret2, "Invalid NR cell configuration."); srsran_assert(valid_cfg, "Invalid NR cell configuration.");
ret2 = srsran::make_duplex_cfg_from_serv_cell(base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &cell.duplex); }
srsran_assert(ret2, "Invalid NR cell configuration.");
ret2 = srsran::make_phy_mib(cell_ctxt->mib, &cell.mib);
srsran_assert(ret2, "Invalid NR cell MIB configuration.");
// Set SIB1 and SI messages // Set SIB1 and SI messages
cell.sibs.resize(cell_ctxt->sib_buffer.size()); cell.sibs.resize(cell_ctxt->sib_buffer.size());
@ -573,7 +583,7 @@ int rrc_nr::ue_set_security_cfg_capabilities(uint16_t rnti, const asn1::ngap_nr:
int rrc_nr::start_security_mode_procedure(uint16_t rnti) int rrc_nr::start_security_mode_procedure(uint16_t rnti)
{ {
auto user_it = users.find(rnti); auto user_it = users.find(rnti);
if (user_it == users.end()){ if (user_it == users.end()) {
logger.error("Starting SecurityModeCommand procedure failed - rnti=0x%x not found", rnti); logger.error("Starting SecurityModeCommand procedure failed - rnti=0x%x not found", rnti);
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }

Loading…
Cancel
Save