Commit 8a7aac41 authored by Swetank Srivastava's avatar Swetank Srivastava

indentation fixes

parent 54cae243
......@@ -302,7 +302,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
/*if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
LOG_E(GNB_APP, "Create task for gNB APP failed\n");
return -1;
}*/
}*/
if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SCTP failed\n");
return -1;
......@@ -319,21 +319,21 @@ int create_gNB_tasks(uint32_t gnb_nb) {
if (AMF_MODE_ENABLED) {
char* gnb_ipv4_address_for_NGU = NULL;
uint32_t gnb_port_for_NGU = 0;
char* gnb_ipv4_address_for_S1U = NULL;
uint32_t gnb_port_for_S1U = 0;
char* gnb_ipv4_address_for_NGU = NULL;
uint32_t gnb_port_for_NGU = 0;
char* gnb_ipv4_address_for_S1U = NULL;
uint32_t gnb_port_for_S1U = 0;
paramdef_t NETParams[] = GNBNETPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) {
if( NETParams[i].strptr == NULL) {
LOG_E(NGAP, "No configuration in the file.\n");
NGAP_CONF_MODE = 0;
LOG_E(NGAP, "No configuration in the file.\n");
NGAP_CONF_MODE = 0;
} else {
LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr);
LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr);
}
}
......@@ -351,7 +351,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
if (gnb_nb > 0) {
RCconfig_nr_ssparam();
RCconfig_nr_ssparam();
if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
LOG_E(GNB_APP, "Create task for gNB APP failed\n");
return -1;
......@@ -372,11 +372,11 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
if(itti_create_task(TASK_SS_SRB, ss_gNB_srb_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SS SRB failed\n");
return -1;
}
LOG_I(NR_RRC,"Creating NR RRC gNB Task\n");
if(itti_create_task(TASK_SS_SRB, ss_gNB_srb_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SS SRB failed\n");
return -1;
}
LOG_I(NR_RRC,"Creating NR RRC gNB Task\n");
if (itti_create_task (TASK_RRC_GNB, rrc_gnb_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for NR RRC gNB failed\n");
......@@ -391,11 +391,11 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
if (itti_create_task(TASK_UDP, udp_eNB_task, NULL) < 0)
{
LOG_E(GTPU, "Create task for UDP failed\n");
return -1;
}
if (itti_create_task(TASK_UDP, udp_eNB_task, NULL) < 0)
{
LOG_E(GTPU, "Create task for UDP failed\n");
return -1;
}
}
......
......@@ -67,26 +67,26 @@ static void wait_cell_config_5G(char *thread_name);
/*------------------------------------------------------------------------------*/
static void configure_nr_rrc(uint32_t gnb_id)
{
MessageDef *msg_p = NULL;
// int CC_id;
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ);
RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]);
if (RC.nrrrc[gnb_id]) {
if (RC.ss.mode == SS_SOFTMODEM)
{
/** wait for signal */
wait_cell_config_5G("TASK_SYS_GNB");
LOG_I(GNB_APP, "fxn:%s: Received Cell Config 5G SA\n", __FUNCTION__);
}
LOG_I(GNB_APP, "RRC starting with node type %d\n", RC.nrrrc[gnb_id]->node_type);
LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n");
itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
}
else AssertFatal(0,"NRRRC context for gNB %d not allocated\n",gnb_id);
MessageDef *msg_p = NULL;
// int CC_id;
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ);
RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]);
if (RC.nrrrc[gnb_id]) {
if (RC.ss.mode == SS_SOFTMODEM)
{
/** wait for signal */
wait_cell_config_5G("TASK_SYS_GNB");
LOG_I(GNB_APP, "fxn:%s: Received Cell Config 5G SA\n", __FUNCTION__);
}
LOG_I(GNB_APP, "RRC starting with node type %d\n", RC.nrrrc[gnb_id]->node_type);
LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n");
itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
}
else AssertFatal(0,"NRRRC context for gNB %d not allocated\n",gnb_id);
}
/*------------------------------------------------------------------------------*/
......@@ -150,199 +150,199 @@ static uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end)
void *gNB_app_task(void *args_p)
{
uint32_t gnb_nb = RC.nb_nr_inst;
uint32_t gnb_id_start = 0;
uint32_t gnb_id_end = gnb_id_start + gnb_nb;
uint32_t gnb_id;
MessageDef *msg_p = NULL;
const char *msg_name = NULL;
instance_t instance;
int result;
/* for no gcc warnings */
(void)instance;
int cell_to_activate = 0;
itti_mark_task_ready (TASK_GNB_APP);
uint32_t gnb_nb = RC.nb_nr_inst;
uint32_t gnb_id_start = 0;
uint32_t gnb_id_end = gnb_id_start + gnb_nb;
uint32_t gnb_id;
MessageDef *msg_p = NULL;
const char *msg_name = NULL;
instance_t instance;
int result;
/* for no gcc warnings */
(void)instance;
int cell_to_activate = 0;
itti_mark_task_ready (TASK_GNB_APP);
LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__);
RCconfig_NR_L1();
if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc();
LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__);
RCconfig_NR_L1();
// RCconfig_nr_ssparam();
if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc();
// RCconfig_nr_ssparam();
LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst);
LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst);
if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n");
if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n");
AssertFatal (gnb_nb <= RC.nb_nr_inst,
"Number of gNB is greater than gNB defined in configuration file (%d/%d)!",
gnb_nb, RC.nb_nr_inst);
AssertFatal (gnb_nb <= RC.nb_nr_inst,
"Number of gNB is greater than gNB defined in configuration file (%d/%d)!",
gnb_nb, RC.nb_nr_inst);
LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst);
LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst);
RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *));
LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc);
RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *));
LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc);
for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) {
RC.nrrrc[gnb_id] = (gNB_RRC_INST*)calloc(1,sizeof(gNB_RRC_INST));
LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, gnb_id_end);
configure_nr_rrc(gnb_id);
}
if (RC.nb_nr_inst > 0 && !get_softmodem_params()->nsa) {
init_pdcp();
}
if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(RC.rrc[0]->node_type)
LOG_I(X2AP, "X2AP enabled \n");
__attribute__((unused)) uint32_t x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end);
}
/* For the CU case the gNB registration with the AMF might have to take place after the F1 setup, as the PLMN info
* can originate from the DU. Add check on whether x2ap is enabled to account for ENDC NSA scenario.*/
if ((AMF_MODE_ENABLED || is_x2ap_enabled()) && !NODE_IS_DU(RC.nrrrc[0]->node_type) ) {
/* Try to register each gNB */
//registered_gnb = 0;
__attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);
}
for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) {
RC.nrrrc[gnb_id] = (gNB_RRC_INST*)calloc(1,sizeof(gNB_RRC_INST));
LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, gnb_id_end);
configure_nr_rrc(gnb_id);
}
if (RC.nb_nr_inst > 0) {
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
if (RC.nb_nr_inst > 0 && !get_softmodem_params()->nsa) {
init_pdcp();
}
if (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) {
LOG_E(F1AP, "Create task for F1AP CU failed\n");
AssertFatal(1==0,"exiting");
}
}
if (NODE_IS_DU(RC.nrrrc[0]->node_type)) {
if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(RC.rrc[0]->node_type)
LOG_I(X2AP, "X2AP enabled \n");
__attribute__((unused)) uint32_t x2_register_gnb_pending = gNB_app_register_x2 (gnb_id_start, gnb_id_end);
}
if (itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL) < 0) {
LOG_E(F1AP, "Create task for F1AP DU failed\n");
AssertFatal(1==0,"exiting");
}
// configure F1AP here for F1C
LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n");
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ);
RCconfig_NR_DU_F1(msg_p, 0);
/* For the CU case the gNB registration with the AMF might have to take place after the F1 setup, as the PLMN info
* can originate from the DU. Add check on whether x2ap is enabled to account for ENDC NSA scenario.*/
if ((AMF_MODE_ENABLED || is_x2ap_enabled()) && !NODE_IS_DU(RC.nrrrc[0]->node_type) ) {
/* Try to register each gNB */
//registered_gnb = 0;
__attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);
}
itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p);
}
}
do {
// Wait for a message
itti_receive_msg (TASK_GNB_APP, &msg_p);
if (RC.nb_nr_inst > 0) {
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p);
if (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) {
LOG_E(F1AP, "Create task for F1AP CU failed\n");
AssertFatal(1==0,"exiting");
}
}
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(GNB_APP, " *** Exiting GNB_APP thread\n");
itti_exit_task ();
break;
if (NODE_IS_DU(RC.nrrrc[0]->node_type)) {
case MESSAGE_TEST:
LOG_I(GNB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p));
break;
if (itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL) < 0) {
LOG_E(F1AP, "Create task for F1AP DU failed\n");
AssertFatal(1==0,"exiting");
}
// configure F1AP here for F1C
LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n");
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ);
RCconfig_NR_DU_F1(msg_p, 0);
itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p);
}
}
do {
// Wait for a message
itti_receive_msg (TASK_GNB_APP, &msg_p);
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p);
case NGAP_REGISTER_GNB_CNF:
LOG_I(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name,
NGAP_REGISTER_GNB_CNF(msg_p).nb_amf);
/*
DevAssert(register_gnb_pending > 0);
register_gnb_pending--;
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(GNB_APP, " *** Exiting GNB_APP thread\n");
itti_exit_task ();
break;
// Check if at least gNB is registered with one AMF
if (NGAP_REGISTER_GNB_CNF(msg_p).nb_amf > 0) {
registered_gnb++;
}
case MESSAGE_TEST:
LOG_I(GNB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p));
break;
// Check if all register gNB requests have been processed
if (register_gnb_pending == 0) {
if (registered_gnb == gnb_nb) {
// If all gNB are registered, start L2L1 task
MessageDef *msg_init_p;
msg_init_p = itti_alloc_new_message (TASK_GNB_APP, 0, INITIALIZE_MESSAGE);
itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p);
} else {
uint32_t not_associated = gnb_nb - registered_gnb;
LOG_W(GNB_APP, " %d gNB %s not associated with a AMF, retrying registration in %d seconds ...\n",
not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY);
// Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds
if (timer_setup (GNB_REGISTER_RETRY_DELAY, 0, TASK_GNB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
NULL, &gnb_register_retry_timer_id) < 0) {
LOG_E(GNB_APP, " Can not start gNB register retry timer, use \"sleep\" instead!\n");
sleep(GNB_REGISTER_RETRY_DELAY);
// Restart the registration process
registered_gnb = 0;
register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p);
}
}
}
*/
break;
case F1AP_SETUP_RESP:
AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_SETUP_RESP in CU/gNB\n");
LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p),
F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate);
cell_to_activate = F1AP_SETUP_RESP(msg_p).num_cells_to_activate;
gNB_app_handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p));
break;
case F1AP_GNB_CU_CONFIGURATION_UPDATE:
AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_GNB_CU_CONFIGURATION_UPDATE in CU/gNB\n");
LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p),
F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).gNB_CU_name,F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate);
cell_to_activate += F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate;
gNB_app_handle_f1ap_gnb_cu_configuration_update(&F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p));
/* Check if at least gNB is registered with one AMF */
AssertFatal(cell_to_activate == 1,"No cells to activate or cells > 1 %d\n",cell_to_activate);
break;
case NGAP_DEREGISTERED_GNB_IND:
LOG_W(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name,
NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf);
/* TODO handle recovering of registration */
break;
case TIMER_HAS_EXPIRED:
LOG_I(GNB_APP, " Received %s: timer_id %ld\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id);
//if (TIMER_HAS_EXPIRED (msg_p).timer_id == gnb_register_retry_timer_id) {
/* Restart the registration process */
// registered_gnb = 0;
// register_gnb_pending = gNB_app_register(gnb_id_start, gnb_id_end);//, gnb_properties_p);
//}
case NGAP_REGISTER_GNB_CNF:
LOG_I(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name,
NGAP_REGISTER_GNB_CNF(msg_p).nb_amf);
/*
DevAssert(register_gnb_pending > 0);
register_gnb_pending--;
break;
// Check if at least gNB is registered with one AMF
if (NGAP_REGISTER_GNB_CNF(msg_p).nb_amf > 0) {
registered_gnb++;
}
default:
LOG_E(GNB_APP, "Received unexpected message %s\n", msg_name);
break;
}
// Check if all register gNB requests have been processed
if (register_gnb_pending == 0) {
if (registered_gnb == gnb_nb) {
// If all gNB are registered, start L2L1 task
MessageDef *msg_init_p;
msg_init_p = itti_alloc_new_message (TASK_GNB_APP, 0, INITIALIZE_MESSAGE);
itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p);
} else {
uint32_t not_associated = gnb_nb - registered_gnb;
LOG_W(GNB_APP, " %d gNB %s not associated with a AMF, retrying registration in %d seconds ...\n",
not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY);
// Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds
if (timer_setup (GNB_REGISTER_RETRY_DELAY, 0, TASK_GNB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
NULL, &gnb_register_retry_timer_id) < 0) {
LOG_E(GNB_APP, " Can not start gNB register retry timer, use \"sleep\" instead!\n");
sleep(GNB_REGISTER_RETRY_DELAY);
// Restart the registration process
registered_gnb = 0;
register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p);
}
}
}
*/
break;
case F1AP_SETUP_RESP:
AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_SETUP_RESP in CU/gNB\n");
LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p),
F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate);
cell_to_activate = F1AP_SETUP_RESP(msg_p).num_cells_to_activate;
gNB_app_handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p));
break;
case F1AP_GNB_CU_CONFIGURATION_UPDATE:
AssertFatal(NODE_IS_DU(RC.nrrrc[0]->node_type), "Should not have received F1AP_GNB_CU_CONFIGURATION_UPDATE in CU/gNB\n");
LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p),
F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).gNB_CU_name,F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate);
cell_to_activate += F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).num_cells_to_activate;
gNB_app_handle_f1ap_gnb_cu_configuration_update(&F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p));
/* Check if at least gNB is registered with one AMF */
AssertFatal(cell_to_activate == 1,"No cells to activate or cells > 1 %d\n",cell_to_activate);
break;
case NGAP_DEREGISTERED_GNB_IND:
LOG_W(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name,
NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf);
/* TODO handle recovering of registration */
break;
case TIMER_HAS_EXPIRED:
LOG_I(GNB_APP, " Received %s: timer_id %ld\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id);
//if (TIMER_HAS_EXPIRED (msg_p).timer_id == gnb_register_retry_timer_id) {
/* Restart the registration process */
// registered_gnb = 0;
// register_gnb_pending = gNB_app_register(gnb_id_start, gnb_id_end);//, gnb_properties_p);
//}
break;
default:
LOG_E(GNB_APP, "Received unexpected message %s\n", msg_name);
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} while (1);
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} while (1);
return NULL;
return NULL;
}
......
......@@ -1210,34 +1210,34 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
genericParameters = &bwp->bwp_Common->genericParameters;
pdsch_TimeDomainAllocationList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
LOG_D(NR_MAC, "swetank: fxn:%s line:%d \n", __FUNCTION__, __LINE__);
LOG_D(NR_MAC, "swetank: fxn:%s line:%d \n", __FUNCTION__, __LINE__);
}
else {
genericParameters= &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
pdsch_TimeDomainAllocationList = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
LOG_D(NR_MAC, "swetank: fxn:%s line:%d \n", __FUNCTION__, __LINE__);
LOG_D(NR_MAC, "swetank: fxn:%s line:%d \n", __FUNCTION__, __LINE__);
}
long BWPStart = 0;
long BWPSize = 0;
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = NULL;
LOG_D(NR_MAC, "swetank: controlResourceSetId:%d locationAndBandwidth:%d genericParameters.locationAndBandwidth:%d \n",
*ss->controlResourceSetId,
genericParameters->locationAndBandwidth,
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth);
LOG_D(NR_MAC, "swetank: controlResourceSetId:%d locationAndBandwidth:%d genericParameters.locationAndBandwidth:%d \n",
*ss->controlResourceSetId,
genericParameters->locationAndBandwidth,
scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth);
if(*ss->controlResourceSetId!=0) {
BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
LOG_D(NR_MAC, "swetank: BWPStart:%d BWPSize:%d\n", BWPStart, BWPSize);
LOG_D(NR_MAC, "swetank: BWPStart:%d BWPSize:%d\n", BWPStart, BWPSize);
} else {
type0_PDCCH_CSS_config = &nr_mac->type0_PDCCH_CSS_config[ra->beam_id];
BWPStart = type0_PDCCH_CSS_config->cset_start_rb;
BWPSize = type0_PDCCH_CSS_config->num_rbs;
LOG_D(NR_MAC, "swetank: BWPStart:%d BWPSize:%d beam_id:%d \n", BWPStart, BWPSize, ra->beam_id);
LOG_D(NR_MAC, "swetank: BWPStart:%d BWPSize:%d beam_id:%d \n", BWPStart, BWPSize, ra->beam_id);
}
if (RC.ss.mode == SS_SOFTMODEM)
BWPStart = 27;
if (RC.ss.mode == SS_SOFTMODEM)
BWPStart = 27;
// Calculate number of symbols
int startSymbolIndex, nrOfSymbols;
......@@ -1280,12 +1280,12 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
int CCEIndex = find_pdcch_candidate(nr_mac,
CC_id,
aggregation_level,
nr_of_candidates,
&ra->sched_pdcch,
coreset,
0);
CC_id,
aggregation_level,
nr_of_candidates,
&ra->sched_pdcch,
coreset,
0);
if (CCEIndex < 0) {
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti);
......@@ -1320,7 +1320,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
LOG_A(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d, CoreSetType %d\n",
module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state,pdcch_pdu_rel15->CoreSetType);
module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state,pdcch_pdu_rel15->CoreSetType);
// SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control
// information to data and is reset every slot.
......@@ -1377,10 +1377,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex;
pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols;
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
nrOfSymbols,
startSymbolIndex,
mappingtype, 1);
nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
nrOfSymbols,
startSymbolIndex,
mappingtype, 1);
uint8_t tb_scaling = 0;
int R, Qm;
......@@ -1401,13 +1401,13 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
R = nr_get_code_rate_dl(mcsIndex, mcsTableIdx);
Qm = nr_get_Qm_dl(mcsIndex, mcsTableIdx);
TBS = nr_compute_tbs(Qm,
R,
rbSize,
nrOfSymbols,
N_PRB_DMRS*dmrs_length,
0, // overhead
tb_scaling, // tb scaling
1)>>3; // layers
R,
rbSize,
nrOfSymbols,
N_PRB_DMRS*dmrs_length,
0, // overhead
tb_scaling, // tb scaling
1)>>3; // layers
pdsch_pdu_rel15->targetCodeRate[0] = R;
pdsch_pdu_rel15->qamModOrder[0] = Qm;
......@@ -1428,12 +1428,12 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
dci_pdu_rel15_t dci_payload;
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,
BWPSize);
pdsch_pdu_rel15->rbStart,
BWPSize);
LOG_D(NR_MAC,"Msg2 rbSize.rbStart.BWPsize %d.%d.%ld\n",pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,
BWPSize);
pdsch_pdu_rel15->rbStart,
BWPSize);
dci_payload.time_domain_assignment.val = time_domain_assignment;
dci_payload.vrb_to_prb_mapping.val = 0;
......@@ -1441,33 +1441,33 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
dci_payload.tb_scaling = tb_scaling;
LOG_D(NR_MAC,
"[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%ld), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n",
dci_payload.frequency_domain_assignment.val,
pdsch_pdu_rel15->rbStart,
pdsch_pdu_rel15->rbSize,
BWPSize,
dci_payload.time_domain_assignment.val,
dci_payload.vrb_to_prb_mapping.val,
dci_payload.mcs,
dci_payload.tb_scaling);
"[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%ld), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n",
dci_payload.frequency_domain_assignment.val,
pdsch_pdu_rel15->rbStart,
pdsch_pdu_rel15->rbSize,
BWPSize,
dci_payload.time_domain_assignment.val,
dci_payload.vrb_to_prb_mapping.val,
dci_payload.mcs,
dci_payload.tb_scaling);
LOG_D(NR_MAC,
"[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
pdcch_pdu_rel15->dci_pdu[0].RNTI,
NR_RNTI_RA,
NR_DL_DCI_FORMAT_1_0,
*(unsigned long long *)pdcch_pdu_rel15->FreqDomainResource,
pdcch_pdu_rel15->StartSymbolIndex,
pdcch_pdu_rel15->DurationSymbols);
"[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
pdcch_pdu_rel15->dci_pdu[0].RNTI,
NR_RNTI_RA,
NR_DL_DCI_FORMAT_1_0,
*(unsigned long long *)pdcch_pdu_rel15->FreqDomainResource,
pdcch_pdu_rel15->StartSymbolIndex,
pdcch_pdu_rel15->DurationSymbols);
fill_dci_pdu_rel15(scc,
ra->CellGroup,
&pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1],
&dci_payload,
NR_DL_DCI_FORMAT_1_0,
NR_RNTI_RA,
BWPSize,
bwpid);
ra->CellGroup,
&pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1],
&dci_payload,
NR_DL_DCI_FORMAT_1_0,
NR_RNTI_RA,
BWPSize,
bwpid);
// DL TX request
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
......@@ -1484,7 +1484,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
}
T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->RA_rnti), T_INT(frameP),
T_INT(slotP), T_INT(0), T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length));
T_INT(slotP), T_INT(0), T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length));
tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0];
tx_req->PDU_index = pduindex;
......@@ -1496,10 +1496,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
// Mark the corresponding symbols RBs as used
fill_pdcch_vrb_map(nr_mac,
CC_id,
&ra->sched_pdcch,
CCEIndex,
aggregation_level);
CC_id,
&ra->sched_pdcch,
CCEIndex,
aggregation_level);
for (int rb = 0; rb < rbSize; rb++) {
vrb_map[BWPStart + rb + rbStart] |= SL_to_bitmap(startSymbolIndex, nrOfSymbols);
}
......
......@@ -157,7 +157,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
// get MIB every 8 frames
if(((slotP == 0) && (frameP & 7) == 0) ||
gNB->first_MIB) {
gNB->first_MIB) {
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 0, 1, &cc->MIB_pdu.payload[0]);
......@@ -165,21 +165,21 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
gNB->first_MIB = false;
LOG_D(MAC,
"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",
module_idP,
frameP,
CC_id,
mib_sdu_length);
"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",
module_idP,
frameP,
CC_id,
mib_sdu_length);
}
int8_t ssb_period = *scc->ssb_periodicityServingCell;
uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated
if (ssb_period > 1) // 0 is every half frame
{
LOG_D(MAC," fxn:%s line:%d \n", __FUNCTION__, __LINE__);
{
LOG_D(MAC," fxn:%s line:%d \n", __FUNCTION__, __LINE__);
ssb_frame_periodicity = 1 << (ssb_period -1);
}
}
if (!(frameP%ssb_frame_periodicity) &&
((slotP<(slots_per_frame>>1)) || (ssb_period == 0))) {
......@@ -205,7 +205,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
switch (scc->ssb_PositionsInBurst->present) {
case 1:
// short bitmap (<3GHz) max 4 SSBs
LOG_D(MAC," fxn:%s line:%d \n", __FUNCTION__, __LINE__);
LOG_D(MAC," fxn:%s line:%d \n", __FUNCTION__, __LINE__);
for (int i_ssb=0; i_ssb<4; i_ssb++) {
if ((shortBitmap->buf[0]>>(7-i_ssb))&0x01) {
ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb);
......@@ -215,17 +215,17 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id);
if (get_softmodem_params()->sa == 1) {
get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb],
frameP,
mib,
slots_per_frame,
ssbSubcarrierOffset,
ssb_start_symbol,
scs,
FR1,
band,
i_ssb,
ssb_frame_periodicity,
offset_pointa);
frameP,
mib,
slots_per_frame,
ssbSubcarrierOffset,
ssb_start_symbol,
scs,
FR1,
band,
i_ssb,
ssb_frame_periodicity,
offset_pointa);
gNB->type0_PDCCH_CSS_config[i_ssb].active = true;
}
}
......@@ -234,7 +234,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
break;
case 2:
// medium bitmap (<6GHz) max 8 SSBs
LOG_D(MAC," fxn:%s line:%d \n", __FUNCTION__, __LINE__);
LOG_D(MAC," fxn:%s line:%d \n", __FUNCTION__, __LINE__);
for (int i_ssb=0; i_ssb<8; i_ssb++) {
if ((mediumBitmap->buf[0]>>(7-i_ssb))&0x01) {
ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb);
......@@ -244,17 +244,17 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id);
if (get_softmodem_params()->sa == 1) {
get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb],
frameP,
mib,
slots_per_frame,
ssbSubcarrierOffset,
ssb_start_symbol,
scs,
FR1,
band,
i_ssb,
ssb_frame_periodicity,
offset_pointa);
frameP,
mib,
slots_per_frame,
ssbSubcarrierOffset,
ssb_start_symbol,
scs,
FR1,
band,
i_ssb,
ssb_frame_periodicity,
offset_pointa);
gNB->type0_PDCCH_CSS_config[i_ssb].active = true;
}
}
......@@ -281,17 +281,17 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
AssertFatal(num_ssb<2,"beamforming currently not supported for more than one SSB per slot\n");
if (get_softmodem_params()->sa == 1) {
get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb],
frameP,
mib,
slots_per_frame,
ssbSubcarrierOffset,
ssb_start_symbol,
scs,
FR2,
band,
i_ssb,
ssb_frame_periodicity,
offset_pointa);
frameP,
mib,
slots_per_frame,
ssbSubcarrierOffset,
ssb_start_symbol,
scs,
FR2,
band,
i_ssb,
ssb_frame_periodicity,
offset_pointa);
gNB->type0_PDCCH_CSS_config[i_ssb].active = true;
}
}
......@@ -300,7 +300,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
break;
default:
AssertFatal(0,"SSB bitmap size value %d undefined (allowed values 1,2,3)\n",
scc->ssb_PositionsInBurst->present);
scc->ssb_PositionsInBurst->present);
}
}
}
......@@ -338,14 +338,14 @@ uint32_t schedule_control_sib1(module_id_t module_id,
NR_COMMON_channels_t *cc = &gNB_mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
uint16_t *vrb_map = cc->vrb_map;
LOG_D(NR_MAC," fxn:%s Entry \n", __FUNCTION__);
LOG_D(NR_MAC," fxn:%s Entry \n", __FUNCTION__);
if (gNB_mac->sched_ctrlCommon == NULL){
LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n");
LOG_D(NR_MAC," fxn:%s gNB_mac->cset0_bwp_start=type0_PDCCH_CSS_config->cset_start_rb:%d gNB_mac->cset0_bwp_size=type0_PDCCH_CSS_config->num_rbs:%d \n",
__FUNCTION__,
gNB_mac->cset0_bwp_start,
gNB_mac->cset0_bwp_size);
__FUNCTION__,
gNB_mac->cset0_bwp_start,
gNB_mac->cset0_bwp_size);
gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon));
gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space));
gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset));
......@@ -354,11 +354,11 @@ uint32_t schedule_control_sib1(module_id_t module_id,
gNB_mac->cset0_bwp_start = type0_PDCCH_CSS_config->cset_start_rb;
gNB_mac->cset0_bwp_size = type0_PDCCH_CSS_config->num_rbs;
gNB_mac->sched_ctrlCommon->sched_pdcch = set_pdcch_structure(NULL,
gNB_mac->sched_ctrlCommon->search_space,
gNB_mac->sched_ctrlCommon->coreset,
scc,
NULL,
type0_PDCCH_CSS_config);
gNB_mac->sched_ctrlCommon->search_space,
gNB_mac->sched_ctrlCommon->coreset,
scc,
NULL,
type0_PDCCH_CSS_config);
}
gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation = time_domain_allocation;
......@@ -374,22 +374,22 @@ uint32_t schedule_control_sib1(module_id_t module_id,
}
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
gNB_mac->sched_ctrlCommon->cce_index = find_pdcch_candidate(gNB_mac,
CC_id,
gNB_mac->sched_ctrlCommon->aggregation_level,
nr_of_candidates,
&gNB_mac->sched_ctrlCommon->sched_pdcch,
gNB_mac->sched_ctrlCommon->coreset,
0);
// if (RC.ss.mode >= SS_SOFTMODEM)
// gNB_mac->sched_ctrlCommon->cce_index = 0;
CC_id,
gNB_mac->sched_ctrlCommon->aggregation_level,
nr_of_candidates,
&gNB_mac->sched_ctrlCommon->sched_pdcch,
gNB_mac->sched_ctrlCommon->coreset,
0);
// if (RC.ss.mode >= SS_SOFTMODEM)
// gNB_mac->sched_ctrlCommon->cce_index = 0;
LOG_D(MAC,"swetank: cce_index: %d\n", gNB_mac->sched_ctrlCommon->cce_index);
AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n");
const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs;
int rbStart = 0;
if(RC.ss.mode >= SS_SOFTMODEM)
rbStart = 27;
if(RC.ss.mode >= SS_SOFTMODEM)
rbStart = 27;
// TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C)
int mappingtype = (startSymbolIndex <= 3)? typeA: typeB;
......@@ -417,55 +417,55 @@ uint32_t schedule_control_sib1(module_id_t module_id,
break;
}
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
LOG_D(MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.mcs);
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
LOG_D(MAC, "rbSize = %i\n", rbSize);
LOG_D(MAC, "rbStart = %i\n", rbStart);
LOG_D(MAC,"TBS = %i\n", TBS);
LOG_D(MAC,"mcsTableIdx= %i\n", gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx);
LOG_D(MAC,"dmrs_length %d\n",dmrs_length);
LOG_D(MAC,"time_domain_allocation= %i\n", time_domain_allocation);
LOG_D(MAC,"startSymbolIndex= %i\n", startSymbolIndex);
LOG_D(MAC,"nrOfSymbols= %i\n", nrOfSymbols);
LOG_D(MAC,"dlDmrsSymbPos= %i\n", dlDmrsSymbPos);
LOG_D(MAC,"candidate_idx= %i\n", candidate_idx);
LOG_D(MAC,"num_total_bytes= %i\n", num_total_bytes);
LOG_D(MAC,"num_total_bytes= %i\n", num_total_bytes);
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx),
rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
LOG_D(MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.mcs);
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
LOG_D(MAC, "rbSize = %i\n", rbSize);
LOG_D(MAC, "rbStart = %i\n", rbStart);
LOG_D(MAC,"TBS = %i\n", TBS);
LOG_D(MAC,"mcsTableIdx= %i\n", gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx);
LOG_D(MAC,"dmrs_length %d\n",dmrs_length);
LOG_D(MAC,"time_domain_allocation= %i\n", time_domain_allocation);
LOG_D(MAC,"startSymbolIndex= %i\n", startSymbolIndex);
LOG_D(MAC,"nrOfSymbols= %i\n", nrOfSymbols);
LOG_D(MAC,"dlDmrsSymbPos= %i\n", dlDmrsSymbPos);
LOG_D(MAC,"candidate_idx= %i\n", candidate_idx);
LOG_D(MAC,"num_total_bytes= %i\n", num_total_bytes);
LOG_D(MAC,"num_total_bytes= %i\n", num_total_bytes);
} while (TBS < gNB_mac->sched_ctrlCommon->num_total_bytes);
AssertFatal(TBS>=gNB_mac->sched_ctrlCommon->num_total_bytes,"Couldn't allocate enough resources for %d bytes in SIB1 PDSCH\n",
gNB_mac->sched_ctrlCommon->num_total_bytes);
gNB_mac->sched_ctrlCommon->num_total_bytes);
gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize;
gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0;
/*
LOG_D(MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.mcs);
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
LOG_D(MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize);
LOG_D(MAC,"TBS = %i\n", TBS);
LOG_D(MAC,"dmrs_length %d\n",dmrs_length);
LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS);
LOG_D(MAC,"mappingtype = %d\n", mappingtype);
/*
LOG_D(MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.mcs);
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
LOG_D(MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize);
LOG_D(MAC,"TBS = %i\n", TBS);
LOG_D(MAC,"dmrs_length %d\n",dmrs_length);
LOG_D(MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS);
LOG_D(MAC,"mappingtype = %d\n", mappingtype);
// Mark the corresponding RBs as used */
LOG_D(NR_MAC, "swetank: CC_id:%d gNB_mac->sched_ctrlCommon->cce_index:%d aggregation_level:%d sched_pdsch.rbSize:%d \n",
CC_id,
gNB_mac->sched_ctrlCommon->cce_index,
gNB_mac->sched_ctrlCommon->aggregation_level,
gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize);
LOG_D(NR_MAC, "swetank: CC_id:%d gNB_mac->sched_ctrlCommon->cce_index:%d aggregation_level:%d sched_pdsch.rbSize:%d \n",
CC_id,
gNB_mac->sched_ctrlCommon->cce_index,
gNB_mac->sched_ctrlCommon->aggregation_level,
gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize);
fill_pdcch_vrb_map(gNB_mac,
CC_id,
&gNB_mac->sched_ctrlCommon->sched_pdcch,
gNB_mac->sched_ctrlCommon->cce_index,
gNB_mac->sched_ctrlCommon->aggregation_level);
CC_id,
&gNB_mac->sched_ctrlCommon->sched_pdcch,
gNB_mac->sched_ctrlCommon->cce_index,
gNB_mac->sched_ctrlCommon->aggregation_level);
for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) {
vrb_map[rb + rbStart] = SL_to_bitmap(startSymbolIndex, nrOfSymbols);
}
LOG_D(NR_MAC," fxn:%s Exit\n", __FUNCTION__);
LOG_D(NR_MAC," fxn:%s Exit\n", __FUNCTION__);
return TBS;
}
......@@ -614,7 +614,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
int time_domain_allocation = gNB_mac->sib1_tda;
LOG_D(NR_MAC, "swetank: scc->ssb_PositionsInBurst->present:%d\n", scc->ssb_PositionsInBurst->present);
LOG_D(NR_MAC, "swetank: scc->ssb_PositionsInBurst->present:%d\n", scc->ssb_PositionsInBurst->present);
int L_max;
switch (scc->ssb_PositionsInBurst->present) {
case 1:
......@@ -628,7 +628,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
break;
default:
AssertFatal(0,"SSB bitmap size value %d undefined (allowed values 1,2,3)\n",
scc->ssb_PositionsInBurst->present);
scc->ssb_PositionsInBurst->present);
}
for (int i=0; i<L_max; i++) {
......@@ -636,9 +636,9 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = &gNB_mac->type0_PDCCH_CSS_config[i];
if((frameP%2 == type0_PDCCH_CSS_config->sfn_c) &&
(slotP == type0_PDCCH_CSS_config->n_0) &&
(type0_PDCCH_CSS_config->num_rbs > 0) &&
(type0_PDCCH_CSS_config->active == true)) {
(slotP == type0_PDCCH_CSS_config->n_0) &&
(type0_PDCCH_CSS_config->num_rbs > 0) &&
(type0_PDCCH_CSS_config->active == true)) {
LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index);
......@@ -658,22 +658,22 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
LOG_D(NR_MAC,"time_domain_allocation: %i\n", time_domain_allocation);
LOG_D(NR_MAC,"dmrs_TypeA_Position: %i\n", gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position);
get_info_from_tda_tables(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern,
time_domain_allocation,
gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
1, &is_typeA,
&startSymbolIndex, &nrOfSymbols);
time_domain_allocation,
gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
1, &is_typeA,
&startSymbolIndex, &nrOfSymbols);
int mappingtype = is_typeA? typeA: typeB;
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype, 1);
// Configure sched_ctrlCommon for SIB1
uint32_t TBS = schedule_control_sib1(module_idP, CC_id,
type0_PDCCH_CSS_config,
time_domain_allocation,
startSymbolIndex,
nrOfSymbols,
dlDmrsSymbPos,
candidate_idx, sib1_sdu_length);
type0_PDCCH_CSS_config,
time_domain_allocation,
startSymbolIndex,
nrOfSymbols,
dlDmrsSymbPos,
candidate_idx, sib1_sdu_length);
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
int pdu_index = gNB_mac->pdu_index[0]++;
......@@ -697,7 +697,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
type0_PDCCH_CSS_config->active = false;
T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(SI_RNTI),
T_INT(frameP), T_INT(slotP), T_INT(0), T_BUFFER(sib1_payload, sib1_sdu_length));
T_INT(frameP), T_INT(slotP), T_INT(0), T_BUFFER(sib1_payload, sib1_sdu_length));
}
}
......
......@@ -405,17 +405,17 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
const int C = R>0 ? N_regs/(L*R) : 0;
const int B_rb = L/N_symb; // nb of RBs occupied by each REG bundle
LOG_D(NR_MAC,"swetank: cc_id:%d aggregation:%d nr_of_candidates:%d N_rb:%d N_symb:%d N_regs:%d N_cces%d R:%d L:%d C:%d B_rb:%d :\n",
cc_id,
aggregation,
nr_of_candidates,
N_rb,
N_symb,
N_regs,
N_cces,
R,
L,
C,
B_rb);
cc_id,
aggregation,
nr_of_candidates,
N_rb,
N_symb,
N_regs,
N_cces,
R,
L,
C,
B_rb);
// loop over all the available candidates
// this implements TS 38.211 Sec. 7.3.2.2
......@@ -425,10 +425,10 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
for (int j=first_cce; (j<first_cce+aggregation) && !taken; j++) { // loop over CCEs
for (int k=6*j/L; (k<(6*j/L+6/L)) && !taken; k++) { // loop over REG bundles
int f = cce_to_reg_interleaving(R, k, pdcch->ShiftIndex, C, L, N_regs);
LOG_D(NR_MAC,"swetank: pdcch->ShiftIndex:%d\n", pdcch->ShiftIndex);
LOG_D(NR_MAC,"swetank: pdcch->ShiftIndex:%d\n", pdcch->ShiftIndex);
for(int rb=0; rb<B_rb; rb++) { // loop over the RBs of the bundle
if(vrb_map[pdcch->BWPStart + f*B_rb + rb]&SL_to_bitmap(pdcch->StartSymbolIndex,N_symb)) {
LOG_D(NR_MAC,"swetank: pdcch->BWPStart:%d pdcch->StartSymbolIndex:%d \n", pdcch->BWPStart, pdcch->StartSymbolIndex);
LOG_D(NR_MAC,"swetank: pdcch->BWPStart:%d pdcch->StartSymbolIndex:%d \n", pdcch->BWPStart, pdcch->StartSymbolIndex);
taken = true;
break;
}
......@@ -436,16 +436,16 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
}
}
if (RC.ss.mode == SS_SOFTMODEM)
{
taken = 0;
m = 0;
first_cce = 0;
}
LOG_D(NR_MAC,"swetank: taken:%d m:%d \n", taken, m);
if (RC.ss.mode == SS_SOFTMODEM)
{
taken = 0;
m = 0;
first_cce = 0;
}
LOG_D(NR_MAC,"swetank: taken:%d m:%d \n", taken, m);
if(!taken){
mac->pdcch_cand[coreset->controlResourceSetId] = m++; // using candidate m, next available is m+1
LOG_D(NR_MAC,"swetank: coreset->controlResourceSetId:%d mac->pdcch_cand[coreset->controlResourceSetId]:%d\n", coreset->controlResourceSetId, mac->pdcch_cand[coreset->controlResourceSetId]);
LOG_D(NR_MAC,"swetank: coreset->controlResourceSetId:%d mac->pdcch_cand[coreset->controlResourceSetId]:%d\n", coreset->controlResourceSetId, mac->pdcch_cand[coreset->controlResourceSetId]);
return first_cce;
}
}
......
......@@ -297,7 +297,7 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
gNB_RrcConfigurationReq *configuration
) {
) {
asn_enc_rval_t enc_rval;
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
......@@ -362,45 +362,45 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
//si-SchedulingInfo
/*sib1->si_SchedulingInfo = CALLOC(1,sizeof(struct NR_SI_SchedulingInfo));
asn_set_empty(&sib1->si_SchedulingInfo->schedulingInfoList.list);
sib1->si_SchedulingInfo->si_WindowLength = NR_SI_SchedulingInfo__si_WindowLength_s40;
struct NR_SchedulingInfo *schedulingInfo = CALLOC(1,sizeof(struct NR_SchedulingInfo));
schedulingInfo->si_BroadcastStatus = NR_SchedulingInfo__si_BroadcastStatus_broadcasting;
schedulingInfo->si_Periodicity = NR_SchedulingInfo__si_Periodicity_rf8;
asn_set_empty(&schedulingInfo->sib_MappingInfo.list);
NR_SIB_TypeInfo_t *sib_type3 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type3->type = NR_SIB_TypeInfo__type_sibType3;
sib_type3->valueTag = CALLOC(1,sizeof(sib_type3->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type3);
NR_SIB_TypeInfo_t *sib_type5 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type5->type = NR_SIB_TypeInfo__type_sibType5;
sib_type5->valueTag = CALLOC(1,sizeof(sib_type5->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type5);
NR_SIB_TypeInfo_t *sib_type4 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type4->type = NR_SIB_TypeInfo__type_sibType4;
sib_type4->valueTag = CALLOC(1,sizeof(sib_type4->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type4);
NR_SIB_TypeInfo_t *sib_type2 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type2->type = NR_SIB_TypeInfo__type_sibType2;
sib_type2->valueTag = CALLOC(1,sizeof(sib_type2->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type2);
ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/
asn_set_empty(&sib1->si_SchedulingInfo->schedulingInfoList.list);
sib1->si_SchedulingInfo->si_WindowLength = NR_SI_SchedulingInfo__si_WindowLength_s40;
struct NR_SchedulingInfo *schedulingInfo = CALLOC(1,sizeof(struct NR_SchedulingInfo));
schedulingInfo->si_BroadcastStatus = NR_SchedulingInfo__si_BroadcastStatus_broadcasting;
schedulingInfo->si_Periodicity = NR_SchedulingInfo__si_Periodicity_rf8;
asn_set_empty(&schedulingInfo->sib_MappingInfo.list);
NR_SIB_TypeInfo_t *sib_type3 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type3->type = NR_SIB_TypeInfo__type_sibType3;
sib_type3->valueTag = CALLOC(1,sizeof(sib_type3->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type3);
NR_SIB_TypeInfo_t *sib_type5 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type5->type = NR_SIB_TypeInfo__type_sibType5;
sib_type5->valueTag = CALLOC(1,sizeof(sib_type5->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type5);
NR_SIB_TypeInfo_t *sib_type4 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type4->type = NR_SIB_TypeInfo__type_sibType4;
sib_type4->valueTag = CALLOC(1,sizeof(sib_type4->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type4);
NR_SIB_TypeInfo_t *sib_type2 = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type));
sib_type2->type = NR_SIB_TypeInfo__type_sibType2;
sib_type2->valueTag = CALLOC(1,sizeof(sib_type2->valueTag));
ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type2);
ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/
// servingCellConfigCommon
asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom);
NR_BWP_DownlinkCommon_t *initialDownlinkBWP=&ServCellCom->downlinkConfigCommon.initialDownlinkBWP;
initialDownlinkBWP->genericParameters=
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count; i++) {
asn1cSequenceAdd(ServCellCom->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,
struct NR_NR_MultiBandInfo, nrMultiBandInfo);
struct NR_NR_MultiBandInfo, nrMultiBandInfo);
nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i];
}
......@@ -415,41 +415,41 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
scs_scaling = scs_scaling0>>2;
scs_scaling2 = scs_scaling0>>2;
}
NR_ARFCN_ValueNR_t absoluteFrequencySSB = 0;
uint32_t absolute_diff = 0;
if (RC.ss.mode == SS_SOFTMODEM)
{
LOG_A(NR_RRC, "fxn:%s absoluteFrequencySSB:%d ", __FUNCTION__, absoluteFrequencySSB);
absoluteFrequencySSB = *RC.nrrrc[0]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB;
absolute_diff = absoluteFrequencySSB - configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
}
else
{
absolute_diff = (*configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB -
configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
}
/*TODO: */
NR_ARFCN_ValueNR_t absoluteFrequencySSB = 0;
uint32_t absolute_diff = 0;
if (RC.ss.mode == SS_SOFTMODEM)
{
LOG_A(NR_RRC, "fxn:%s absoluteFrequencySSB:%d ", __FUNCTION__, absoluteFrequencySSB);
absoluteFrequencySSB = *RC.nrrrc[0]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB;
absolute_diff = absoluteFrequencySSB - configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
}
else
{
absolute_diff = (*configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB -
configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
}
/*TODO: */
sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = scs_scaling2 * (absolute_diff/(12*scs_scaling) - 10);
LOG_I(NR_RRC,"SIB1 freq: absoluteFrequencySSB %ld, absoluteFrequencyPointA %ld\n",
*configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB,
configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
*configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB,
configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
LOG_I(NR_RRC,"SIB1 freq: absolute_diff %d, %d*(absolute_diff/(12*%d) - 10) %d\n",
absolute_diff,scs_scaling2,scs_scaling,(int)sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA);
absolute_diff,scs_scaling2,scs_scaling,(int)sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA);
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) {
ASN_SEQUENCE_ADD(&ServCellCom->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,
configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
}
initialDownlinkBWP->pdcch_ConfigCommon =
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon;
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon;
initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList =
CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss1);
NR_SearchSpace_t, ss1);
ss1->searchSpaceId = 1;
asn1cCallocOne(ss1->controlResourceSetId, 0);
ss1->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss1->monitoringSlotPeriodicityAndOffset));
......@@ -473,7 +473,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss5);
NR_SearchSpace_t, ss5);
ss5->searchSpaceId = 5;
ss5->controlResourceSetId=calloc(1,sizeof(*ss5->controlResourceSetId));
*ss5->controlResourceSetId=0;
......@@ -501,7 +501,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss7);
NR_SearchSpace_t, ss7);
ss7->searchSpaceId = 7;
ss7->controlResourceSetId=calloc(1,sizeof(*ss7->controlResourceSetId));
*ss7->controlResourceSetId=0;
......@@ -525,12 +525,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss7->searchSpaceType->choice.common=calloc(1,sizeof(*ss7->searchSpaceType->choice.common));
ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1, 0);
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation, 7);
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 5);
asn1cCallocOne( initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace, 1);
initialDownlinkBWP->pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon;
ServCellCom->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2;
ServCellCom->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256;
......@@ -539,21 +539,21 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ServCellCom->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one;
asn1cCalloc(ServCellCom->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO,
P0);
P0);
P0->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT;
asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT,
Z8);
Z8);
asn1cSequenceAdd(Z8->list,
long,
ZoneEight);
long,
ZoneEight);
asn1cCallocOne(ZoneEight, 0);
asn1cCalloc(ServCellCom->uplinkConfigCommon, UL)
asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list);
asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list);
for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) {
ASN_SEQUENCE_ADD(&UL->frequencyInfoUL.scs_SpecificCarrierList.list,
configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]);
configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]);
}
asn1cCallocOne(UL->frequencyInfoUL.p_Max, 23);
......@@ -578,14 +578,14 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap:
ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap;
break;
/*
groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1.
The first/leftmost bit corresponds to the SS/PBCH index 0-7, the second bit corresponds to SS/PBCH block 8-15, and so on.
Value 0 in the bitmap indicates that the SSBs according to inOneGroup are absent. Value 1 indicates that the SS/PBCH blocks are transmitted in accordance with inOneGroup.
inOneGroup: When maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1, all 8 bit are valid;
The first/ leftmost bit corresponds to the first SS/PBCH block index in the group (i.e., to SSB index 0, 8, and so on); the second bit corresponds to the second SS/PBCH block index in the group
(i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted.
*/
/*
groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1.
The first/leftmost bit corresponds to the SS/PBCH index 0-7, the second bit corresponds to SS/PBCH block 8-15, and so on.
Value 0 in the bitmap indicates that the SSBs according to inOneGroup are absent. Value 1 indicates that the SS/PBCH blocks are transmitted in accordance with inOneGroup.
inOneGroup: When maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1, all 8 bit are valid;
The first/ leftmost bit corresponds to the first SS/PBCH block index in the group (i.e., to SSB index 0, 8, and so on); the second bit corresponds to the second SS/PBCH block index in the group
(i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted.
*/
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap:
ServCellCom->ssb_PositionsInBurst.inOneGroup.size = 1;
ServCellCom->ssb_PositionsInBurst.inOneGroup.bits_unused = 0;
......@@ -639,14 +639,14 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
// uac-BarringInfo
/*sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo));
NR_UAC_BarringInfoSet_t *nr_uac_BarringInfoSet = CALLOC(1, sizeof(NR_UAC_BarringInfoSet_t));
asn_set_empty(&sib1->uac_BarringInfo->uac_BarringInfoSetList);
nr_uac_BarringInfoSet->uac_BarringFactor = NR_UAC_BarringInfoSet__uac_BarringFactor_p95;
nr_uac_BarringInfoSet->uac_BarringTime = NR_UAC_BarringInfoSet__uac_BarringTime_s4;
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.buf = CALLOC(1, 1);
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.size = 1;
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.bits_unused = 1;
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, nr_uac_BarringInfoSet);*/
NR_UAC_BarringInfoSet_t *nr_uac_BarringInfoSet = CALLOC(1, sizeof(NR_UAC_BarringInfoSet_t));
asn_set_empty(&sib1->uac_BarringInfo->uac_BarringInfoSetList);
nr_uac_BarringInfoSet->uac_BarringFactor = NR_UAC_BarringInfoSet__uac_BarringFactor_p95;
nr_uac_BarringInfoSet->uac_BarringTime = NR_UAC_BarringInfoSet__uac_BarringTime_s4;
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.buf = CALLOC(1, 1);
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.size = 1;
nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.bits_unused = 1;
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, nr_uac_BarringInfoSet);*/
// useFullResumeID
// TODO: add useFullResumeID
......@@ -661,14 +661,14 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
if(carrier->SIB1 == NULL) carrier->SIB1=(uint8_t *) malloc16(NR_MAX_SIB_LENGTH/8);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
NULL,
(void *)sib1_message,
carrier->SIB1,
NR_MAX_SIB_LENGTH/8);
NULL,
(void *)sib1_message,
carrier->SIB1,
NR_MAX_SIB_LENGTH/8);
LOG_P(OAILOG_INFO, "BCCH_DL_SCH_Message", (uint8_t *)carrier->SIB1, NR_MAX_SIB_LENGTH/8);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
enc_rval.failed_type->name, enc_rval.encoded);
if (enc_rval.encoded==-1) {
return(-1);
......
......@@ -233,124 +233,124 @@ void ss_gNB_port_man_init(void)
//------------------------------------------------------------------------------
static inline void ss_gNB_read_from_socket(acpCtx_t ctx)
{
struct NR_SYSTEM_CTRL_REQ *req = NULL;
const size_t size = 16 * 1024;
size_t msgSize = size; //2
unsigned char *buffer = (unsigned char *)acpMalloc(size);
assert(buffer);
int userId = acpRecvMsg(ctx, &msgSize, buffer);
// Error handling
if (userId < 0)
struct NR_SYSTEM_CTRL_REQ *req = NULL;
const size_t size = 16 * 1024;
size_t msgSize = size; //2
unsigned char *buffer = (unsigned char *)acpMalloc(size);
assert(buffer);
int userId = acpRecvMsg(ctx, &msgSize, buffer);
// Error handling
if (userId < 0)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:%d\n", __FUNCTION__, userId);
if (userId == -ACP_ERR_SERVICE_NOT_MAPPED)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:%d\n", __FUNCTION__, userId);
if (userId == -ACP_ERR_SERVICE_NOT_MAPPED)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SERVICE_NOT_MAPPED \n", __FUNCTION__);
// Message not mapped to user id,
// this error should not appear on server side for the messages
// received from clients
}
else if (userId == -ACP_ERR_SIDL_FAILURE)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SIDL_FAILURE\n", __FUNCTION__);
// Server returned service error,
// this error should not appear on server side for the messages
// received from clients
SidlStatus sidlStatus = -1;
acpGetMsgSidlStatus(msgSize, buffer, &sidlStatus);
}
else
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s line:%d\n", __FUNCTION__, __LINE__);
return;
}
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SERVICE_NOT_MAPPED \n", __FUNCTION__);
// Message not mapped to user id,
// this error should not appear on server side for the messages
// received from clients
}
else if (userId == 0)
else if (userId == -ACP_ERR_SIDL_FAILURE)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:0\n", __FUNCTION__);
// No message (timeout on socket)
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SIDL_FAILURE\n", __FUNCTION__);
// Server returned service error,
// this error should not appear on server side for the messages
// received from clients
SidlStatus sidlStatus = -1;
acpGetMsgSidlStatus(msgSize, buffer, &sidlStatus);
}
else
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] received msg %d from the client.\n", userId);
if (acpNrSysProcessDecSrv(ctx, buffer, msgSize, &req) != 0)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s line:%d\n", __FUNCTION__, __LINE__);
return;
}
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s line:%d\n", __FUNCTION__, __LINE__);
return;
}
}
else if (userId == 0)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId:0\n", __FUNCTION__);
// No message (timeout on socket)
}
else
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] received msg %d from the client.\n", userId);
if (acpNrSysProcessDecSrv(ctx, buffer, msgSize, &req) != 0)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s line:%d\n", __FUNCTION__, __LINE__);
return;
}
ss_dumpReqMsg(req);
ss_dumpReqMsg(req);
if (userId == MSG_NrSysProcess_userId)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId: MSG_NrSysProcess_userId\n", __FUNCTION__);
MessageDef *message_p = itti_alloc_new_message(TASK_SS_PORTMAN_GNB, INSTANCE_DEFAULT, SS_NR_SYS_PORT_MSG_IND);
if (message_p)
{
SS_NR_SYS_PORT_MSG_IND(message_p).req = req;
SS_NR_SYS_PORT_MSG_IND(message_p).userId = userId;
itti_send_msg_to_task(TASK_SYS_GNB, INSTANCE_DEFAULT, message_p);
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s line:%d Msg sent to TASK_SYS_GNB \n", __FUNCTION__, __LINE__);
}
}
if (userId == MSG_NrSysProcess_userId)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s userId: MSG_NrSysProcess_userId\n", __FUNCTION__);
MessageDef *message_p = itti_alloc_new_message(TASK_SS_PORTMAN_GNB, INSTANCE_DEFAULT, SS_NR_SYS_PORT_MSG_IND);
if (message_p)
{
SS_NR_SYS_PORT_MSG_IND(message_p).req = req;
SS_NR_SYS_PORT_MSG_IND(message_p).userId = userId;
itti_send_msg_to_task(TASK_SYS_GNB, INSTANCE_DEFAULT, message_p);
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] fxn:%s line:%d Msg sent to TASK_SYS_GNB \n", __FUNCTION__, __LINE__);
}
}
acpNrSysProcessFreeSrv(req);
return;
}
acpNrSysProcessFreeSrv(req);
return;
}
//------------------------------------------------------------------------------
void *ss_port_man_5G_NR_process_itti_msg(void *notUsed)
{
MessageDef *received_msg = NULL;
int result;
itti_poll_msg(TASK_SS_PORTMAN_GNB, &received_msg);
/* Check if there is a packet to handle */
if (received_msg != NULL)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received a message id : %d \n",
ITTI_MSG_ID(received_msg));
switch (ITTI_MSG_ID(received_msg))
{
case SS_NRSET_TIM_INFO:
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received NR timing info \n");
ss_nr_port_man_send_data(0, 0, &received_msg->ittiMsg.ss_nrset_timinfo);
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
}
break;
case SS_NR_SYS_PORT_MSG_CNF:
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received SS_NR_SYS_PORT_MSG_CNF \n");
ss_nr_port_man_send_cnf(*(SS_NR_SYS_PORT_MSG_CNF(received_msg).cnf));
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
}
break;
case TERMINATE_MESSAGE:
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received TERMINATE_MESSAGE\n");
itti_exit_task();
}
break;
default:
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received unhandled message %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n",
result);
received_msg = NULL;
}
ss_gNB_read_from_socket(nrctx_g);
return NULL;
MessageDef *received_msg = NULL;
int result;
itti_poll_msg(TASK_SS_PORTMAN_GNB, &received_msg);
/* Check if there is a packet to handle */
if (received_msg != NULL)
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received a message id : %d \n",
ITTI_MSG_ID(received_msg));
switch (ITTI_MSG_ID(received_msg))
{
case SS_NRSET_TIM_INFO:
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received NR timing info \n");
ss_nr_port_man_send_data(0, 0, &received_msg->ittiMsg.ss_nrset_timinfo);
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
}
break;
case SS_NR_SYS_PORT_MSG_CNF:
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received SS_NR_SYS_PORT_MSG_CNF \n");
ss_nr_port_man_send_cnf(*(SS_NR_SYS_PORT_MSG_CNF(received_msg).cnf));
result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
}
break;
case TERMINATE_MESSAGE:
{
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received TERMINATE_MESSAGE\n");
itti_exit_task();
}
break;
default:
LOG_A(GNB_APP, "[SS-PORTMAN-GNB] Received unhandled message %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n",
result);
received_msg = NULL;
}
ss_gNB_read_from_socket(nrctx_g);
return NULL;
}
//------------------------------------------------------------------------------
......
......@@ -324,49 +324,49 @@ ss_gNB_read_from_srb_socket(acpCtx_t ctx)
//------------------------------------------------------------------------------
void ss_gNB_srb_init(void)
{
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS_SRB] Starting System Simulator SRB Thread \n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Srbport;
acpInit(malloc, free, 1000);
// Register user services/notifications in message table
const struct acpMsgTable msgTable[] = {
{ "NrSysSrbProcessFromSS", MSG_NrSysSrbProcessFromSS_userId },
{ "NrSysSrbProcessToSS", MSG_NrSysSrbProcessToSS_userId },
/* { "SysProcess", MSG_SysProcess_userId }, */
// The last element should be NULL
{ NULL, 0 }
};
// Arena size to decode received message
const size_t aSize = 32 * 1024;
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_srb_g);
if (ret < 0)
{
LOG_A(GNB_APP, "[SS_SRB] Connection failure err=%d\n", ret);
return;
}
int fd1 = acpGetSocketFd(ctx_srb_g);
LOG_A(GNB_APP, "[SS_SRB] Connection performed : %d\n", fd1);
buffer = (unsigned char *)acpMalloc(size);
assert(buffer);
if (RC.ss.mode == SS_SOFTMODEM_SRB)
{
RC.ss.State = SS_STATE_CELL_ACTIVE;
}
itti_subscribe_event_fd(TASK_SS_SRB, fd1);
itti_mark_task_ready(TASK_SS_SRB);
IpAddress_t ipaddr;
LOG_A(GNB_APP, "[SS_SRB] Starting System Simulator SRB Thread \n");
const char *hostIp;
hostIp = RC.ss.hostIp;
acpConvertIp(hostIp, &ipaddr);
// Port number
int port = RC.ss.Srbport;
acpInit(malloc, free, 1000);
// Register user services/notifications in message table
const struct acpMsgTable msgTable[] = {
{ "NrSysSrbProcessFromSS", MSG_NrSysSrbProcessFromSS_userId },
{ "NrSysSrbProcessToSS", MSG_NrSysSrbProcessToSS_userId },
/* { "SysProcess", MSG_SysProcess_userId }, */
// The last element should be NULL
{ NULL, 0 }
};
// Arena size to decode received message
const size_t aSize = 32 * 1024;
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int ret = acpServerInitWithCtx(ipaddr, port, msgTable, aSize, &ctx_srb_g);
if (ret < 0)
{
LOG_A(GNB_APP, "[SS_SRB] Connection failure err=%d\n", ret);
return;
}
int fd1 = acpGetSocketFd(ctx_srb_g);
LOG_A(GNB_APP, "[SS_SRB] Connection performed : %d\n", fd1);
buffer = (unsigned char *)acpMalloc(size);
assert(buffer);
if (RC.ss.mode == SS_SOFTMODEM_SRB)
{
RC.ss.State = SS_STATE_CELL_ACTIVE;
}
itti_subscribe_event_fd(TASK_SS_SRB, fd1);
itti_mark_task_ready(TASK_SS_SRB);
}
//------------------------------------------------------------------------------
......
......@@ -105,8 +105,8 @@ static void send_sys_cnf(enum ConfirmationResult_Type_Sel resType,
/* The request has send confirm flag flase so do nothing in this funciton */
if (reqCnfFlag_g == FALSE)
{
LOG_A(GNB_APP, "[SYS-GNB] No confirm required\n");
return ;
LOG_A(GNB_APP, "[SYS-GNB] No confirm required\n");
return ;
}
if (message_p)
......@@ -117,42 +117,42 @@ static void send_sys_cnf(enum ConfirmationResult_Type_Sel resType,
msgCnf->Common.Result.v.Success = resVal;
msgCnf->Confirm.d = cnfType;
switch (cnfType)
{
case NR_SystemConfirm_Type_Cell:
{
LOG_A(GNB_APP, "[SYS-GNB] Send confirm for cell configuration\n");
msgCnf->Confirm.v.Cell = true;
break;
}
case NR_SystemConfirm_Type_PdcpCount:
{
if (msg)
memcpy(&msgCnf->Confirm.v.PdcpCount, msg, sizeof(struct NR_PDCP_CountCnf_Type));
else
SS_NR_SYS_PORT_MSG_CNF(message_p).cnf = msgCnf;
break;
}
case NR_SystemConfirm_Type_AS_Security:
{
LOG_A(GNB_APP, "[SYS-GNB] Send confirm for cell configuration NR_SystemConfirm_Type_AS_Security\n");
msgCnf->Confirm.v.AS_Security = true;
break;
}
default:
LOG_A(GNB_APP, "[SYS-GNB] Error not handled CNF TYPE to [SS-PORTMAN-GNB]\n");
}
{
case NR_SystemConfirm_Type_Cell:
{
LOG_A(GNB_APP, "[SYS-GNB] Send confirm for cell configuration\n");
msgCnf->Confirm.v.Cell = true;
break;
}
case NR_SystemConfirm_Type_PdcpCount:
{
if (msg)
memcpy(&msgCnf->Confirm.v.PdcpCount, msg, sizeof(struct NR_PDCP_CountCnf_Type));
else
SS_NR_SYS_PORT_MSG_CNF(message_p).cnf = msgCnf;
break;
}
case NR_SystemConfirm_Type_AS_Security:
{
LOG_A(GNB_APP, "[SYS-GNB] Send confirm for cell configuration NR_SystemConfirm_Type_AS_Security\n");
msgCnf->Confirm.v.AS_Security = true;
break;
}
default:
LOG_A(GNB_APP, "[SYS-GNB] Error not handled CNF TYPE to [SS-PORTMAN-GNB]\n");
}
SS_NR_SYS_PORT_MSG_CNF(message_p).cnf = msgCnf;
int send_res = itti_send_msg_to_task(TASK_SS_PORTMAN_GNB, INSTANCE_DEFAULT, message_p);
if (send_res < 0)
{
LOG_A(GNB_APP, "[SYS-GNB] Error sending to [SS-PORTMAN-GNB]\n");
}
else
{
LOG_A(GNB_APP, "[SYS-GNB] fxn:%s NR_SYSTEM_CTRL_CNF sent for cnfType:%d to Port Manager\n", __FUNCTION__, cnfType);
}
else
{
LOG_A(GNB_APP, "[SYS-GNB] fxn:%s NR_SYSTEM_CTRL_CNF sent for cnfType:%d to Port Manager\n", __FUNCTION__, cnfType);
}
}
LOG_A(GNB_APP, "[SYS-GNB] Exit from fxn:%s\n", __FUNCTION__);
LOG_A(GNB_APP, "[SYS-GNB] Exit from fxn:%s\n", __FUNCTION__);
}
/*
* Function : sys_handle_nr_enquire_timing
......@@ -192,128 +192,128 @@ static void ss_task_sys_nr_handle_req(struct NR_SYSTEM_CTRL_REQ *req, ss_nrset_t
if(req->Common.CellId)
SS_context.eutra_cellId = req->Common.CellId;
LOG_A(GNB_APP, "[SYS-GNB] Current SS_STATE %d received SystemRequest_Type %d eutra_cellId %d cnf_flag %d\n",
RC.ss.State, req->Request.d, SS_context.eutra_cellId, req->Common.ControlInfo.CnfFlag);
RC.ss.State, req->Request.d, SS_context.eutra_cellId, req->Common.ControlInfo.CnfFlag);
switch (RC.ss.State)
{
case SS_STATE_NOT_CONFIGURED:
if (req->Request.d == NR_SystemRequest_Type_Cell)
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_Cell received\n");
if (false == ss_task_sys_nr_handle_cellConfig5G(&req->Request.v.Cell) )
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_Cell \n");
return;
}
cell_config_5G_done_indication();
if (RC.ss.State == SS_STATE_NOT_CONFIGURED)
{
RC.ss.State = SS_STATE_CELL_ACTIVE;
LOG_A(GNB_APP, "[SYS-GNB] RC.ss.State changed to ACTIVE \n");
}
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_Cell, NULL);
if (req->Request.v.Cell.d == NR_CellConfigRequest_Type_AddOrReconfigure)
{
CellConfig5GReq_t *cellConfig = NULL;
struct NR_CellConfigInfo_Type *p_cellConfig = NULL;
p_cellConfig = &req->Request.v.Cell.v.AddOrReconfigure;
SS_context.maxRefPower = p_cellConfig->CellConfigCommon.v.InitialCellPower.v.MaxReferencePower;
cellConfig = (CellConfig5GReq_t*)malloc(sizeof(CellConfig5GReq_t));
cellConfig->header.preamble = 0xFEEDC0DE;
cellConfig->header.msg_id = SS_CELL_CONFIG;
cellConfig->header.length = sizeof(proxy_ss_header_t);
cellConfig->initialAttenuation = 0;
cellConfig->header.cell_id = SS_context.eutra_cellId;
cellConfig->maxRefPower= p_cellConfig->CellConfigCommon.v.InitialCellPower.v.MaxReferencePower;
cellConfig->absoluteFrequencyPointA = p_cellConfig->PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencyPointA;
LOG_A(ENB_SS,"5G Cell configuration rece6ived for cell_id: %d Initial attenuation: %d \
Max ref power: %d\n for absoluteFrequencyPointA : %d =================================== \n",
cellConfig->header.cell_id,
cellConfig->initialAttenuation, cellConfig->maxRefPower,
cellConfig->absoluteFrequencyPointA);
//send_to_proxy();
sys_5G_send_proxy((void *)cellConfig, sizeof(CellConfig5GReq_t));
}
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_Cell received\n");
if (false == ss_task_sys_nr_handle_cellConfig5G(&req->Request.v.Cell) )
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_Cell \n");
return;
}
cell_config_5G_done_indication();
if (RC.ss.State == SS_STATE_NOT_CONFIGURED)
{
RC.ss.State = SS_STATE_CELL_ACTIVE;
LOG_A(GNB_APP, "[SYS-GNB] RC.ss.State changed to ACTIVE \n");
}
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_Cell, NULL);
if (req->Request.v.Cell.d == NR_CellConfigRequest_Type_AddOrReconfigure)
{
CellConfig5GReq_t *cellConfig = NULL;
struct NR_CellConfigInfo_Type *p_cellConfig = NULL;
p_cellConfig = &req->Request.v.Cell.v.AddOrReconfigure;
SS_context.maxRefPower = p_cellConfig->CellConfigCommon.v.InitialCellPower.v.MaxReferencePower;
cellConfig = (CellConfig5GReq_t*)malloc(sizeof(CellConfig5GReq_t));
cellConfig->header.preamble = 0xFEEDC0DE;
cellConfig->header.msg_id = SS_CELL_CONFIG;
cellConfig->header.length = sizeof(proxy_ss_header_t);
cellConfig->initialAttenuation = 0;
cellConfig->header.cell_id = SS_context.eutra_cellId;
cellConfig->maxRefPower= p_cellConfig->CellConfigCommon.v.InitialCellPower.v.MaxReferencePower;
cellConfig->absoluteFrequencyPointA = p_cellConfig->PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencyPointA;
LOG_A(ENB_SS,"5G Cell configuration rece6ived for cell_id: %d Initial attenuation: %d \
Max ref power: %d\n for absoluteFrequencyPointA : %d =================================== \n",
cellConfig->header.cell_id,
cellConfig->initialAttenuation, cellConfig->maxRefPower,
cellConfig->absoluteFrequencyPointA);
//send_to_proxy();
sys_5G_send_proxy((void *)cellConfig, sizeof(CellConfig5GReq_t));
}
}
else if (req->Request.d == NR_SystemRequest_Type_DeltaValues)
{
/* TBD: Sending the dummy confirmation for now*/
ss_task_sys_nr_handle_deltaValues(req);
LOG_A(GNB_APP, "[SYS-GNB] Sent SYS CNF for NR_SystemRequest_Type_DeltaValues\n");
}
}
else if (req->Request.d == NR_SystemRequest_Type_DeltaValues)
{
/* TBD: Sending the dummy confirmation for now*/
ss_task_sys_nr_handle_deltaValues(req);
LOG_A(GNB_APP, "[SYS-GNB] Sent SYS CNF for NR_SystemRequest_Type_DeltaValues\n");
}
else
{
LOG_E(GNB_APP, "[SYS-GNB] Error ! SS_STATE %d Invalid SystemRequest_Type %d received\n",
RC.ss.State, req->Request.d);
RC.ss.State, req->Request.d);
}
break;
case SS_STATE_CELL_ACTIVE:
{
switch (req->Request.d)
{
case NR_SystemRequest_Type_Cell:
{
LOG_A(GNB_APP, "[SYS-GNB] Dummy handling for Cell Config 5G NR_SystemRequest_Type_Cell \n");
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_Cell, NULL);
}
break;
case NR_SystemRequest_Type_EnquireTiming:
{
sys_handle_nr_enquire_timing(tinfo);
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_EnquireTiming received\n");
}
break;
case NR_SystemRequest_Type_RadioBearerList:
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_RadioBearerList received\n");
if (false == ss_task_sys_nr_handle_cellConfigRadioBearer(&req) )
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_Cell \n");
return;
}
}
break;
case NR_SystemRequest_Type_CellAttenuationList:
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_CellAttenuationList received\n");
if (false == ss_task_sys_nr_handle_cellConfigAttenuation(&req) )
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_Cell \n");
return;
}
}
break;
case NR_SystemRequest_Type_PdcpCount:
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_PdcpCount received\n");
if (false == ss_task_sys_nr_handle_pdcpCount(&req))
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_PdcpCount \n");
return;
}
}
break;
case NR_SystemRequest_Type_AS_Security:
{
LOG_A(GNB_APP, "[SYS-GNB] Dummy handling for Cell Config 5G NR_SystemRequest_Type_AS_Security \n");
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_AS_Security, NULL);
}
break;
default:
{
LOG_E(GNB_APP, "[SYS-GNB] Error ! SS_STATE %d Invalid SystemRequest_Type %d received\n",
RC.ss.State, req->Request.d);
}
break;
}
}
{
switch (req->Request.d)
{
case NR_SystemRequest_Type_Cell:
{
LOG_A(GNB_APP, "[SYS-GNB] Dummy handling for Cell Config 5G NR_SystemRequest_Type_Cell \n");
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_Cell, NULL);
}
break;
case NR_SystemRequest_Type_EnquireTiming:
{
sys_handle_nr_enquire_timing(tinfo);
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_EnquireTiming received\n");
}
break;
case NR_SystemRequest_Type_RadioBearerList:
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_RadioBearerList received\n");
if (false == ss_task_sys_nr_handle_cellConfigRadioBearer(&req) )
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_Cell \n");
return;
}
}
break;
case NR_SystemRequest_Type_CellAttenuationList:
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_CellAttenuationList received\n");
if (false == ss_task_sys_nr_handle_cellConfigAttenuation(&req) )
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_Cell \n");
return;
}
}
break;
case NR_SystemRequest_Type_PdcpCount:
{
LOG_A(GNB_APP, "[SYS-GNB] NR_SystemRequest_Type_PdcpCount received\n");
if (false == ss_task_sys_nr_handle_pdcpCount(&req))
{
LOG_A(GNB_APP, "[SYS-GNB] Error handling Cell Config 5G for NR_SystemRequest_Type_PdcpCount \n");
return;
}
}
break;
case NR_SystemRequest_Type_AS_Security:
{
LOG_A(GNB_APP, "[SYS-GNB] Dummy handling for Cell Config 5G NR_SystemRequest_Type_AS_Security \n");
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_AS_Security, NULL);
}
break;
default:
{
LOG_E(GNB_APP, "[SYS-GNB] Error ! SS_STATE %d Invalid SystemRequest_Type %d received\n",
RC.ss.State, req->Request.d);
}
break;
}
}
break;
}
LOG_A(GNB_APP, "[SYS-GNB] SS_STATE %d New SS_STATE %d received SystemRequest_Type %d\n",
enterState, RC.ss.State, req->Request.d);
enterState, RC.ss.State, req->Request.d);
}
/*
......@@ -337,65 +337,65 @@ bool valid_nr_sys_msg(struct NR_SYSTEM_CTRL_REQ *req)
enum NR_SystemConfirm_Type_Sel cnfType = 0;
LOG_A(GNB_APP, "[SYS-GNB] received req : %d for cell %d RC.ss.state %d \n",
req->Request.d, req->Common.CellId, RC.ss.State);
req->Request.d, req->Common.CellId, RC.ss.State);
switch (req->Request.d)
{
case NR_SystemRequest_Type_Cell:
if (RC.ss.State >= SS_STATE_NOT_CONFIGURED)
{
valid = TRUE;
sendDummyCnf = FALSE;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
}
else
{
cnfType = NR_SystemConfirm_Type_Cell;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
}
break;
case NR_SystemRequest_Type_EnquireTiming:
valid = TRUE;
sendDummyCnf = FALSE;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_DeltaValues:
valid = TRUE;
sendDummyCnf = FALSE;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_RadioBearerList:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_RadioBearerList;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_CellAttenuationList:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_CellAttenuationList;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_AS_Security:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_AS_Security;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_PdcpCount:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_PdcpCount;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
default:
valid = FALSE;
sendDummyCnf = FALSE;
}
{
case NR_SystemRequest_Type_Cell:
if (RC.ss.State >= SS_STATE_NOT_CONFIGURED)
{
valid = TRUE;
sendDummyCnf = FALSE;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
}
else
{
cnfType = NR_SystemConfirm_Type_Cell;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
}
break;
case NR_SystemRequest_Type_EnquireTiming:
valid = TRUE;
sendDummyCnf = FALSE;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_DeltaValues:
valid = TRUE;
sendDummyCnf = FALSE;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_RadioBearerList:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_RadioBearerList;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_CellAttenuationList:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_CellAttenuationList;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_AS_Security:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_AS_Security;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
case NR_SystemRequest_Type_PdcpCount:
valid = TRUE;
sendDummyCnf = FALSE;
cnfType = NR_SystemConfirm_Type_PdcpCount;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
default:
valid = FALSE;
sendDummyCnf = FALSE;
}
if (sendDummyCnf)
{
send_sys_cnf(resType, resVal, cnfType, NULL);
LOG_A(GNB_APP, "[SYS-GNB] Sending Dummy OK Req %d cnTfype %d ResType %d ResValue %d\n",
req->Request.d, cnfType, resType, resVal);
req->Request.d, cnfType, resType, resVal);
}
return valid;
}
......@@ -580,157 +580,157 @@ void ss_task_sys_nr_handle_deltaValues(struct NR_SYSTEM_CTRL_REQ *req)
bool ss_task_sys_nr_handle_cellConfig5G(struct NR_CellConfigRequest_Type *p_req)
{
uint32_t gnbId = 0;
if (p_req->d == NR_CellConfigRequest_Type_AddOrReconfigure)
{
/* Populating PhyCellId */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.PhysicalCellId.d == true)
{
RC.nrrrc[gnbId]->carrier.physCellId = p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.PhysicalCellId.v;
*RC.nrrrc[gnbId]->configuration.scc->physCellId = p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.PhysicalCellId.v;
}
uint32_t gnbId = 0;
if (p_req->d == NR_CellConfigRequest_Type_AddOrReconfigure)
{
/* Populating PhyCellId */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.PhysicalCellId.d == true)
{
RC.nrrrc[gnbId]->carrier.physCellId = p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.PhysicalCellId.v;
*RC.nrrrc[gnbId]->configuration.scc->physCellId = p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.PhysicalCellId.v;
}
/* Populating NR_ARFCN */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.d == NR_ASN1_FrequencyInfoDL_Type_R15)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencyPointA;
LOG_A(GNB_APP, "fxn:%s DL absoluteFrequencyPointA :%d\n", __FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
}
/* Populating NR_ARFCN */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.d == NR_ASN1_FrequencyInfoDL_Type_R15)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencyPointA;
LOG_A(GNB_APP, "fxn:%s DL absoluteFrequencyPointA :%d\n", __FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA);
}
/* Populating offsetToPointA */
/* if (p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.d == SQN_NR_BCCH_DL_SCH_MessageType_c1)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->offsetToPointA =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.v.c1.v.
systemInformationBlockType1.servingCellConfigCommon.v.downlinkConfigCommon.frequencyInfoDL.offsetToPointA;
LOG_A(GNB_APP, "fxn:%s DL offsetToPointA:%d\n", __FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->offsetToPointA);
}
*/
/* Populating absoluteFrequencySSB */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencySSB.d == true)
{
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencySSB.v;
LOG_A(GNB_APP, "fxn:%s DL absoluteFrequencySSB:%d\n", __FUNCTION__,
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB);
}
/* Populating offsetToPointA */
/* if (p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.d == SQN_NR_BCCH_DL_SCH_MessageType_c1)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->offsetToPointA =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.v.c1.v.
systemInformationBlockType1.servingCellConfigCommon.v.downlinkConfigCommon.frequencyInfoDL.offsetToPointA;
LOG_A(GNB_APP, "fxn:%s DL offsetToPointA:%d\n", __FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->offsetToPointA);
}
*/
/* Populating absoluteFrequencySSB */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencySSB.d == true)
{
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.absoluteFrequencySSB.v;
LOG_A(GNB_APP, "fxn:%s DL absoluteFrequencySSB:%d\n", __FUNCTION__,
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB);
}
/* Populating frequency band list */
/* Populating frequency band list */
for (int i = 0; i < p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.frequencyBandList.d; i++)
{
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i] =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.frequencyBandList.v[i];
LOG_A(GNB_APP, "fxn:%s DL band[%d]:%d\n", __FUNCTION__, i,
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i]);
}
for (int i = 0; i < p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.frequencyBandList.d; i++)
{
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i] =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.frequencyBandList.v[i];
LOG_A(GNB_APP, "fxn:%s DL band[%d]:%d\n", __FUNCTION__, i,
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i]);
}
/* Populating scs_SpecificCarrierList */
for (int i = 0; i < p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.d; i++)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.v[i].offsetToCarrier;
/* Populating scs_SpecificCarrierList */
for (int i = 0; i < p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.d; i++)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.v[i].offsetToCarrier;
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.v[i].subcarrierSpacing;
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.v[i].subcarrierSpacing;
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.v[i].carrierBandwidth;
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.v[i].carrierBandwidth;
*RC.nrrrc[gnbId]->configuration.scc->ssbSubcarrierSpacing =
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing;
*RC.nrrrc[gnbId]->configuration.scc->ssbSubcarrierSpacing =
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing;
LOG_A(GNB_APP, "fxn:%s DL scs_SpecificCarrierList.offsetToCarrier :%d subcarrierSpacing:%d carrierBandwidth:%d \n",
__FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth);
}
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.d == NR_DuplexMode_Type_TDD)
{
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.referenceSubcarrierSpacing;
LOG_A(GNB_APP, "fxn:%s DL scs_SpecificCarrierList.offsetToCarrier :%d subcarrierSpacing:%d carrierBandwidth:%d \n",
__FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing,
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth);
}
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.dl_UL_TransmissionPeriodicity;
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.d == NR_DuplexMode_Type_TDD)
{
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.referenceSubcarrierSpacing;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofDownlinkSlots;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.dl_UL_TransmissionPeriodicity;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofDownlinkSymbols;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofDownlinkSlots;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofUplinkSlots;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofDownlinkSymbols;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofUplinkSymbols;
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofUplinkSlots;
}
RC.nrrrc[gnbId]->configuration.scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Common.v.DuplexMode.v.v.TDD.v.Config.Common.v.v.R15.pattern1.nrofUplinkSymbols;
RC.nrrrc[gnbId]->configuration.ssb_SubcarrierOffset =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.MIB.v.message.v.mib.ssb_SubcarrierOffset;
}
/* UL Absolute Frequency Population */
/* Populating NR_ARFCN */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.d == NR_ASN1_FrequencyInfoUL_Type_R15)
{
RC.nrrrc[gnbId]->configuration.ssb_SubcarrierOffset =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.MIB.v.message.v.mib.ssb_SubcarrierOffset;
/* Populating scs_SpecificCarrierList */
for (int i = 0; i < p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.d; i++)
{
/* UL Absolute Frequency Population */
/* Populating NR_ARFCN */
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.d == NR_ASN1_FrequencyInfoUL_Type_R15)
{
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.scs_SpecificCarrierList.v[i].carrierBandwidth;
/* Populating scs_SpecificCarrierList */
for (int i = 0; i < p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.FrequencyInfoDL.v.v.R15.scs_SpecificCarrierList.d; i++)
{
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.scs_SpecificCarrierList.v[i].offsetToCarrier;
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.scs_SpecificCarrierList.v[i].carrierBandwidth;
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.scs_SpecificCarrierList.v[i].subcarrierSpacing;
LOG_A(GNB_APP,
"fxn:%s UL scs_SpecificCarrierList.carrierBandwidth:%d\n scs_SpecificCarrierList.offsetToCarrier:%d\n scs_SpecificCarrierList.subcarrierSpacing:%d",
__FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth,
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier,
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing);
}
*RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->p_Max =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.p_Max.v;
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.scs_SpecificCarrierList.v[i].offsetToCarrier;
LOG_A(GNB_APP, "fxn:%s UL p_Max :%d\n", __FUNCTION__,
*RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->p_Max);
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.scs_SpecificCarrierList.v[i].subcarrierSpacing;
LOG_A(GNB_APP,
"fxn:%s UL scs_SpecificCarrierList.carrierBandwidth:%d\n scs_SpecificCarrierList.offsetToCarrier:%d\n scs_SpecificCarrierList.subcarrierSpacing:%d",
__FUNCTION__,
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->carrierBandwidth,
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->offsetToCarrier,
RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]->subcarrierSpacing);
}
*RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->p_Max =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Uplink.v.Uplink.v.v.Config.FrequencyInfoUL.v.v.R15.p_Max.v;
}
LOG_A(GNB_APP, "fxn:%s UL p_Max :%d\n", __FUNCTION__,
*RC.nrrrc[gnbId]->configuration.scc->uplinkConfigCommon->frequencyInfoUL->p_Max);
/*
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.MIB.v.message.v.mib.pdcch_ConfigSIB1.controlResourceSetZero;
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.MIB.v.message.v.mib.pdcch_ConfigSIB1.searchSpaceZero;
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.BWPs.v.BwpArray.v.v->BWP.v.d == NR_ASN1_BWP_Type_R15)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.BWPs.v.BwpArray.v.v->BWP.v.v.R15.locationAndBandwidth;
}
}
if (p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.v.c1.v.systemInformationBlockType1.servingCellConfigCommon.d == true )
{
RC.nrrrc[gnbId]->configuration.scc->ss_PBCH_BlockPower =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.v.c1.v.systemInformationBlockType1.servingCellConfigCommon.v.ss_PBCH_BlockPower;
}
*/
}
/*
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.MIB.v.message.v.mib.pdcch_ConfigSIB1.controlResourceSetZero;
return true;
*RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.MIB.v.message.v.mib.pdcch_ConfigSIB1.searchSpaceZero;
if (p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.BWPs.v.BwpArray.v.v->BWP.v.d == NR_ASN1_BWP_Type_R15)
{
RC.nrrrc[gnbId]->configuration.scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth =
p_req->v.AddOrReconfigure.PhysicalLayer.v.Downlink.v.BWPs.v.BwpArray.v.v->BWP.v.v.R15.locationAndBandwidth;
}
if (p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.v.c1.v.systemInformationBlockType1.servingCellConfigCommon.d == true )
{
RC.nrrrc[gnbId]->configuration.scc->ss_PBCH_BlockPower =
p_req->v.AddOrReconfigure.BcchConfig.v.BcchInfo.v.SIB1.v.message.v.c1.v.systemInformationBlockType1.servingCellConfigCommon.v.ss_PBCH_BlockPower;
}
*/
}
return true;
}
/*
......@@ -744,7 +744,7 @@ int cell_config_5G_done_indication()
{
if (cell_config_5G_done < 0)
{
LOG_A(GNB_APP, "[SYS-GNB] fxn:%s Signal to TASK_GNB_APP about cell configuration complete", __FUNCTION__);
LOG_A(GNB_APP, "[SYS-GNB] fxn:%s Signal to TASK_GNB_APP about cell configuration complete", __FUNCTION__);
pthread_mutex_lock(&cell_config_5G_done_mutex);
cell_config_5G_done = 0;
pthread_cond_broadcast(&cell_config_5G_done_cond);
......@@ -799,33 +799,33 @@ bool ss_task_sys_nr_handle_cellConfigRadioBearer(struct NR_SYSTEM_CTRL_REQ *req)
bool ss_task_sys_nr_handle_cellConfigAttenuation(struct NR_SYSTEM_CTRL_REQ *req)
{
LOG_A(GNB_APP, "[SYS-GNB] Entry in fxn:%s\n", __FUNCTION__);
struct NR_SYSTEM_CTRL_CNF *msgCnf = CALLOC(1, sizeof(struct NR_SYSTEM_CTRL_CNF));
MessageDef *message_p = itti_alloc_new_message(TASK_SYS_GNB, INSTANCE_DEFAULT, SS_NR_SYS_PORT_MSG_CNF);
LOG_A(GNB_APP, "[SYS-GNB] Entry in fxn:%s\n", __FUNCTION__);
struct NR_SYSTEM_CTRL_CNF *msgCnf = CALLOC(1, sizeof(struct NR_SYSTEM_CTRL_CNF));
MessageDef *message_p = itti_alloc_new_message(TASK_SYS_GNB, INSTANCE_DEFAULT, SS_NR_SYS_PORT_MSG_CNF);
if (message_p)
{
LOG_A(GNB_APP, "[SYS-GNB] Send SS_NR_SYS_PORT_MSG_CNF\n");
msgCnf->Common.CellId = nr_Cell_NonSpecific;
msgCnf->Common.Result.d = ConfirmationResult_Type_Success;
msgCnf->Common.Result.v.Success = true;
msgCnf->Confirm.d = NR_SystemConfirm_Type_CellAttenuationList;
msgCnf->Confirm.v.CellAttenuationList = true;
if (message_p)
{
LOG_A(GNB_APP, "[SYS-GNB] Send SS_NR_SYS_PORT_MSG_CNF\n");
msgCnf->Common.CellId = nr_Cell_NonSpecific;
msgCnf->Common.Result.d = ConfirmationResult_Type_Success;
msgCnf->Common.Result.v.Success = true;
msgCnf->Confirm.d = NR_SystemConfirm_Type_CellAttenuationList;
msgCnf->Confirm.v.CellAttenuationList = true;
SS_NR_SYS_PORT_MSG_CNF(message_p).cnf = msgCnf;
int send_res = itti_send_msg_to_task(TASK_SS_PORTMAN_GNB, INSTANCE_DEFAULT, message_p);
if (send_res < 0)
{
LOG_A(GNB_APP, "[SYS-GNB] Error sending to [SS-PORTMAN-GNB]\n");
return false;
}
else
{
LOG_A(GNB_APP, "[SYS-GNB] fxn:%s NR_SYSTEM_CTRL_CNF sent for cnfType:CellAttenuationList to Port Manager\n", __FUNCTION__);
}
}
LOG_A(GNB_APP, "[SYS-GNB] Exit from fxn:%s\n", __FUNCTION__);
return true;
SS_NR_SYS_PORT_MSG_CNF(message_p).cnf = msgCnf;
int send_res = itti_send_msg_to_task(TASK_SS_PORTMAN_GNB, INSTANCE_DEFAULT, message_p);
if (send_res < 0)
{
LOG_A(GNB_APP, "[SYS-GNB] Error sending to [SS-PORTMAN-GNB]\n");
return false;
}
else
{
LOG_A(GNB_APP, "[SYS-GNB] fxn:%s NR_SYSTEM_CTRL_CNF sent for cnfType:CellAttenuationList to Port Manager\n", __FUNCTION__);
}
}
LOG_A(GNB_APP, "[SYS-GNB] Exit from fxn:%s\n", __FUNCTION__);
return true;
}
/*
......@@ -913,29 +913,29 @@ static int sys_5G_send_init_udp(const udpSockReq_t *req)
bool ss_task_sys_nr_handle_pdcpCount(struct NR_SYSTEM_CTRL_REQ *req)
{
LOG_A(ENB_SS, "Entry in fxn:%s\n", __FUNCTION__);
struct NR_PDCP_CountCnf_Type PdcpCount;
LOG_A(ENB_SS, "Entry in fxn:%s\n", __FUNCTION__);
struct NR_PDCP_CountCnf_Type PdcpCount;
PdcpCount.d = NR_PDCP_CountCnf_Type_Get;
PdcpCount.v.Get.d = 1;
const size_t size = sizeof(struct NR_PdcpCountInfo_Type) * PdcpCount.v.Get.d;
PdcpCount.v.Get.v =(struct NR_PdcpCountInfo_Type *)acpMalloc(size);
for (int i = 0; i < PdcpCount.v.Get.d; i++)
{
PdcpCount.v.Get.v[i].RadioBearerId.d = NR_RadioBearerId_Type_Srb;
PdcpCount.v.Get.v[i].RadioBearerId.v.Srb = 1;
PdcpCount.v.Get.v[i].UL.d = true;
PdcpCount.v.Get.v[i].DL.d = true;
PdcpCount.d = NR_PDCP_CountCnf_Type_Get;
PdcpCount.v.Get.d = 1;
const size_t size = sizeof(struct NR_PdcpCountInfo_Type) * PdcpCount.v.Get.d;
PdcpCount.v.Get.v =(struct NR_PdcpCountInfo_Type *)acpMalloc(size);
for (int i = 0; i < PdcpCount.v.Get.d; i++)
{
PdcpCount.v.Get.v[i].RadioBearerId.d = NR_RadioBearerId_Type_Srb;
PdcpCount.v.Get.v[i].RadioBearerId.v.Srb = 1;
PdcpCount.v.Get.v[i].UL.d = true;
PdcpCount.v.Get.v[i].DL.d = true;
PdcpCount.v.Get.v[i].UL.v.Format = E_PdcpCount_Srb;
PdcpCount.v.Get.v[i].DL.v.Format = E_PdcpCount_Srb;
PdcpCount.v.Get.v[i].UL.v.Format = E_PdcpCount_Srb;
PdcpCount.v.Get.v[i].DL.v.Format = E_PdcpCount_Srb;
int_to_bin(1, 32, PdcpCount.v.Get.v[i].UL.v.Value);
int_to_bin(1, 32, PdcpCount.v.Get.v[i].DL.v.Value);
}
int_to_bin(1, 32, PdcpCount.v.Get.v[i].UL.v.Value);
int_to_bin(1, 32, PdcpCount.v.Get.v[i].DL.v.Value);
}
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_PdcpCount, (void *)&PdcpCount);
LOG_A(ENB_SS, "Exit from fxn:%s\n", __FUNCTION__);
return true;
send_sys_cnf(ConfirmationResult_Type_Success, TRUE, NR_SystemConfirm_Type_PdcpCount, (void *)&PdcpCount);
LOG_A(ENB_SS, "Exit from fxn:%s\n", __FUNCTION__);
return true;
}
......@@ -311,7 +311,7 @@ void *udp_eNB_task(void *args_p)
LOG_I(UDP_, " Entry in %s\n", __FUNCTION__);
while(1) {
LOG_I(UDP_, " Fxn:%s line:%d\n", __FUNCTION__, __LINE__);
LOG_I(UDP_, " Fxn:%s line:%d\n", __FUNCTION__, __LINE__);
itti_receive_msg(TASK_UDP, &received_message_p);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UDP_ENB_TASK, VCD_FUNCTION_IN);
#if defined(LOG_UDP) && LOG_UDP > 0
......@@ -324,97 +324,97 @@ void *udp_eNB_task(void *args_p)
//instance = ITTI_MSG_INSTANCE (received_message_p);
switch (ITTI_MSG_ID(received_message_p)) {
case UDP_INIT: {
LOG_D(UDP_, "Received UDP_INIT\n");
udp_init_t *udp_init_p;
udp_init_p = &received_message_p->ittiMsg.udp_init;
udp_eNB_create_socket(
udp_init_p->port,
udp_init_p->address,
ITTI_MSG_ORIGIN_ID(received_message_p));
}
break;
case UDP_DATA_REQ: {
case UDP_INIT: {
LOG_D(UDP_, "Received UDP_INIT\n");
udp_init_t *udp_init_p;
udp_init_p = &received_message_p->ittiMsg.udp_init;
udp_eNB_create_socket(
udp_init_p->port,
udp_init_p->address,
ITTI_MSG_ORIGIN_ID(received_message_p));
}
break;
case UDP_DATA_REQ: {
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "Received UDP_DATA_REQ\n");
LOG_D(UDP_, "Received UDP_DATA_REQ\n");
#endif
int udp_sd = -1;
ssize_t bytes_written;
struct udp_socket_desc_s *udp_sock_p = NULL;
udp_data_req_t *udp_data_req_p;
struct sockaddr_in peer_addr;
char buffer[INET_ADDRSTRLEN];
udp_data_req_p = &received_message_p->ittiMsg.udp_data_req;
memset(&peer_addr, 0, sizeof(struct sockaddr_in));
peer_addr.sin_family = AF_INET;
peer_addr.sin_port = htons(udp_data_req_p->peer_port);
peer_addr.sin_addr.s_addr = udp_data_req_p->peer_address;
inet_ntop( AF_INET, &peer_addr.sin_addr, buffer, sizeof( buffer ));
pthread_mutex_lock(&udp_socket_list_mutex);
udp_sock_p = udp_eNB_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p));
if (udp_sock_p == NULL) {
LOG_E(UDP_,
"Failed to retrieve the udp socket descriptor "
"associated with task %d\n",
ITTI_MSG_ORIGIN_ID(received_message_p));
pthread_mutex_unlock(&udp_socket_list_mutex);
if (udp_data_req_p->buffer) {
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer);
}
goto on_error;
}
udp_sd = udp_sock_p->sd;
pthread_mutex_unlock(&udp_socket_list_mutex);
//#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n",
udp_sd,
udp_data_req_p->buffer_length,
IPV4_ADDR_FORMAT(udp_data_req_p->peer_address),
udp_data_req_p->peer_port);
//#endif
bytes_written = sendto(
udp_sd,
&udp_data_req_p->buffer[udp_data_req_p->buffer_offset],
udp_data_req_p->buffer_length,
0,
(struct sockaddr *)&peer_addr,
sizeof(struct sockaddr_in));
if (bytes_written != udp_data_req_p->buffer_length) {
LOG_E(UDP_, "There was an error while writing to socket %d rc %zd"
"(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)\n",
udp_sd, bytes_written, errno, strerror(errno));
}
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer);
}
break;
case TERMINATE_MESSAGE: {
LOG_W(UDP_, " *** Exiting UDP thread\n");
itti_exit_task();
}
break;
case MESSAGE_TEST: {
} break;
default: {
LOG_W(UDP_, "Unkwnon message ID %d:%s\n",
ITTI_MSG_ID(received_message_p),
ITTI_MSG_NAME(received_message_p));
}
break;
int udp_sd = -1;
ssize_t bytes_written;
struct udp_socket_desc_s *udp_sock_p = NULL;
udp_data_req_t *udp_data_req_p;
struct sockaddr_in peer_addr;
char buffer[INET_ADDRSTRLEN];
udp_data_req_p = &received_message_p->ittiMsg.udp_data_req;
memset(&peer_addr, 0, sizeof(struct sockaddr_in));
peer_addr.sin_family = AF_INET;
peer_addr.sin_port = htons(udp_data_req_p->peer_port);
peer_addr.sin_addr.s_addr = udp_data_req_p->peer_address;
inet_ntop( AF_INET, &peer_addr.sin_addr, buffer, sizeof( buffer ));
pthread_mutex_lock(&udp_socket_list_mutex);
udp_sock_p = udp_eNB_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p));
if (udp_sock_p == NULL) {
LOG_E(UDP_,
"Failed to retrieve the udp socket descriptor "
"associated with task %d\n",
ITTI_MSG_ORIGIN_ID(received_message_p));
pthread_mutex_unlock(&udp_socket_list_mutex);
if (udp_data_req_p->buffer) {
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer);
}
goto on_error;
}
udp_sd = udp_sock_p->sd;
pthread_mutex_unlock(&udp_socket_list_mutex);
//#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n",
udp_sd,
udp_data_req_p->buffer_length,
IPV4_ADDR_FORMAT(udp_data_req_p->peer_address),
udp_data_req_p->peer_port);
//#endif
bytes_written = sendto(
udp_sd,
&udp_data_req_p->buffer[udp_data_req_p->buffer_offset],
udp_data_req_p->buffer_length,
0,
(struct sockaddr *)&peer_addr,
sizeof(struct sockaddr_in));
if (bytes_written != udp_data_req_p->buffer_length) {
LOG_E(UDP_, "There was an error while writing to socket %d rc %zd"
"(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)\n",
udp_sd, bytes_written, errno, strerror(errno));
}
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer);
}
break;
case TERMINATE_MESSAGE: {
LOG_W(UDP_, " *** Exiting UDP thread\n");
itti_exit_task();
}
break;
case MESSAGE_TEST: {
} break;
default: {
LOG_W(UDP_, "Unkwnon message ID %d:%s\n",
ITTI_MSG_ID(received_message_p),
ITTI_MSG_NAME(received_message_p));
}
break;
}
on_error:
......
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