Initialize number of NR UEs equal to --num-ues parameter
This commit is contained in:
+12
-17
@@ -146,7 +146,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
|||||||
int nb_connected_gNB = 1;
|
int nb_connected_gNB = 1;
|
||||||
|
|
||||||
ue->Mod_id = UE_id;
|
ue->Mod_id = UE_id;
|
||||||
ue->if_inst = nr_ue_if_module_init(0);
|
ue->if_inst = nr_ue_if_module_init(UE_id);
|
||||||
ue->dci_thres = 0;
|
ue->dci_thres = 0;
|
||||||
ue->target_Nid_cell = -1;
|
ue->target_Nid_cell = -1;
|
||||||
|
|
||||||
@@ -998,27 +998,22 @@ void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconf
|
|||||||
mac->if_module = nr_ue_if_module_init(i);
|
mac->if_module = nr_ue_if_module_init(i);
|
||||||
AssertFatal(mac->if_module, "can not initialize IF module\n");
|
AssertFatal(mac->if_module, "can not initialize IF module\n");
|
||||||
if (!get_softmodem_params()->sa || !get_softmodem_params()->sl_mode) {
|
if (!get_softmodem_params()->sa || !get_softmodem_params()->sl_mode) {
|
||||||
init_nsa_message(rrc_inst, reconfig_file, rbconfig_file);
|
init_nsa_message(&rrc_inst[i], reconfig_file, rbconfig_file);
|
||||||
nr_rlc_activate_srb0(mac_inst->crnti, NULL, send_srb0_rrc);
|
nr_rlc_activate_srb0(mac_inst[i].crnti, NULL, send_srb0_rrc);
|
||||||
}
|
}
|
||||||
//TODO: Move this call to RRC
|
//TODO: Move this call to RRC
|
||||||
start_sidelink((&rrc_inst[i])->ue_id);
|
start_sidelink((&rrc_inst[i])->ue_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_NR_UE_threads(int nb_inst) {
|
void init_NR_UE_threads(PHY_VARS_NR_UE *UE) {
|
||||||
int inst;
|
pthread_t thread;
|
||||||
|
char thread_name[16];
|
||||||
pthread_t threads[nb_inst];
|
sprintf(thread_name, "UEthread_%d", UE->Mod_id);
|
||||||
|
threadCreate(&thread, UE_thread, (void *)UE, thread_name, -1, OAI_PRIORITY_RT_MAX);
|
||||||
for (inst=0; inst < nb_inst; inst++) {
|
if (!IS_SOFTMODEM_NOSTATS_BIT) {
|
||||||
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0];
|
pthread_t stat_pthread;
|
||||||
|
sprintf(thread_name, "L1_UE_stats_%d", UE->Mod_id);
|
||||||
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
|
threadCreate(&stat_pthread, nrL1_UE_stats_thread, UE, thread_name, -1, OAI_PRIORITY_RT_LOW);
|
||||||
threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX);
|
|
||||||
if (!IS_SOFTMODEM_NOSTATS_BIT) {
|
|
||||||
pthread_t stat_pthread;
|
|
||||||
threadCreate(&stat_pthread, nrL1_UE_stats_thread, UE, "L1_UE_stats", -1, OAI_PRIORITY_RT_LOW);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -502,11 +502,13 @@ int main(int argc, char **argv)
|
|||||||
// strdup to put the sring in the core file for post mortem identification
|
// strdup to put the sring in the core file for post mortem identification
|
||||||
LOG_I(HW, "Version: %s\n", strdup(PACKAGE_VERSION));
|
LOG_I(HW, "Version: %s\n", strdup(PACKAGE_VERSION));
|
||||||
|
|
||||||
PHY_vars_UE_g = malloc(sizeof(*PHY_vars_UE_g));
|
PHY_vars_UE_g = malloc(sizeof(*PHY_vars_UE_g) * NB_UE_INST);
|
||||||
PHY_vars_UE_g[0] = malloc(sizeof(*PHY_vars_UE_g[0]) * MAX_NUM_CCs);
|
for (int inst = 0; inst < NB_UE_INST; inst++) {
|
||||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
PHY_vars_UE_g[inst] = malloc(sizeof(*PHY_vars_UE_g[inst]) * MAX_NUM_CCs);
|
||||||
PHY_vars_UE_g[0][CC_id] = malloc(sizeof(*PHY_vars_UE_g[0][CC_id]));
|
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||||
memset(PHY_vars_UE_g[0][CC_id], 0, sizeof(*PHY_vars_UE_g[0][CC_id]));
|
PHY_vars_UE_g[inst][CC_id] = malloc(sizeof(*PHY_vars_UE_g[inst][CC_id]));
|
||||||
|
memset(PHY_vars_UE_g[inst][CC_id], 0, sizeof(*PHY_vars_UE_g[inst][CC_id]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int mode_offset = get_softmodem_params()->nsa ? NUMBER_OF_UE_MAX : 1;
|
int mode_offset = get_softmodem_params()->nsa ? NUMBER_OF_UE_MAX : 1;
|
||||||
@@ -536,49 +538,51 @@ int main(int argc, char **argv)
|
|||||||
start_oai_nrue_threads();
|
start_oai_nrue_threads();
|
||||||
|
|
||||||
if (!get_softmodem_params()->emulate_l1) {
|
if (!get_softmodem_params()->emulate_l1) {
|
||||||
PHY_VARS_NR_UE *UE[MAX_NUM_CCs];
|
for (int inst = 0; inst < NB_UE_INST; inst++) {
|
||||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
PHY_VARS_NR_UE *UE[MAX_NUM_CCs];
|
||||||
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
|
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||||
|
UE[CC_id] = PHY_vars_UE_g[inst][CC_id];
|
||||||
|
|
||||||
set_options(CC_id, UE[CC_id]);
|
set_options(CC_id, UE[CC_id]);
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(inst);
|
||||||
|
|
||||||
if (get_softmodem_params()->sa || get_softmodem_params()->sl_mode) { // set frame config to initial values from command line
|
if (get_softmodem_params()->sa || get_softmodem_params()->sl_mode) { // set frame config to initial values from command line
|
||||||
// and assume that the SSB is centered on the grid
|
// and assume that the SSB is centered on the grid
|
||||||
uint16_t nr_band = get_softmodem_params()->band;
|
uint16_t nr_band = get_softmodem_params()->band;
|
||||||
mac->nr_band = nr_band;
|
mac->nr_band = nr_band;
|
||||||
mac->ssb_start_subcarrier = UE[CC_id]->frame_parms.ssb_start_subcarrier;
|
mac->ssb_start_subcarrier = UE[CC_id]->frame_parms.ssb_start_subcarrier;
|
||||||
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
|
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
|
||||||
downlink_frequency[CC_id][0],
|
downlink_frequency[CC_id][0],
|
||||||
uplink_frequency_offset[CC_id][0],
|
uplink_frequency_offset[CC_id][0],
|
||||||
get_softmodem_params()->numerology,
|
get_softmodem_params()->numerology,
|
||||||
nr_band);
|
nr_band);
|
||||||
} else {
|
} else {
|
||||||
DevAssert(mac->if_module != NULL && mac->if_module->phy_config_request != NULL);
|
DevAssert(mac->if_module != NULL && mac->if_module->phy_config_request != NULL);
|
||||||
mac->if_module->phy_config_request(&mac->phy_config);
|
mac->if_module->phy_config_request(&mac->phy_config);
|
||||||
mac->phy_config_request_sent = true;
|
mac->phy_config_request_sent = true;
|
||||||
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
|
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
|
||||||
|
|
||||||
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, mac->nr_band);
|
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, mac->nr_band);
|
||||||
}
|
}
|
||||||
|
|
||||||
UE[CC_id]->sl_mode = get_softmodem_params()->sl_mode;
|
UE[CC_id]->sl_mode = get_softmodem_params()->sl_mode;
|
||||||
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
|
init_nr_ue_vars(UE[CC_id], inst, abstraction_flag);
|
||||||
|
|
||||||
if (UE[CC_id]->sl_mode) {
|
if (UE[CC_id]->sl_mode) {
|
||||||
AssertFatal(UE[CC_id]->sl_mode == 2, "Only Sidelink mode 2 supported. Mode 1 not yet supported\n");
|
AssertFatal(UE[CC_id]->sl_mode == 2, "Only Sidelink mode 2 supported. Mode 1 not yet supported\n");
|
||||||
DevAssert(mac->if_module != NULL && mac->if_module->sl_phy_config_request != NULL);
|
DevAssert(mac->if_module != NULL && mac->if_module->sl_phy_config_request != NULL);
|
||||||
nr_sl_phy_config_t *phycfg = &mac->SL_MAC_PARAMS->sl_phy_config;
|
nr_sl_phy_config_t *phycfg = &mac->SL_MAC_PARAMS->sl_phy_config;
|
||||||
phycfg->sl_config_req.sl_carrier_config.sl_num_rx_ant = get_nrUE_params()->nb_antennas_rx;
|
phycfg->sl_config_req.sl_carrier_config.sl_num_rx_ant = get_nrUE_params()->nb_antennas_rx;
|
||||||
phycfg->sl_config_req.sl_carrier_config.sl_num_tx_ant = get_nrUE_params()->nb_antennas_tx;
|
phycfg->sl_config_req.sl_carrier_config.sl_num_tx_ant = get_nrUE_params()->nb_antennas_tx;
|
||||||
mac->if_module->sl_phy_config_request(phycfg);
|
mac->if_module->sl_phy_config_request(phycfg);
|
||||||
mac->phy_config_request_sent = true;
|
mac->phy_config_request_sent = true;
|
||||||
sl_nr_ue_phy_params_t *sl_phy = &UE[CC_id]->SL_UE_PHY_PARAMS;
|
sl_nr_ue_phy_params_t *sl_phy = &UE[CC_id]->SL_UE_PHY_PARAMS;
|
||||||
nr_init_frame_parms_ue_sl(&sl_phy->sl_frame_params,
|
nr_init_frame_parms_ue_sl(&sl_phy->sl_frame_params,
|
||||||
&sl_phy->sl_config,
|
&sl_phy->sl_config,
|
||||||
get_softmodem_params()->threequarter_fs,
|
get_softmodem_params()->threequarter_fs,
|
||||||
get_nrUE_params()->ofdm_offset_divisor);
|
get_nrUE_params()->ofdm_offset_divisor);
|
||||||
sl_ue_phy_init(UE[CC_id]);
|
sl_ue_phy_init(UE[CC_id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +597,10 @@ int main(int argc, char **argv)
|
|||||||
load_softscope("nr",PHY_vars_UE_g[0][0]);
|
load_softscope("nr",PHY_vars_UE_g[0][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
init_NR_UE_threads(1);
|
for (int inst = 0; inst < NB_UE_INST; inst++) {
|
||||||
|
LOG_I(PHY,"Intializing UE Threads for instance %d ...\n", inst);
|
||||||
|
init_NR_UE_threads(PHY_vars_UE_g[inst][0]);
|
||||||
|
}
|
||||||
printf("UE threads created by %ld\n", gettid());
|
printf("UE threads created by %ld\n", gettid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ extern nrUE_params_t *get_nrUE_params(void);
|
|||||||
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
|
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 fill_ue_band_info(void);
|
||||||
extern void init_NR_UE(int, char *, char *, char *);
|
extern void init_NR_UE(int, char *, char *, char *);
|
||||||
extern void init_NR_UE_threads(int);
|
extern void init_NR_UE_threads(PHY_VARS_NR_UE *ue);
|
||||||
extern void reset_opp_meas(void);
|
extern void reset_opp_meas(void);
|
||||||
extern void print_opp_meas(void);
|
extern void print_opp_meas(void);
|
||||||
void start_oai_nrue_threads(void);
|
void start_oai_nrue_threads(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user