mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
NR UE: don't use get_softmodem_params()->numerology in MAC, store mac->numerology instead
This commit is contained in:
@@ -1111,11 +1111,11 @@ void *UE_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconfig_file)
|
||||
void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconfig_file, int numerology)
|
||||
{
|
||||
for (int instance_id = 0; instance_id < nb_inst; instance_id++) {
|
||||
NR_UE_RRC_INST_t* rrc = nr_rrc_init_ue(uecap_file, instance_id, get_nrUE_params()->nb_antennas_tx);
|
||||
NR_UE_MAC_INST_t *mac = nr_l2_init_ue(instance_id);
|
||||
NR_UE_MAC_INST_t *mac = nr_l2_init_ue(instance_id, numerology);
|
||||
|
||||
nr_rrc_set_mac_queue(instance_id, &mac->input_nf);
|
||||
mac->if_module = nr_ue_if_module_init(instance_id);
|
||||
|
||||
@@ -307,7 +307,7 @@ int main(int argc, char **argv)
|
||||
nr_pdcp_layer_init();
|
||||
nas_init_nrue(NB_UE_INST);
|
||||
|
||||
init_NR_UE(NB_UE_INST, get_nrUE_params()->uecap_file, get_nrUE_params()->reconfig_file, get_nrUE_params()->rbconfig_file);
|
||||
init_NR_UE(NB_UE_INST, get_nrUE_params()->uecap_file, get_nrUE_params()->reconfig_file, get_nrUE_params()->rbconfig_file, get_softmodem_params()->numerology);
|
||||
|
||||
// start time manager with some reasonable default for the running mode
|
||||
// (may be overwritten in configuration file or command line)
|
||||
|
||||
@@ -133,7 +133,7 @@ extern nrUE_params_t *get_nrUE_params(void);
|
||||
// In nr-ue.c
|
||||
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
||||
extern void fill_ue_band_info(void);
|
||||
extern void init_NR_UE(int, char *, char *, char *);
|
||||
extern void init_NR_UE(int, char *, char *, char *, int);
|
||||
extern void init_NR_UE_threads(PHY_VARS_NR_UE *ue);
|
||||
void *UE_thread(void *arg);
|
||||
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id);
|
||||
|
||||
@@ -932,7 +932,7 @@ int main(int argc, char **argv)
|
||||
|
||||
init_nr_ue_transport(UE);
|
||||
|
||||
UE_mac = nr_l2_init_ue(0);
|
||||
UE_mac = nr_l2_init_ue(0, mu);
|
||||
ue_init_config_request(UE_mac, get_slots_per_frame_from_scs(mu));
|
||||
|
||||
UE->if_inst = nr_ue_if_module_init(0);
|
||||
|
||||
@@ -893,7 +893,7 @@ int main(int argc, char *argv[])
|
||||
init_nr_ue_transport(UE);
|
||||
|
||||
//Configure UE
|
||||
NR_UE_MAC_INST_t* UE_mac = nr_l2_init_ue(0);
|
||||
NR_UE_MAC_INST_t* UE_mac = nr_l2_init_ue(0, mu);
|
||||
|
||||
ue_init_config_request(UE_mac, get_slots_per_frame_from_scs(mu));
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
|
||||
AssertFatal(frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR, "Field mandatory present for DL in SIB1\n");
|
||||
mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR;
|
||||
|
||||
AssertFatal(mac->numerology == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "DL and SSB subcarrierSpacing must be the same!\n");
|
||||
int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
mac->frequency_range,
|
||||
frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
|
||||
@@ -172,6 +173,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
|
||||
NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL;
|
||||
mac->p_Max = frequencyInfoUL->p_Max ? *frequencyInfoUL->p_Max : INT_MIN;
|
||||
|
||||
AssertFatal(mac->numerology == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "UL and SSB subcarrierSpacing must be the same!\n");
|
||||
bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
mac->frequency_range,
|
||||
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
|
||||
@@ -204,7 +206,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
|
||||
}
|
||||
}
|
||||
|
||||
frame_type_t frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology);
|
||||
frame_type_t frame_type = get_frame_type(mac->nr_band, mac->numerology);
|
||||
// cell config
|
||||
cfg->cell_config.phy_cell_id = mac->physCellId;
|
||||
cfg->cell_config.frame_duplex_type = frame_type;
|
||||
@@ -212,7 +214,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
|
||||
|
||||
// SSB config
|
||||
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
|
||||
cfg->ssb_config.scs_common = get_softmodem_params()->numerology;
|
||||
cfg->ssb_config.scs_common = mac->numerology;
|
||||
|
||||
// SSB Table config
|
||||
cfg->ssb_table.ssb_offset_point_a = frequencyInfoDL->offsetToPointA;
|
||||
@@ -231,7 +233,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
|
||||
}
|
||||
|
||||
int period_idx = mac->tdd_UL_DL_ConfigurationCommon ? get_tdd_period_idx(mac->tdd_UL_DL_ConfigurationCommon) : 0;
|
||||
config_frame_structure(get_softmodem_params()->numerology,
|
||||
config_frame_structure(mac->numerology,
|
||||
mac->tdd_UL_DL_ConfigurationCommon,
|
||||
period_idx,
|
||||
frame_type,
|
||||
@@ -443,14 +445,16 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t
|
||||
|
||||
// carrier config
|
||||
LOG_D(MAC, "[UE %d] Entering UE Config Common\n", mac->ue_id);
|
||||
mac->numerology = *scc->ssbSubcarrierSpacing;
|
||||
|
||||
AssertFatal(scc->downlinkConfigCommon, "Not expecting downlinkConfigCommon to be NULL here\n");
|
||||
NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
||||
if (frequencyInfoDL) { // NeedM for inter-freq handover
|
||||
mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology);
|
||||
frame_type = get_frame_type(mac->nr_band, mac->numerology);
|
||||
mac->frequency_range = get_freq_range_from_band(mac->nr_band);
|
||||
|
||||
AssertFatal(mac->numerology == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "DL and SSB subcarrierSpacing must be the same!\n");
|
||||
int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
mac->frequency_range,
|
||||
frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
|
||||
@@ -483,6 +487,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t
|
||||
NR_FrequencyInfoUL_t *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL;
|
||||
mac->p_Max = frequencyInfoUL->p_Max ? *frequencyInfoUL->p_Max : INT_MIN;
|
||||
|
||||
AssertFatal(mac->numerology == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, "UL and SSB subcarrierSpacing must be the same!\n");
|
||||
int bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
mac->frequency_range,
|
||||
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
|
||||
|
||||
@@ -615,6 +615,7 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
uint16_t nr_band;
|
||||
uint8_t ssb_subcarrier_offset;
|
||||
int ssb_start_subcarrier;
|
||||
int numerology;
|
||||
|
||||
NR_SSB_meas_t ssb_measurements[MAX_NB_SSB];
|
||||
NR_CSIRS_meas_t csirs_measurements;
|
||||
|
||||
@@ -106,7 +106,7 @@ typedef struct nr_neighbor_cell_info {
|
||||
void nr_rrc_mac_config_req_meas(module_id_t module_id, const nr_neighbor_cell_info_t *neighbor_cells, int num_neighbors);
|
||||
|
||||
/**\brief initialization NR UE MAC instance(s)*/
|
||||
NR_UE_MAC_INST_t * nr_l2_init_ue(int nb_inst);
|
||||
NR_UE_MAC_INST_t * nr_l2_init_ue(int nb_inst, int numerology);
|
||||
|
||||
/**\brief fetch MAC instance by module_id
|
||||
\param module_id index of MAC instance(s)*/
|
||||
|
||||
@@ -97,7 +97,7 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
||||
// default values as defined in 38.331 sec 9.2.2
|
||||
|
||||
// sf80 default for retxBSR_Timer sf10 for periodicBSR_Timer
|
||||
int mu = mac->current_UL_BWP ? mac->current_UL_BWP->scs : get_softmodem_params()->numerology;
|
||||
int mu = mac->current_UL_BWP ? mac->current_UL_BWP->scs : mac->numerology;
|
||||
int subframes_per_slot = get_slots_per_frame_from_scs(mu) / 10;
|
||||
nr_timer_setup(&mac->scheduling_info.retxBSR_Timer, 80 * subframes_per_slot, 1); // 1 slot update rate
|
||||
nr_timer_setup(&mac->scheduling_info.periodicBSR_Timer, 10 * subframes_per_slot, 1); // 1 slot update rate
|
||||
@@ -130,7 +130,7 @@ NR_UE_L2_STATE_t nr_ue_get_sync_state(module_id_t mod_id)
|
||||
return mac->state;
|
||||
}
|
||||
|
||||
NR_UE_MAC_INST_t *nr_l2_init_ue(int instance_id)
|
||||
NR_UE_MAC_INST_t *nr_l2_init_ue(int instance_id, int numerology)
|
||||
{
|
||||
AssertFatal(instance_id < MAX_NUM_NR_UE_INST, "instance_id %d is out of range\n", instance_id);
|
||||
AssertFatal(nr_ue_mac_inst[instance_id] == NULL, "MAC instance %d already initialized\n", instance_id);
|
||||
@@ -138,12 +138,13 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int instance_id)
|
||||
|
||||
NR_UE_MAC_INST_t *mac = nr_ue_mac_inst[instance_id];
|
||||
mac->ue_id = instance_id;
|
||||
mac->numerology = numerology;
|
||||
nr_ue_init_mac(mac);
|
||||
int ret = pthread_mutex_init(&mac->if_mutex, NULL);
|
||||
AssertFatal(ret == 0, "Mutex init failed\n");
|
||||
nr_ue_mac_default_configs(mac);
|
||||
if (IS_SA_MODE(get_softmodem_params()))
|
||||
ue_init_config_request(mac, get_slots_per_frame_from_scs(get_softmodem_params()->numerology));
|
||||
ue_init_config_request(mac, get_slots_per_frame_from_scs(numerology));
|
||||
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
|
||||
@@ -427,7 +427,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
const NR_UE_DL_BWP_t *current_DL_BWP = mac->current_DL_BWP;
|
||||
NR_BWP_Id_t dl_bwp_id = current_DL_BWP ? current_DL_BWP->bwp_id : 0;
|
||||
NR_BWP_PDCCH_t *pdcch_config = &mac->config_BWP_PDCCH[dl_bwp_id];
|
||||
int scs = current_DL_BWP ? current_DL_BWP->scs : get_softmodem_params()->numerology;
|
||||
int scs = current_DL_BWP ? current_DL_BWP->scs : mac->numerology;
|
||||
const int slots_per_frame = get_slots_per_frame_from_scs(scs);
|
||||
if (mac->get_sib1) {
|
||||
int ssb_sc_offset_norm;
|
||||
|
||||
Reference in New Issue
Block a user