Commit 7456cf94 authored by Robert Schmidt's avatar Robert Schmidt

Refactor F1 Setup Req: Reorganize cellIDs_t and rename to f1ap_served_cell_info_t

parent 3dbcadf2
......@@ -90,22 +90,22 @@ typedef struct f1ap_plmn_t {
uint8_t mnc_digit_length;
} f1ap_plmn_t;
typedef struct cellIDs_s {
// Served Cell Information
/* Tracking area code */
uint32_t *tac;
typedef struct f1ap_served_cell_info_t {
// NR CGI
f1ap_plmn_t plmn;
uint64_t nr_cellid; // NR Global Cell Id
// NR Physical Cell Ids
uint16_t nr_pci;
/* Tracking area code */
uint32_t *tac;
// Number of slide support items (max 16, could be increased to as much as 1024)
uint16_t num_ssi;
uint8_t sst;
uint8_t sd;
} cellIDs_t;
} f1ap_served_cell_info_t;
typedef struct f1ap_setup_req_s {
......@@ -115,7 +115,10 @@ typedef struct f1ap_setup_req_s {
/// number of DU cells available
uint16_t num_cells_available; //0< num_cells_available <= 512;
cellIDs_t cell[F1AP_MAX_NB_CELLS];
struct {
f1ap_served_cell_info_t info;
} cell[F1AP_MAX_NB_CELLS];
// fdd_flag = 1 means FDD, 0 means TDD
int fdd_flag;
......
......@@ -122,27 +122,27 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
F1AP_Served_Cell_Information_t *servedCellInformation= &served_cells_item->served_Cell_Information;
/* tac */
if (servedCellInformation->fiveGS_TAC) {
req->cell[i].tac = malloc(sizeof(*req->cell[i].tac));
AssertFatal(req->cell[i].tac != NULL, "out of memory\n");
OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, *req->cell[i].tac);
LOG_D(F1AP, "req->tac[%d] %d \n", i, *req->cell[i].tac);
req->cell[i].info.tac = malloc(sizeof(*req->cell[i].info.tac));
AssertFatal(req->cell[i].info.tac != NULL, "out of memory\n");
OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, *req->cell[i].info.tac);
LOG_D(F1AP, "req->tac[%d] %d \n", i, *req->cell[i].info.tac);
}
/* - nRCGI */
TBCD_TO_MCC_MNC(&(servedCellInformation->nRCGI.pLMN_Identity),
req->cell[i].plmn.mcc,
req->cell[i].plmn.mnc,
req->cell[i].plmn.mnc_digit_length);
req->cell[i].info.plmn.mcc,
req->cell[i].info.plmn.mnc,
req->cell[i].info.plmn.mnc_digit_length);
// NR cellID
BIT_STRING_TO_NR_CELL_IDENTITY(&servedCellInformation->nRCGI.nRCellIdentity,
req->cell[i].nr_cellid);
req->cell[i].info.nr_cellid);
LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id,
req->cell[i].plmn.mcc,
req->cell[i].plmn.mnc,
(long long unsigned int)req->cell[i].nr_cellid);
req->cell[i].info.plmn.mcc,
req->cell[i].info.plmn.mnc,
(long long unsigned int)req->cell[i].info.nr_cellid);
/* - nRPCI */
req->cell[i].nr_pci = servedCellInformation->nRPCI;
LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].nr_pci);
req->cell[i].info.nr_pci = servedCellInformation->nRPCI;
LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].info.nr_pci);
// FDD Cells
if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_fDD) {
......
......@@ -964,7 +964,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context
uint32_t len=0;
// for test
LOG_W(F1AP, "UE Context Modification Request PLMN is hardcoded!\n");
cellIDs_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.mnc_digit_length=2};
f1ap_served_cell_info_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.mnc_digit_length=2};
/* Create */
/* 0. Message Type */
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
......
......@@ -144,7 +144,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req)
for (int i=0; i<num_cells_available; i++) {
/* mandatory */
/* 4.1 served cells item */
cellIDs_t *cell=&setup_req->cell[i];
f1ap_served_cell_info_t *cell = &setup_req->cell[i].info;
asn1cSequenceAdd(ieCells->value.choice.GNB_DU_Served_Cells_List.list,
F1AP_GNB_DU_Served_Cells_ItemIEs_t, duServedCell);
duServedCell->id = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item;
......@@ -153,7 +153,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req)
F1AP_GNB_DU_Served_Cells_Item_t *gnb_du_served_cells_item=&duServedCell->value.choice.GNB_DU_Served_Cells_Item;
/* 4.1.1 served cell Information */
F1AP_Served_Cell_Information_t *served_cell_information= &gnb_du_served_cells_item->served_Cell_Information;
addnRCGI(served_cell_information->nRCGI,cell);
addnRCGI(served_cell_information->nRCGI, cell);
/* - nRPCI */
served_cell_information->nRPCI = cell->nr_pci; // int 0..1007
/* - fiveGS_TAC */
......@@ -593,10 +593,10 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
F1AP_Served_Cells_To_Add_Item_t *served_cells_to_add_item= &served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item;
F1AP_Served_Cell_Information_t *served_cell_information=&served_cells_to_add_item->served_Cell_Information;
/* - nRCGI */
addnRCGI(served_cell_information->nRCGI, &f1ap_setup_req->cell[j]);
addnRCGI(served_cell_information->nRCGI, &f1ap_setup_req->cell[j].info);
/* - nRPCI */
/* 2.1.1 serverd cell Information */
cellIDs_t *cell = &f1ap_setup_req->cell[j];
f1ap_served_cell_info_t *cell = &f1ap_setup_req->cell[j].info;
served_cell_information->nRPCI = cell->nr_pci; // int 0..1007
/* - fiveGS_TAC */
if (cell->tac != NULL) {
......@@ -677,7 +677,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
for (int i=0; i<1; i++) {
//
cellIDs_t *cell = &f1ap_setup_req->cell[i];
f1ap_served_cell_info_t *cell = &f1ap_setup_req->cell[i].info;
asn1cSequenceAdd(ie3->value.choice.Served_Cells_To_Modify_List.list, F1AP_Served_Cells_To_Modify_ItemIEs_t, served_cells_to_modify_item_ies);
served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item;
served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject;
......@@ -690,11 +690,11 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
/* - nRCGI */
//addnRGCI(served_cell_information->nRCGI,f1ap_setup_req->cell[i]);
/* - nRPCI */
served_cell_information->nRPCI = f1ap_setup_req->cell[i].nr_pci; // int 0..1007
served_cell_information->nRPCI = cell->nr_pci; // int 0..1007
/* - fiveGS_TAC */
asn1cCalloc(served_cell_information->fiveGS_TAC, tac );
OCTET_STRING_fromBuf(tac,
(const char *) &f1ap_setup_req->cell[i].tac,
(const char *) &cell->tac,
3);
/* - Configured_EPS_TAC */
......@@ -777,7 +777,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance,
served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item;
F1AP_Served_Cells_To_Delete_Item_t *served_cells_to_delete_item=&served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item;
/* 3.1 oldNRCGI */
addnRCGI(served_cells_to_delete_item->oldNRCGI, &f1ap_setup_req->cell[i]);
addnRCGI(served_cells_to_delete_item->oldNRCGI, &f1ap_setup_req->cell[i].info);
}
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
......
......@@ -172,7 +172,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI;
//Fixme: takes always the first cell
addnRCGI(ie2->value.choice.NRCGI, getCxt(instanceP)->setupReq.cell);
addnRCGI(ie2->value.choice.NRCGI, &getCxt(instanceP)->setupReq.cell[0].info);
/* mandatory */
/* c3. C_RNTI */ // 16
asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3);
......
......@@ -459,7 +459,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
&sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item;
/* sCell_ID */
AssertFatal(false, "handle correct CellID\n");
cellIDs_t cellID = {0};
f1ap_served_cell_info_t cellID = {0};
addnRCGI(sCell_FailedtoSetup_item->sCell_ID, &cellID);
/* cause */
asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp);
......@@ -1158,7 +1158,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
/* 8.1 SCell_ToBeSetup_Item */
F1AP_SCell_FailedtoSetupMod_Item_t *scell_failedtoSetupMod_item=&scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item;
/* - sCell_ID */
addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &getCxt(instance)->setupReq.cell[i]);
addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &getCxt(instance)->setupReq.cell[i].info);
asn1cCalloc(scell_failedtoSetupMod_item->cause, tmp);
tmp->present = F1AP_Cause_PR_radioNetwork;
tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id;
......
......@@ -1942,27 +1942,27 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
f1Setup->num_cells_available++;
f1Setup->gNB_DU_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr);
f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr));
f1Setup->cell[k].tac = malloc(sizeof(*f1Setup->cell[k].tac));
AssertFatal(f1Setup->cell[k].tac != NULL, "out of memory\n");
*f1Setup->cell[k].tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
f1Setup->cell[k].plmn.mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
f1Setup->cell[k].plmn.mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
f1Setup->cell[k].plmn.mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr;
AssertFatal((f1Setup->cell[k].plmn.mnc_digit_length == 2) ||
(f1Setup->cell[k].plmn.mnc_digit_length == 3),
f1Setup->cell[k].info.tac = malloc(sizeof(*f1Setup->cell[k].info.tac));
AssertFatal(f1Setup->cell[k].info.tac != NULL, "out of memory\n");
*f1Setup->cell[k].info.tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr;
f1Setup->cell[k].info.plmn.mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
f1Setup->cell[k].info.plmn.mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
f1Setup->cell[k].info.plmn.mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr;
AssertFatal((f1Setup->cell[k].info.plmn.mnc_digit_length == 2) ||
(f1Setup->cell[k].info.plmn.mnc_digit_length == 3),
"BAD MNC DIGIT LENGTH %d",
f1Setup->cell[k].plmn.mnc_digit_length);
f1Setup->cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr);
f1Setup->cell[k].info.plmn.mnc_digit_length);
f1Setup->cell[k].info.nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr);
LOG_I(GNB_APP,
"F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n",
k,
f1Setup->gNB_DU_id,
f1Setup->gNB_DU_name,
*f1Setup->cell[k].tac,
f1Setup->cell[k].plmn.mcc,
f1Setup->cell[k].plmn.mnc,
f1Setup->cell[k].plmn.mnc_digit_length,
f1Setup->cell[k].nr_cellid);
*f1Setup->cell[k].info.tac,
f1Setup->cell[k].info.plmn.mcc,
f1Setup->cell[k].info.plmn.mnc,
f1Setup->cell[k].info.plmn.mnc_digit_length,
f1Setup->cell[k].info.nr_cellid);
F1AP_DU_REGISTER_REQ(msg_p).net_config = read_DU_IP_config(&RC.nrmac[k]->eth_params_n);
......@@ -1978,12 +1978,12 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
pthread_mutex_unlock(&rrc->cell_info_mutex);
} while (cell_info_configured == 0);
rrc->configuration.mcc[0] = f1Setup->cell[k].plmn.mcc;
rrc->configuration.mnc[0] = f1Setup->cell[k].plmn.mnc;
rrc->configuration.tac = *f1Setup->cell[k].tac;
rrc->nr_cellid = f1Setup->cell[k].nr_cellid;
f1Setup->cell[k].nr_pci = *rrc->configuration.scc->physCellId;
f1Setup->cell[k].num_ssi = 0;
rrc->configuration.mcc[0] = f1Setup->cell[k].info.plmn.mcc;
rrc->configuration.mnc[0] = f1Setup->cell[k].info.plmn.mnc;
rrc->configuration.tac = *f1Setup->cell[k].info.tac;
rrc->nr_cellid = f1Setup->cell[k].info.nr_cellid;
f1Setup->cell[k].info.nr_pci = *rrc->configuration.scc->physCellId;
f1Setup->cell[k].info.num_ssi = 0;
if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) {
LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k);
......
......@@ -1867,9 +1867,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
for (int j=0; j<RC.nb_nr_inst; j++) {
gNB_RRC_INST *rrc = RC.nrrrc[j];
if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].plmn.mcc &&
rrc->configuration.mnc[0] == f1_setup_req->cell[i].plmn.mnc &&
rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) {
if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].info.plmn.mcc &&
rrc->configuration.mnc[0] == f1_setup_req->cell[i].info.plmn.mnc &&
rrc->nr_cellid == f1_setup_req->cell[i].info.nr_cellid) {
//fixme: multi instance is not consistent here
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
// check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case)
......@@ -1902,14 +1902,14 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)rrc->carrier.sib1);
}
rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci;
rrc->carrier.physCellId = f1_setup_req->cell[i].info.nr_pci;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name;
F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.mcc = rrc->configuration.mcc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.mnc = rrc->configuration.mnc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].nr_pci;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].info.nr_pci;
int num_SI= 0;
if (rrc->carrier.SIB23) {
......@@ -1925,9 +1925,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
break;
} else {// setup_req mcc/mnc match rrc internal list element
LOG_W(NR_RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d rrc->nr_cellid/f1_setup_req->nr_cellid %ld/%ld \n",
j, rrc->configuration.mcc[0], f1_setup_req->cell[i].plmn.mcc,
rrc->configuration.mnc[0], f1_setup_req->cell[i].plmn.mnc,
rrc->nr_cellid, f1_setup_req->cell[i].nr_cellid);
j, rrc->configuration.mcc[0], f1_setup_req->cell[i].info.plmn.mcc,
rrc->configuration.mnc[0], f1_setup_req->cell[i].info.plmn.mnc,
rrc->nr_cellid, f1_setup_req->cell[i].info.nr_cellid);
}
}// for (int j=0;j<RC.nb_inst;j++)
......
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