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);
......
This diff is collapsed.
......@@ -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