Commit cf3694be authored by Xue Song's avatar Xue Song

modify the f1 establishment process

parent 874246b3
......@@ -460,16 +460,15 @@ int create_gNB_tasks(uint32_t gnb_nb) {
LOG_E(GNB_APP, "Create task for gNB APP failed\n");
return -1;
}
}
if(gnb_nb > 0) {
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
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");
return -1;
}
}
if(gnb_nb > 0) {
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
printf("####### node is CU \n");
if (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) {
......@@ -477,7 +476,8 @@ int create_gNB_tasks(uint32_t gnb_nb) {
return -1;
}
}
} else {
if (NODE_IS_DU(RC.nrrrc[0]->node_type)) {
printf("####### node is DU \n");
if (itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL) < 0) {
LOG_E(F1AP, "Create task for F1AP DU failed\n");
......
......@@ -265,7 +265,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0);
log_dump(PHY, ulsch_harq->b, 16, LOG_DUMP_CHAR,"gnb pusch rx frame %d %d: ", ulsch_harq->frame, ulsch_harq->slot);
// log_dump(PHY, ulsch_harq->b, 16, LOG_DUMP_CHAR,"gnb pusch rx frame %d %d: ", ulsch_harq->frame, ulsch_harq->slot);
} else {
LOG_I(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot,
......
......@@ -463,6 +463,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
F1AP_SETUP_RESP (msg_p).gNB_CU_name);
break;
case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List:
{
AssertFatal(ie->criticality == F1AP_Criticality_reject,
"ie->criticality != F1AP_Criticality_reject\n");
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List,
......@@ -492,41 +493,41 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
cell->nRCGI.nRCellIdentity.buf[4]);
BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity,
F1AP_SETUP_RESP (msg_p).nr_cellid[i]);
F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI;
if(0) {
F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
AssertFatal(ext!=NULL,"Extension is null\n");
for (int cnt=0;cnt<ext->list.count;cnt++) {
F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt];
switch (cells_to_be_activated_list_itemExtIEs->id) {
/*
/*
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING:
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation,
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList,
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List,
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU,
case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List
*/
*/
case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation:
{
F1AP_SETUP_RESP (msg_p).nrpci[i] = *cell->nRPCI;
F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation;
F1AP_SETUP_RESP (msg_p).num_SI[i] = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;
AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n");
LOG_D(F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n",
i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i],
F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]);
for (int si =0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) {
for (int si = 0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) {
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
size_t size = sib_item->sIBmessage.size;
F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size;
LOG_D(F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size);
F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]);
memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][sib_item->sIBtype],
memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si],
(void*)sib_item->sIBmessage.buf,
size);
}
}
break;
}
case F1AP_ProtocolIE_ID_id_AvailablePLMNList:
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n");
break;
......@@ -544,15 +545,20 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
break;
}
} // for (cnt=...
}
} // for (cells_to_activate...
break;
} // case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List
default:
AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n", (int)ie->id);
break;
} // switch ie
} // for IE
AssertFatal(TransactionId!=-1,"TransactionId was not sent\n");
AssertFatal(num_cells_to_activate>0,"No cells activated\n");
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate;
// tmp
F1AP_SETUP_RESP (msg_p).num_SI[0] = 1;
// F1AP_SETUP_RESP (msg_p).num_SI[0] = 1;
for (int i=0;i<num_cells_to_activate;i++)
AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i);
......
......@@ -1358,15 +1358,15 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
F1AP_SETUP_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
gNB_RRC_INST *rrc = RC.nrrrc[k];
// wait until RRC cell information is configured
// int cell_info_configured=0;
int cell_info_configured = 0;
// do {
// LOG_I(GNB_APP,"ngran_gNB_DU: Waiting for basic cell configuration\n");
// usleep(100000);
// pthread_mutex_lock(&rrc->cell_info_mutex);
// cell_info_configured = rrc->cell_info_configured;
// pthread_mutex_unlock(&rrc->cell_info_mutex);
// } while (cell_info_configured ==0);
do {
LOG_I(GNB_APP,"ngran_gNB_DU: Waiting for basic cell configuration\n");
usleep(100000);
pthread_mutex_lock(&rrc->cell_info_mutex);
cell_info_configured = rrc->cell_info_configured;
pthread_mutex_unlock(&rrc->cell_info_mutex);
} while (cell_info_configured == 0);
rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).mcc[k];
rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).mnc[k];
......@@ -1424,7 +1424,155 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
}
int du_check_plmn_identity(rrc_gNB_carrier_data_t *carrier,uint16_t mcc,uint16_t mnc,uint8_t mnc_digit_length) {
return (1);
NR_SIB1_t *sib1 = carrier->siblock1->message.choice.c1->choice.systemInformationBlockType1;
AssertFatal(sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_IdentityList.list.count > 0,
"plmn info isn't there\n");
AssertFatal(mnc_digit_length == 2 || mnc_digit_length == 3,
"impossible mnc_digit_length %d\n", mnc_digit_length);
NR_PLMN_Identity_t *plmn_Identity = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]
->plmn_IdentityList.list.array[0];
// check if mcc is different and return failure if so
LOG_I(GNB_APP, "plmn_Identity->mcc: %d%d%d\n", *plmn_Identity->mcc->list.array[0],
*plmn_Identity->mcc->list.array[1],
*plmn_Identity->mcc->list.array[2]);
if (mcc !=
((*plmn_Identity->mcc->list.array[0])*100)+
((*plmn_Identity->mcc->list.array[1])*10) +
(*plmn_Identity->mcc->list.array[2])) {
LOG_E(GNB_APP, "mcc in F1AP_SETUP_RESP message is different from mcc in DU \n");
return(0);
}
// check that mnc digit length is different and return failure if so
if (mnc_digit_length != plmn_Identity->mnc.list.count) {
LOG_E(GNB_APP, "mnc(length: %d) in F1AP_SETUP_RESP message is different from mnc(length: %d) in DU \n",
mnc_digit_length, plmn_Identity->mnc.list.count);
return 0;
}
// check that 2 digit mnc is different and return failure if so
if (mnc_digit_length == 2 &&
(mnc !=
(*plmn_Identity->mnc.list.array[0]*10) +
(*plmn_Identity->mnc.list.array[1]))) {
LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%d%d) in DU \n",
mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1]);
return(0);
}
else if (mnc_digit_length == 3 &&
(mnc !=
(*plmn_Identity->mnc.list.array[0]*100) +
(*plmn_Identity->mnc.list.array[1]*10) +
(*plmn_Identity->mnc.list.array[2]))) {
LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%d%d%d) in DU \n",
mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1], *plmn_Identity->mnc.list.array[2]);
return(0);
}
// if we're here, the mcc/mnc match so return success
return(1);
}
void du_extract_and_decode_SI(int inst, int si_ind, uint8_t *si_container, int si_container_length) {
gNB_RRC_INST *rrc = RC.nrrrc[inst];
rrc_gNB_carrier_data_t *carrier = &rrc->carrier;
NR_BCCH_DL_SCH_Message_t *bcch_message ;
AssertFatal(si_ind == 0, "Can only handle a single SI block for now\n");
LOG_I(GNB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n", inst, si_ind, si_container, si_container_length);
// point to first SI block
bcch_message = &carrier->systemInformation;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_BCCH_DL_SCH_Message,
(void **)&bcch_message,
(const void *)si_container,
si_container_length);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0, "[GNB_APP][NR_RRC inst %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
inst,
dec_rval.consumed );
}
if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) {
switch (bcch_message->message.choice.c1->present) {
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
AssertFatal(1 == 0, "Should have received SIB1 from CU\n");
break;
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
{
NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation;
if (si->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_systemInformation) {
for (int i = 0; i < si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count; i++) {
LOG_I(GNB_APP, "Extracting SI %d/%d\n", i, si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count);
SystemInformation_IEs__sib_TypeAndInfo__Member *typeAndInfo;
typeAndInfo = si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.array[i];
switch(typeAndInfo->present) {
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_NOTHING:
AssertFatal(0, "Should have received SIB2 SIB3 from CU\n");
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst);
carrier->sib2 = typeAndInfo->choice.sib2;
carrier->SIB23 = (uint8_t *)malloc(64);
memcpy((void *)carrier->SIB23, (void *)si_container, si_container_length);
carrier->sizeof_SIB23 = si_container_length;
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3:
carrier->sib3 = typeAndInfo->choice.sib3;
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst);
break;
case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610:
LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB14 in CU F1AP_SETUP_RESP message\n", inst);
break;
default:
AssertFatal(1 == 0,"Shouldn't have received this SI %d\n", typeAndInfo->present);
break;
}
}
}
break;
}
case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
AssertFatal(0, "Should have received SIB1 from CU\n");
break;
}
} else AssertFatal(1 == 0, "No SI messages\n");
}
void configure_gnb_du_mac(int inst) {
......@@ -1460,10 +1608,11 @@ void gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) {
resp->nrpci[j] == carrier->physCellId)) {
// copy system information and decode it
for (si_ind=0; si_ind<resp->num_SI[j]; si_ind++) {
// extract_and_decode_SI(i,
// si_ind,
// resp->SI_container[j][si_ind],
// resp->SI_container_length[j][si_ind]);
du_extract_and_decode_SI(i,
si_ind,
resp->SI_container[j][si_ind],
resp->SI_container_length[j][si_ind]);
}
// perform MAC/L1 common configuration
......@@ -1537,17 +1686,6 @@ void nr_read_config_and_init(void) {
RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]);
}
if (NODE_IS_DU(RC.nrrrc[0]->node_type)) {
RC.nrrrc[0]->carrier.servingcellconfigcommon = RC.nrrrc[0]->configuration.scc;
RC.nrrrc[0]->carrier.MIB = (uint8_t *) malloc16(4);
RC.nrrrc[0]->carrier.sizeof_MIB = do_MIB_NR(RC.nrrrc[0], 0);
RC.nrrrc[0]->carrier.sizeof_SIB1 = do_SIB1_NR(&RC.nrrrc[0]->carrier, &RC.nrrrc[0]->configuration);
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[0]);
LOG_I(GNB_APP, "Adding new user (%p)\n",ue_context_p);
rrc_add_nsa_user(RC.nrrrc[0], ue_context_p,NULL);
}
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
pdcp_layer_init_for_CU();
nr_DRB_preconfiguration(0x1234);
......
......@@ -301,9 +301,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
// TODO : Add support for more than one PLMN
//int num_plmn = configuration->num_plmn;
int num_plmn = 1;
struct NR_PLMN_Identity nr_plmn[num_plmn];
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
struct NR_PLMN_Identity *nr_plmn = CALLOC(1, sizeof(struct NR_PLMN_Identity) * num_plmn);
NR_MCC_MNC_Digit_t (*nr_mcc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
NR_MCC_MNC_Digit_t (*nr_mnc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);;
memset(nr_plmn,0,sizeof(nr_plmn));
memset(nr_mcc_digit,0,sizeof(nr_mcc_digit));
memset(nr_mnc_digit,0,sizeof(nr_mnc_digit));
......@@ -336,9 +336,14 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
nr_plmn[i].mnc.list.size=0;
nr_plmn[i].mnc.list.count=0;
if (nr_mnc_digit[i][0] == 0) {
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
} else {
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
}
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
}//end plmn loop
......@@ -362,6 +367,8 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.bits_unused = 1;
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet);
#endif
xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, (void *)sib1_message);
//encode SIB1 to data
carrier->SIB1=(uint8_t *) malloc16(128);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
......
......@@ -438,6 +438,9 @@ typedef struct {
NR_BCCH_BCH_Message_t *mib_DU;
NR_BCCH_DL_SCH_Message_t *siblock1_DU;
NR_SIB1_t *sib1;
NR_SIB2_t *sib2;
NR_SIB3_t *sib3;
NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23
int ssb_SubcarrierOffset;
int pdsch_AntennaPorts;
int pusch_TargetSNRx10;
......@@ -496,6 +499,8 @@ typedef struct gNB_RRC_INST_s {
int srs_enable[MAX_NUM_CCs];
uint16_t sctp_in_streams;
uint16_t sctp_out_streams;
int cell_info_configured;
pthread_mutex_t cell_info_mutex;
} gNB_RRC_INST;
......
......@@ -213,9 +213,13 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) {
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
rrc->carrier.MIB = (uint8_t *) malloc16(4);
rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0);
rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration);
}
if (!NODE_IS_DU(rrc->node_type)) {
rrc->carrier.SIB23 = (uint8_t *) malloc16(100);
AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB");
......@@ -224,7 +228,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
AssertFatal(rrc->carrier.sizeof_SIB23 != 255,"FATAL, RC.nrrrc[mod].carrier[CC_id].sizeof_SIB23 == 255");
}
LOG_I(NR_RRC,"Done init_NR_SI\n");
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)){
if (NODE_IS_MONOLITHIC(rrc->node_type)){
rrc_mac_config_req_gNB(rrc->module_id,
rrc->carrier.ssb_SubcarrierOffset,
rrc->carrier.pdsch_AntennaPorts,
......@@ -237,6 +241,12 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
);
}
/* set flag to indicate that cell information is configured. This is required
* in DU to trigger F1AP_SETUP procedure */
pthread_mutex_lock(&rrc->cell_info_mutex);
rrc->cell_info_configured=1;
pthread_mutex_unlock(&rrc->cell_info_mutex);
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) {
// This is for phytest only, emulate first X2 message if uecap.raw file is present
FILE *fd;
......@@ -316,6 +326,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
rrc->carrier.pusch_TargetSNRx10 = configuration->pusch_TargetSNRx10;
rrc->carrier.pucch_TargetSNRx10 = configuration->pucch_TargetSNRx10;
/// System Information INIT
pthread_mutex_init(&rrc->cell_info_mutex,NULL);
rrc->cell_info_configured = 0;
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt));
init_NR_SI(rrc, configuration);
rrc_init_nr_global_param();
......@@ -2380,7 +2392,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
LOG_W(NR_RRC, "instance %d mib length %d\n", i, f1_setup_req->mib_length[i]);
LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]);
memcpy((void *)rrc->carrier.MIB,f1_setup_req->mib[i],f1_setup_req->mib_length[i]);
if(0) {
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_BCH_Message,
(void **)&rrc->carrier.mib_DU,
......@@ -2393,8 +2404,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
NR_BCCH_BCH_Message_t *mib = &rrc->carrier.mib;
NR_BCCH_BCH_Message_t *mib_DU = rrc->carrier.mib_DU;
mib->message.present = NR_BCCH_BCH_MessageType_PR_mib;
// mib->message.choice.mib = calloc(1, sizeof(NR_MIB_t));
mib->message.choice.mib = mib_DU->message.choice.mib;
mib->message.choice.mib = CALLOC(1,sizeof(struct NR_MIB));
memset(mib->message.choice.mib,0,sizeof(struct NR_MIB));
memcpy(mib->message.choice.mib, mib_DU->message.choice.mib, sizeof(struct NR_MIB));
rrc->carrier.SIB1 = malloc(f1_setup_req->sib1_length[i]);
rrc->carrier.sizeof_SIB1 = f1_setup_req->sib1_length[i];
......@@ -2417,7 +2429,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
"bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
rrc->carrier.physCellId = f1_setup_req->nr_pci[i];
}
// prepare F1_SETUP_RESPONSE
if (msg_p == NULL) {
......
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