Merge remote-tracking branch 'origin/multiple-nr-ues' into integration_2024_w27
This commit is contained in:
+14
-19
@@ -146,7 +146,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
||||
int nb_connected_gNB = 1;
|
||||
|
||||
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->target_Nid_cell = -1;
|
||||
|
||||
@@ -416,7 +416,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action)
|
||||
|
||||
radio_tx_burst_flag_t flags = TX_BURST_INVALID;
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(UE->Mod_id);
|
||||
if (mac->phy_config_request_sent &&
|
||||
openair0_cfg[0].duplex_mode == duplex_mode_TDD &&
|
||||
!get_softmodem_params()->continuous_tx) {
|
||||
@@ -769,7 +769,7 @@ void *UE_thread(void *arg)
|
||||
initNotifiedFIFO_nothreadSafe(&freeBlocks);
|
||||
|
||||
int timing_advance = UE->timing_advance;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(UE->Mod_id);
|
||||
|
||||
bool syncRunning = false;
|
||||
const int nb_slot_frame = fp->slots_per_frame;
|
||||
@@ -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);
|
||||
AssertFatal(mac->if_module, "can not initialize IF module\n");
|
||||
if (!get_softmodem_params()->sa || !get_softmodem_params()->sl_mode) {
|
||||
init_nsa_message(rrc_inst, reconfig_file, rbconfig_file);
|
||||
nr_rlc_activate_srb0(mac_inst->crnti, NULL, send_srb0_rrc);
|
||||
init_nsa_message(&rrc_inst[i], reconfig_file, rbconfig_file);
|
||||
nr_rlc_activate_srb0(mac_inst[i].crnti, NULL, send_srb0_rrc);
|
||||
}
|
||||
//TODO: Move this call to RRC
|
||||
start_sidelink((&rrc_inst[i])->ue_id);
|
||||
}
|
||||
}
|
||||
|
||||
void init_NR_UE_threads(int nb_inst) {
|
||||
int inst;
|
||||
|
||||
pthread_t threads[nb_inst];
|
||||
|
||||
for (inst=0; inst < nb_inst; inst++) {
|
||||
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0];
|
||||
|
||||
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(&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);
|
||||
}
|
||||
void init_NR_UE_threads(PHY_VARS_NR_UE *UE) {
|
||||
pthread_t thread;
|
||||
char thread_name[16];
|
||||
sprintf(thread_name, "UEthread_%d", UE->Mod_id);
|
||||
threadCreate(&thread, UE_thread, (void *)UE, thread_name, -1, OAI_PRIORITY_RT_MAX);
|
||||
if (!IS_SOFTMODEM_NOSTATS_BIT) {
|
||||
pthread_t stat_pthread;
|
||||
sprintf(thread_name, "L1_UE_stats_%d", UE->Mod_id);
|
||||
threadCreate(&stat_pthread, nrL1_UE_stats_thread, UE, thread_name, -1, OAI_PRIORITY_RT_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,11 +507,13 @@ int main(int argc, char **argv)
|
||||
// strdup to put the sring in the core file for post mortem identification
|
||||
LOG_I(HW, "Version: %s\n", strdup(PACKAGE_VERSION));
|
||||
|
||||
PHY_vars_UE_g = malloc(sizeof(*PHY_vars_UE_g));
|
||||
PHY_vars_UE_g[0] = malloc(sizeof(*PHY_vars_UE_g[0]) * MAX_NUM_CCs);
|
||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
PHY_vars_UE_g[0][CC_id] = malloc(sizeof(*PHY_vars_UE_g[0][CC_id]));
|
||||
memset(PHY_vars_UE_g[0][CC_id], 0, sizeof(*PHY_vars_UE_g[0][CC_id]));
|
||||
PHY_vars_UE_g = malloc(sizeof(*PHY_vars_UE_g) * NB_UE_INST);
|
||||
for (int inst = 0; inst < NB_UE_INST; inst++) {
|
||||
PHY_vars_UE_g[inst] = malloc(sizeof(*PHY_vars_UE_g[inst]) * MAX_NUM_CCs);
|
||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; 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;
|
||||
@@ -541,49 +543,51 @@ int main(int argc, char **argv)
|
||||
start_oai_nrue_threads();
|
||||
|
||||
if (!get_softmodem_params()->emulate_l1) {
|
||||
PHY_VARS_NR_UE *UE[MAX_NUM_CCs];
|
||||
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
|
||||
for (int inst = 0; inst < NB_UE_INST; inst++) {
|
||||
PHY_VARS_NR_UE *UE[MAX_NUM_CCs];
|
||||
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]);
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
set_options(CC_id, UE[CC_id]);
|
||||
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
|
||||
// and assume that the SSB is centered on the grid
|
||||
uint16_t nr_band = get_softmodem_params()->band;
|
||||
mac->nr_band = nr_band;
|
||||
mac->ssb_start_subcarrier = UE[CC_id]->frame_parms.ssb_start_subcarrier;
|
||||
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
|
||||
downlink_frequency[CC_id][0],
|
||||
uplink_frequency_offset[CC_id][0],
|
||||
get_softmodem_params()->numerology,
|
||||
nr_band);
|
||||
} else {
|
||||
DevAssert(mac->if_module != NULL && mac->if_module->phy_config_request != NULL);
|
||||
mac->if_module->phy_config_request(&mac->phy_config);
|
||||
mac->phy_config_request_sent = true;
|
||||
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
|
||||
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
|
||||
uint16_t nr_band = get_softmodem_params()->band;
|
||||
mac->nr_band = nr_band;
|
||||
mac->ssb_start_subcarrier = UE[CC_id]->frame_parms.ssb_start_subcarrier;
|
||||
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
|
||||
downlink_frequency[CC_id][0],
|
||||
uplink_frequency_offset[CC_id][0],
|
||||
get_softmodem_params()->numerology,
|
||||
nr_band);
|
||||
} else {
|
||||
DevAssert(mac->if_module != NULL && mac->if_module->phy_config_request != NULL);
|
||||
mac->if_module->phy_config_request(&mac->phy_config);
|
||||
mac->phy_config_request_sent = true;
|
||||
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;
|
||||
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
|
||||
UE[CC_id]->sl_mode = get_softmodem_params()->sl_mode;
|
||||
init_nr_ue_vars(UE[CC_id], inst, abstraction_flag);
|
||||
|
||||
if (UE[CC_id]->sl_mode) {
|
||||
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);
|
||||
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_tx_ant = get_nrUE_params()->nb_antennas_tx;
|
||||
mac->if_module->sl_phy_config_request(phycfg);
|
||||
mac->phy_config_request_sent = true;
|
||||
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,
|
||||
&sl_phy->sl_config,
|
||||
get_softmodem_params()->threequarter_fs,
|
||||
get_nrUE_params()->ofdm_offset_divisor);
|
||||
sl_ue_phy_init(UE[CC_id]);
|
||||
if (UE[CC_id]->sl_mode) {
|
||||
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);
|
||||
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_tx_ant = get_nrUE_params()->nb_antennas_tx;
|
||||
mac->if_module->sl_phy_config_request(phycfg);
|
||||
mac->phy_config_request_sent = true;
|
||||
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,
|
||||
&sl_phy->sl_config,
|
||||
get_softmodem_params()->threequarter_fs,
|
||||
get_nrUE_params()->ofdm_offset_divisor);
|
||||
sl_ue_phy_init(UE[CC_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,7 +602,10 @@ int main(int argc, char **argv)
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
{"chest-time", CONFIG_HLP_CHESTTIME, 0, .iptr=&(nrUE_params.chest_time), .defintval=0, TYPE_INT, 0}, \
|
||||
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, .iptr=&(nrUE_params.no_timing_correction), .defintval=0, TYPE_INT, 0}, \
|
||||
{"SLC", CONFIG_HLP_SLF, 0, .u64ptr=&(sidelink_frequency[0][0]), .defuintval=2600000000,TYPE_UINT64,0}, \
|
||||
{"num-ues", NULL, 0, .iptr=&(NB_UE_INST), .defuintval=1, TYPE_INT,0}, \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
@@ -93,7 +94,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 void fill_ue_band_info(void);
|
||||
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 print_opp_meas(void);
|
||||
void start_oai_nrue_threads(void);
|
||||
|
||||
@@ -1000,7 +1000,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
|
||||
|
||||
switch (csirs_config_pdu->measurement_bitmap) {
|
||||
case 1 :
|
||||
LOG_I(NR_PHY, "RSRP = %i dBm\n", rsrp_dBm);
|
||||
LOG_I(NR_PHY, "[UE %d] RSRP = %i dBm\n", ue->Mod_id, rsrp_dBm);
|
||||
break;
|
||||
case 26 :
|
||||
LOG_I(NR_PHY, "RI = %i i1 = %i.%i.%i, i2 = %i, SINR = %i dB, CQI = %i\n",
|
||||
|
||||
@@ -994,7 +994,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
|
||||
char output[harq_output_len];
|
||||
char *p = output;
|
||||
const char *end = output + harq_output_len;
|
||||
p += snprintf(p, end - p, "Harq round stats for Downlink: %d", ue->dl_stats[0]);
|
||||
p += snprintf(p, end - p, "[UE %d] Harq round stats for Downlink: %d", ue->Mod_id, ue->dl_stats[0]);
|
||||
for (int round = 1; round < 16 && (round < 3 || ue->dl_stats[round] != 0); ++round)
|
||||
p += snprintf(p, end - p,"/%d", ue->dl_stats[round]);
|
||||
LOG_I(NR_PHY,"%s\n", output);
|
||||
|
||||
@@ -250,7 +250,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
|
||||
// carrier config
|
||||
LOG_D(MAC, "Entering UE Config Common\n");
|
||||
LOG_D(MAC, "[UE %d] Entering UE Config Common\n", mac->ue_id);
|
||||
|
||||
AssertFatal(scc->downlinkConfigCommon, "Not expecting downlinkConfigCommon to be NULL here\n");
|
||||
|
||||
@@ -2252,7 +2252,7 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
|
||||
NR_CellGroupConfig_t *cell_group_config,
|
||||
NR_UE_NR_Capability_t *ue_Capability)
|
||||
{
|
||||
LOG_I(MAC,"Applying CellGroupConfig from gNodeB\n");
|
||||
LOG_I(MAC,"[UE %d] Applying CellGroupConfig from gNodeB\n", module_id);
|
||||
AssertFatal(cell_group_config, "CellGroupConfig should not be NULL\n");
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst)
|
||||
AssertFatal(nr_ue_mac_inst, "Couldn't allocate %d instances of MAC module\n", nb_inst);
|
||||
|
||||
for (int j = 0; j < nb_inst; j++) {
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(j);
|
||||
NR_UE_MAC_INST_t *mac = &nr_ue_mac_inst[j];
|
||||
mac->ue_id = j;
|
||||
nr_ue_init_mac(mac);
|
||||
nr_ue_mac_default_configs(mac);
|
||||
|
||||
@@ -147,7 +147,7 @@ void mac_rlc_data_ind(const module_id_t module_idP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP)
|
||||
{
|
||||
if (module_idP != 0 || eNB_index != 0 || /*enb_flagP != 1 ||*/ MBMS_flagP != 0) {
|
||||
if (eNB_index != 0 || /*enb_flagP != 1 ||*/ MBMS_flagP != 0) {
|
||||
LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc,
|
||||
nr_rrc_cellgroup_configuration(rrc, cellGroupConfig);
|
||||
|
||||
AssertFatal(!get_softmodem_params()->sa, "secondaryCellGroup only used in NSA for now\n");
|
||||
nr_rrc_mac_config_req_cg(0, 0, cellGroupConfig, rrc->UECap.UE_NR_Capability);
|
||||
nr_rrc_mac_config_req_cg(rrc->ue_id, 0, cellGroupConfig, rrc->UECap.UE_NR_Capability);
|
||||
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, cellGroupConfig);
|
||||
}
|
||||
if (ie->measConfig != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user