Commit 5661b20e authored by francescomani's avatar francescomani

improving init for dora and phytest

parent 8013d5d8
...@@ -944,14 +944,15 @@ void *UE_thread(void *arg) ...@@ -944,14 +944,15 @@ void *UE_thread(void *arg)
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 inst;
NR_UE_MAC_INST_t *mac_inst; NR_UE_MAC_INST_t *mac_inst;
NR_UE_RRC_INST_t* rrc_inst; NR_UE_RRC_INST_t* rrc_inst;
for (inst=0; inst < nb_inst; inst++) { for (int inst = 0; inst < nb_inst; inst++) {
AssertFatal((rrc_inst = nr_l3_init_ue(uecap_file, reconfig_file, rbconfig_file)) != NULL, "can not initialize RRC module\n"); AssertFatal((rrc_inst = nr_l3_init_ue(uecap_file)) != NULL, "can not initialize RRC module\n");
AssertFatal((mac_inst = nr_l2_init_ue(rrc_inst)) != NULL, "can not initialize L2 module\n"); AssertFatal((mac_inst = nr_l2_init_ue(rrc_inst)) != NULL, "can not initialize L2 module\n");
AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n"); AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n");
if (!get_softmodem_params()->sa)
init_nsa_message(rrc_inst, reconfig_file, rbconfig_file);
} }
} }
......
...@@ -695,6 +695,8 @@ int main(int argc, char *argv[]) ...@@ -695,6 +695,8 @@ int main(int argc, char *argv[])
nr_l2_init_ue(&rrcue); nr_l2_init_ue(&rrcue);
NR_UE_MAC_INST_t* UE_mac = get_mac_inst(0); NR_UE_MAC_INST_t* UE_mac = get_mac_inst(0);
ue_init_config_request(UE_mac, mu);
UE->if_inst = nr_ue_if_module_init(0); UE->if_inst = nr_ue_if_module_init(0);
UE->if_inst->scheduled_response = nr_ue_scheduled_response; UE->if_inst->scheduled_response = nr_ue_scheduled_response;
......
...@@ -812,6 +812,8 @@ void nr_rrc_mac_config_req_scg(module_id_t module_id, ...@@ -812,6 +812,8 @@ void nr_rrc_mac_config_req_scg(module_id_t module_id,
if (scell_group_config->spCellConfig->reconfigurationWithSync) if (scell_group_config->spCellConfig->reconfigurationWithSync)
handle_reconfiguration_with_sync(mac, module_id, cc_idP, scell_group_config->spCellConfig->reconfigurationWithSync); handle_reconfiguration_with_sync(mac, module_id, cc_idP, scell_group_config->spCellConfig->reconfigurationWithSync);
configure_current_BWP(mac, NULL, scell_group_config); configure_current_BWP(mac, NULL, scell_group_config);
if (!mac->dl_config_request || !mac->ul_config_request)
ue_init_config_request(mac, mac->current_DL_BWP.scs);
// Setup the SSB to Rach Occasions mapping according to the config // Setup the SSB to Rach Occasions mapping according to the config
build_ssb_to_ro_map(mac); build_ssb_to_ro_map(mac);
} }
...@@ -63,11 +63,9 @@ void send_msg3_rrc_request(module_id_t mod_id, int rnti) ...@@ -63,11 +63,9 @@ void send_msg3_rrc_request(module_id_t mod_id, int rnti)
nr_mac_rrc_msg3_ind(mod_id, rnti); nr_mac_rrc_msg3_ind(mod_id, rnti);
} }
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
{
//LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n"); LOG_I(NR_MAC, "MAIN: init UE MAC functions \n");
//LOG_I(MAC, "[MAIN] init UE MAC functions \n");
//init mac here //init mac here
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(NB_NR_UE_MAC_INST, sizeof(NR_UE_MAC_INST_t)); nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(NB_NR_UE_MAC_INST, sizeof(NR_UE_MAC_INST_t));
...@@ -75,17 +73,11 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { ...@@ -75,17 +73,11 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
for (int j = 0; j < NB_NR_UE_MAC_INST; j++) for (int j = 0; j < NB_NR_UE_MAC_INST; j++)
nr_ue_init_mac(j); nr_ue_init_mac(j);
int scs = get_softmodem_params()->sa ? if (get_softmodem_params()->sa)
get_softmodem_params()->numerology : ue_init_config_request(nr_ue_mac_inst, get_softmodem_params()->numerology);
rrc_inst ?
*rrc_inst->scell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon->ssbSubcarrierSpacing :
- 1;
if (scs > -1)
ue_init_config_request(nr_ue_mac_inst, scs);
if (rrc_inst && rrc_inst->scell_group_config) { if (rrc_inst && rrc_inst->scell_group_config) {
nr_rrc_mac_config_req_scg(0, 0, rrc_inst->scell_group_config);
int rc = rlc_module_init(0); int rc = rlc_module_init(0);
AssertFatal(rc == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); AssertFatal(rc == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
nr_rlc_activate_srb0(nr_ue_mac_inst->crnti, NULL, send_srb0_rrc); nr_rlc_activate_srb0(nr_ue_mac_inst->crnti, NULL, send_srb0_rrc);
......
...@@ -33,10 +33,41 @@ ...@@ -33,10 +33,41 @@
#include "defs.h" #include "defs.h"
#include "rrc_proto.h" #include "rrc_proto.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "executables/softmodem-common.h"
NR_UE_RRC_INST_t* nr_l3_init_ue(char* uecap, char* reconfig_file, char* rbconfig_file) NR_UE_RRC_INST_t* nr_l3_init_ue(char* uecap)
{ {
// LOG_I(RRC, "[MAIN] NR UE MAC initialization...\n"); return openair_rrc_top_init_ue_nr(uecap);
}
void init_nsa_message(NR_UE_RRC_INST_t *rrc, char* reconfig_file, char* rbconfig_file)
{
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1) {
// read in files for RRCReconfiguration and RBconfig
LOG_I(NR_RRC, "using %s for rrc init[1/2]\n", reconfig_file);
FILE *fd = fopen(reconfig_file, "r");
AssertFatal(fd,
"cannot read file %s: errno %d, %s\n",
reconfig_file,
errno,
strerror(errno));
char buffer[1024];
int msg_len = fread(buffer, 1, 1024, fd);
fclose(fd);
process_nsa_message(rrc, nr_SecondaryCellGroupConfig_r15, buffer, msg_len);
return openair_rrc_top_init_ue_nr(uecap, reconfig_file, rbconfig_file); LOG_I(NR_RRC, "using %s for rrc init[2/2]\n", rbconfig_file);
fd = fopen(rbconfig_file, "r");
AssertFatal(fd,
"cannot read file %s: errno %d, %s\n",
rbconfig_file,
errno,
strerror(errno));
msg_len = fread(buffer, 1, 1024, fd);
fclose(fd);
process_nsa_message(rrc, nr_RadioBearerConfigX_r15, buffer,msg_len);
}
else
LOG_D(NR_RRC, "In NSA mode \n");
} }
...@@ -257,8 +257,10 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, ...@@ -257,8 +257,10 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance,
if (get_softmodem_params()->nsa) { if (get_softmodem_params()->nsa) {
nr_rrc_mac_config_req_scg(0, 0, secondCellGroupConfig); nr_rrc_mac_config_req_scg(0, 0, secondCellGroupConfig);
} }
} else } else {
nr_rrc_mac_config_req_scg(0, 0, secondCellGroupConfig);
nr_rrc_ue_decode_secondary_cellgroup_config(rrc, secondCellGroupConfig); nr_rrc_ue_decode_secondary_cellgroup_config(rrc, secondCellGroupConfig);
}
} }
if (ie->measConfig != NULL) { if (ie->measConfig != NULL) {
LOG_I(NR_RRC, "Measurement Configuration is present\n"); LOG_I(NR_RRC, "Measurement Configuration is present\n");
...@@ -283,7 +285,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, ...@@ -283,7 +285,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance,
return; return;
} }
static void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, void *message, int msg_len) void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, void *message, int msg_len)
{ {
switch (nsa_message_type) { switch (nsa_message_type) {
case nr_SecondaryCellGroupConfig_r15: case nr_SecondaryCellGroupConfig_r15:
...@@ -341,7 +343,7 @@ static void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message ...@@ -341,7 +343,7 @@ static void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message
} }
} }
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* reconfig_file, char* rbconfig_file) NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file)
{ {
if(NB_NR_UE_INST > 0) { if(NB_NR_UE_INST > 0) {
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(NB_NR_UE_INST , sizeof(NR_UE_RRC_INST_t)); NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(NB_NR_UE_INST , sizeof(NR_UE_RRC_INST_t));
...@@ -368,35 +370,6 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* reconfig_fi ...@@ -368,35 +370,6 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* reconfig_fi
NR_UE_rrc_inst->uecap_file = uecap_file; NR_UE_rrc_inst->uecap_file = uecap_file;
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1) {
// read in files for RRCReconfiguration and RBconfig
LOG_I(NR_RRC, "using %s for rrc init[1/2]\n", reconfig_file);
FILE *fd = fopen(reconfig_file,"r");
AssertFatal(fd,
"cannot read file %s: errno %d, %s\n",
reconfig_file,
errno,
strerror(errno));
char buffer[1024];
int msg_len=fread(buffer,1,1024,fd);
fclose(fd);
process_nsa_message(NR_UE_rrc_inst, nr_SecondaryCellGroupConfig_r15, buffer,msg_len);
LOG_I(NR_RRC, "using %s for rrc init[2/2]\n", rbconfig_file);
fd = fopen(rbconfig_file,"r");
AssertFatal(fd,
"cannot read file %s: errno %d, %s\n",
rbconfig_file,
errno,
strerror(errno));
msg_len=fread(buffer,1,1024,fd);
fclose(fd);
process_nsa_message(NR_UE_rrc_inst, nr_RadioBearerConfigX_r15, buffer,msg_len);
} else if (get_softmodem_params()->nsa) {
LOG_D(NR_RRC, "In NSA mode \n");
}
if (get_softmodem_params()->sl_mode) { if (get_softmodem_params()->sl_mode) {
configure_NR_SL_Preconfig(get_softmodem_params()->sync_ref); configure_NR_SL_Preconfig(get_softmodem_params()->sync_ref);
} }
......
...@@ -56,14 +56,17 @@ extern queue_t nr_ul_tti_req_queue; ...@@ -56,14 +56,17 @@ extern queue_t nr_ul_tti_req_queue;
// main_rrc.c // main_rrc.c
// //
/**\brief Layer 3 initialization*/ /**\brief Layer 3 initialization*/
NR_UE_RRC_INST_t *nr_l3_init_ue(char *, char *, char *); NR_UE_RRC_INST_t *nr_l3_init_ue(char *);
// //
// UE_rrc.c // UE_rrc.c
// //
/**\brief Initial the top level RRC structure instance*/ /**\brief Initial the top level RRC structure instance*/
NR_UE_RRC_INST_t *openair_rrc_top_init_ue_nr(char *, char *, char *); NR_UE_RRC_INST_t *openair_rrc_top_init_ue_nr(char *);
void init_nsa_message (NR_UE_RRC_INST_t *rrc, char* reconfig_file, char* rbconfig_file);
void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, void *message, int msg_len);
/**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP) /**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP)
\param module_id module id \param module_id module id
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment