Use F1AP lib for F1 Setup Request in stack
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "f1ap_cu_interface_management.h"
|
||||
#include "f1ap_default_values.h"
|
||||
#include "lib/f1ap_interface_management.h"
|
||||
#include "lib/f1ap_lib_common.h"
|
||||
|
||||
int CU_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
@@ -47,15 +48,6 @@ int CU_send_RESET_ACKNOWLEDGE(sctp_assoc_t assoc_id, const f1ap_reset_ack_t *ack
|
||||
AssertFatal(1 == 0, "Not implemented yet\n");
|
||||
}
|
||||
|
||||
static uint8_t *cp_octet_string(const OCTET_STRING_t *os, int *len)
|
||||
{
|
||||
uint8_t *buf = calloc(os->size, sizeof(*buf));
|
||||
AssertFatal(buf != NULL, "out of memory\n");
|
||||
memcpy(buf, os->buf, os->size);
|
||||
*len = os->size;
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int read_slice_info(const F1AP_ServedPLMNs_Item_t *plmn, nssai_t *nssai, int max_nssai)
|
||||
{
|
||||
if (plmn->iE_Extensions == NULL)
|
||||
@@ -82,168 +74,31 @@ static int read_slice_info(const F1AP_ServedPLMNs_Item_t *plmn, nssai_t *nssai,
|
||||
return ssl->list.count;
|
||||
}
|
||||
|
||||
/*
|
||||
F1 Setup
|
||||
*/
|
||||
/**
|
||||
* @brief F1AP Setup Request decoding (9.2.1.4 of 3GPP TS 38.473) and transfer to RRC
|
||||
*/
|
||||
int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
LOG_D(F1AP, "CU_handle_F1_SETUP_REQUEST\n");
|
||||
F1AP_F1SetupRequest_t *container;
|
||||
F1AP_F1SetupRequestIEs_t *ie;
|
||||
int i = 0;
|
||||
DevAssert(pdu != NULL);
|
||||
container = &pdu->choice.initiatingMessage->value.choice.F1SetupRequest;
|
||||
|
||||
/* F1 Setup Request == Non UE-related procedure -> stream 0 */
|
||||
if (stream != 0) {
|
||||
LOG_W(F1AP, "[SCTP %d] Received f1 setup request on stream != 0 (%d)\n",
|
||||
assoc_id, stream);
|
||||
}
|
||||
|
||||
f1ap_setup_req_t msg = {0};
|
||||
/* Decode */
|
||||
if (!decode_f1ap_setup_request(pdu, &msg)) {
|
||||
LOG_E(F1AP, "cannot decode F1AP Setup Request\n");
|
||||
free_f1ap_setup_request(&msg);
|
||||
return -1;
|
||||
}
|
||||
/* Send to RRC (ITTI) */
|
||||
MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ);
|
||||
message_p->ittiMsgHeader.originInstance = assoc_id;
|
||||
f1ap_setup_req_t *req = &F1AP_SETUP_REQ(message_p);
|
||||
|
||||
/* Transaction ID*/
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_TransactionID, true);
|
||||
req->transaction_id = ie->value.choice.TransactionID;
|
||||
LOG_D(F1AP, "req->transaction_id %lu \n", req->transaction_id);
|
||||
|
||||
/* gNB_DU_id */
|
||||
// this function exits if the ie is mandatory
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_ID, true);
|
||||
asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &req->gNB_DU_id);
|
||||
LOG_D(F1AP, "req->gNB_DU_id %lu \n", req->gNB_DU_id);
|
||||
/* gNB_DU_name */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_Name, false);
|
||||
req->gNB_DU_name = NULL;
|
||||
if (ie != NULL) {
|
||||
req->gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char));
|
||||
memcpy(req->gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, ie->value.choice.GNB_DU_Name.size);
|
||||
LOG_D(F1AP, "req->gNB_DU_name %s \n", req->gNB_DU_name);
|
||||
}
|
||||
/* GNB_DU_Served_Cells_List */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true);
|
||||
req->num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count;
|
||||
LOG_D(F1AP, "req->num_cells_available %d \n", req->num_cells_available);
|
||||
|
||||
for (i=0; i<req->num_cells_available; i++) {
|
||||
F1AP_GNB_DU_Served_Cells_Item_t *served_cells_item = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)
|
||||
ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->
|
||||
value.choice.GNB_DU_Served_Cells_Item);
|
||||
F1AP_Served_Cell_Information_t *servedCellInformation= &served_cells_item->served_Cell_Information;
|
||||
/* tac */
|
||||
if (servedCellInformation->fiveGS_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_INT24(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].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].info.nr_cellid);
|
||||
LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id,
|
||||
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].info.nr_pci = servedCellInformation->nRPCI;
|
||||
LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].info.nr_pci);
|
||||
|
||||
AssertFatal(servedCellInformation->servedPLMNs.list.count == 1, "only one PLMN handled\n");
|
||||
req->cell[i].info.num_ssi = read_slice_info(servedCellInformation->servedPLMNs.list.array[0], req->cell[i].info.nssai, 16);
|
||||
|
||||
// FDD Cells
|
||||
if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_fDD) {
|
||||
req->cell[i].info.mode = F1AP_MODE_FDD;
|
||||
f1ap_fdd_info_t *FDDs = &req->cell[i].info.fdd;
|
||||
F1AP_FDD_Info_t * fDD_Info=servedCellInformation->nR_Mode_Info.choice.fDD;
|
||||
FDDs->ul_freqinfo.arfcn = fDD_Info->uL_NRFreqInfo.nRARFCN;
|
||||
AssertFatal(fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count == 1, "cannot handle more than one frequency band\n");
|
||||
for (int f=0; f < fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count; f++) {
|
||||
F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->uL_NRFreqInfo.freqBandListNr.list.array[f];
|
||||
FDDs->ul_freqinfo.band = FreqItem->freqBandIndicatorNr;
|
||||
AssertFatal(FreqItem->supportedSULBandList.list.count == 0, "cannot handle SUL bands!\n");
|
||||
}
|
||||
FDDs->dl_freqinfo.arfcn = fDD_Info->dL_NRFreqInfo.nRARFCN;
|
||||
int dlBands=fDD_Info->dL_NRFreqInfo.freqBandListNr.list.count;
|
||||
AssertFatal(dlBands == 1, "cannot handled more than one frequency band\n");
|
||||
for (int dlB=0; dlB < dlBands; dlB++) {
|
||||
F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->dL_NRFreqInfo.freqBandListNr.list.array[dlB];
|
||||
FDDs->dl_freqinfo.band = FreqItem->freqBandIndicatorNr;
|
||||
int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count;
|
||||
AssertFatal(num_available_supported_SULBands == 0, "cannot handle SUL bands!\n");
|
||||
}
|
||||
FDDs->ul_tbw.scs = fDD_Info->uL_Transmission_Bandwidth.nRSCS;
|
||||
FDDs->ul_tbw.nrb = nrb_lut[fDD_Info->uL_Transmission_Bandwidth.nRNRB];
|
||||
FDDs->dl_tbw.scs = fDD_Info->dL_Transmission_Bandwidth.nRSCS;
|
||||
FDDs->dl_tbw.nrb = nrb_lut[fDD_Info->dL_Transmission_Bandwidth.nRNRB];
|
||||
} else if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_tDD) {
|
||||
req->cell[i].info.mode = F1AP_MODE_TDD;
|
||||
f1ap_tdd_info_t *TDDs = &req->cell[i].info.tdd;
|
||||
F1AP_TDD_Info_t *tDD_Info = servedCellInformation->nR_Mode_Info.choice.tDD;
|
||||
TDDs->freqinfo.arfcn = tDD_Info->nRFreqInfo.nRARFCN;
|
||||
AssertFatal(tDD_Info->nRFreqInfo.freqBandListNr.list.count == 1, "cannot handle more than one frequency band\n");
|
||||
for (int f=0; f < tDD_Info->nRFreqInfo.freqBandListNr.list.count; f++) {
|
||||
struct F1AP_FreqBandNrItem * FreqItem=tDD_Info->nRFreqInfo.freqBandListNr.list.array[f];
|
||||
TDDs->freqinfo.band = FreqItem->freqBandIndicatorNr;
|
||||
int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count;
|
||||
AssertFatal(num_available_supported_SULBands == 0, "cannot hanlde SUL bands!\n");
|
||||
}
|
||||
TDDs->tbw.scs = tDD_Info->transmission_Bandwidth.nRSCS;
|
||||
TDDs->tbw.nrb = nrb_lut[tDD_Info->transmission_Bandwidth.nRNRB];
|
||||
} else {
|
||||
AssertFatal(false, "unknown NR Mode info %d\n", servedCellInformation->nR_Mode_Info.present);
|
||||
}
|
||||
|
||||
/* MeasurementConfig */
|
||||
if (servedCellInformation->measurementTimingConfiguration.size > 0)
|
||||
req->cell[i].info.measurement_timing_config =
|
||||
cp_octet_string(&servedCellInformation->measurementTimingConfiguration, &req->cell[i].info.measurement_timing_config_len);
|
||||
|
||||
struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information;
|
||||
if (DUsi != NULL) {
|
||||
// System Information
|
||||
req->cell[i].sys_info = calloc(1, sizeof(*req->cell[i].sys_info));
|
||||
AssertFatal(req->cell[i].sys_info != NULL, "out of memory\n");
|
||||
f1ap_gnb_du_system_info_t *sys_info = req->cell[i].sys_info;
|
||||
/* mib */
|
||||
sys_info->mib = calloc(DUsi->mIB_message.size, sizeof(char));
|
||||
memcpy(sys_info->mib, DUsi->mIB_message.buf, DUsi->mIB_message.size);
|
||||
sys_info->mib_length = DUsi->mIB_message.size;
|
||||
/* sib1 */
|
||||
sys_info->sib1 = calloc(DUsi->sIB1_message.size, sizeof(char));
|
||||
memcpy(sys_info->sib1, DUsi->sIB1_message.buf, DUsi->sIB1_message.size);
|
||||
sys_info->sib1_length = DUsi->sIB1_message.size;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle RRC Version */
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version, true);
|
||||
// Latest RRC Version: "This IE is not used in this release."
|
||||
// BIT_STRING_to_uint8(&ie->value.choice.RRC_Version.latest_RRC_Version);
|
||||
if (ie->value.choice.RRC_Version.iE_Extensions) {
|
||||
F1AP_ProtocolExtensionContainer_10696P228_t *ext =
|
||||
(F1AP_ProtocolExtensionContainer_10696P228_t *)ie->value.choice.RRC_Version.iE_Extensions;
|
||||
if (ext->list.count > 0) {
|
||||
F1AP_RRC_Version_ExtIEs_t *rrcext = ext->list.array[0];
|
||||
OCTET_STRING_t *os = &rrcext->extensionValue.choice.OCTET_STRING_SIZE_3_;
|
||||
DevAssert(os->size == 3);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
req->rrc_ver[i] = os->buf[i];
|
||||
}
|
||||
}
|
||||
*req = msg; /* "move" message into ITTI, RRC thread will free it */
|
||||
itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "f1ap_encoder.h"
|
||||
#include "f1ap_itti_messaging.h"
|
||||
#include "f1ap_du_interface_management.h"
|
||||
#include "lib/f1ap_interface_management.h"
|
||||
#include "lib/f1ap_lib_common.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h"
|
||||
#include "assertions.h"
|
||||
|
||||
@@ -297,110 +299,25 @@ static F1AP_GNB_DU_System_Information_t *encode_system_info(const f1ap_gnb_du_sy
|
||||
return enc_sys_info;
|
||||
}
|
||||
|
||||
// SETUP REQUEST
|
||||
/**
|
||||
* @brief F1AP Setup Request
|
||||
*/
|
||||
int DU_send_F1_SETUP_REQUEST(sctp_assoc_t assoc_id, const f1ap_setup_req_t *setup_req)
|
||||
{
|
||||
LOG_D(F1AP, "DU_send_F1_SETUP_REQUEST\n");
|
||||
|
||||
F1AP_F1AP_PDU_t pdu= {0};
|
||||
F1AP_F1AP_PDU_t *pdu = encode_f1ap_setup_request(setup_req);
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
/* Create */
|
||||
/* 0. pdu Type */
|
||||
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
|
||||
asn1cCalloc(pdu.choice.initiatingMessage, initMsg);
|
||||
initMsg->procedureCode = F1AP_ProcedureCode_id_F1Setup;
|
||||
initMsg->criticality = F1AP_Criticality_reject;
|
||||
initMsg->value.present = F1AP_InitiatingMessage__value_PR_F1SetupRequest;
|
||||
F1AP_F1SetupRequest_t *f1Setup = &initMsg->value.choice.F1SetupRequest;
|
||||
/* mandatory */
|
||||
/* c1. Transaction ID (integer value) */
|
||||
asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC1);
|
||||
ieC1->id = F1AP_ProtocolIE_ID_id_TransactionID;
|
||||
ieC1->criticality = F1AP_Criticality_reject;
|
||||
ieC1->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID;
|
||||
ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0);
|
||||
/* mandatory */
|
||||
/* c2. GNB_DU_ID (integer value) */
|
||||
asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC2);
|
||||
ieC2->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID;
|
||||
ieC2->criticality = F1AP_Criticality_reject;
|
||||
ieC2->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID;
|
||||
asn_int642INTEGER(&ieC2->value.choice.GNB_DU_ID, setup_req->gNB_DU_id);
|
||||
|
||||
/* optional */
|
||||
/* c3. GNB_DU_Name */
|
||||
if (setup_req->gNB_DU_name != NULL) {
|
||||
asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC3);
|
||||
ieC3->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name;
|
||||
ieC3->criticality = F1AP_Criticality_ignore;
|
||||
ieC3->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name;
|
||||
char *gNB_DU_name=setup_req->gNB_DU_name;
|
||||
OCTET_STRING_fromBuf(&ieC3->value.choice.GNB_DU_Name, gNB_DU_name, strlen(gNB_DU_name));
|
||||
}
|
||||
|
||||
/* mandatory */
|
||||
/* c4. served cells list */
|
||||
asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieCells);
|
||||
ieCells->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List;
|
||||
ieCells->criticality = F1AP_Criticality_reject;
|
||||
ieCells->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List;
|
||||
int num_cells_available = setup_req->num_cells_available;
|
||||
LOG_D(F1AP, "num_cells_available = %d \n", num_cells_available);
|
||||
|
||||
for (int i=0; i<num_cells_available; i++) {
|
||||
/* mandatory */
|
||||
/* 4.1 served cells item */
|
||||
const f1ap_served_cell_info_t *cell = &setup_req->cell[i].info;
|
||||
const f1ap_gnb_du_system_info_t *sys_info = setup_req->cell[i].sys_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;
|
||||
duServedCell->criticality = F1AP_Criticality_reject;
|
||||
duServedCell->value.present = F1AP_GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item;
|
||||
F1AP_GNB_DU_Served_Cells_Item_t *scell_item = &duServedCell->value.choice.GNB_DU_Served_Cells_Item;
|
||||
scell_item->served_Cell_Information = encode_served_cell_info(cell);
|
||||
scell_item->gNB_DU_System_Information = encode_system_info(sys_info);
|
||||
}
|
||||
|
||||
/* mandatory */
|
||||
/* c5. RRC VERSION */
|
||||
asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ie2);
|
||||
ie2->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version;
|
||||
ie2->criticality = F1AP_Criticality_reject;
|
||||
ie2->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version;
|
||||
// RRC Version: "This IE is not used in this release."
|
||||
// we put one bit for each byte in rrc_ver that is != 0
|
||||
uint8_t bits = 0;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
bits |= (setup_req->rrc_ver[i] != 0) << i;
|
||||
BIT_STRING_t *bs = &ie2->value.choice.RRC_Version.latest_RRC_Version;
|
||||
bs->buf = calloc(1, sizeof(char));
|
||||
AssertFatal(bs->buf != NULL, "out of memory\n");
|
||||
bs->buf[0] = bits;
|
||||
bs->size = 1;
|
||||
bs->bits_unused = 5;
|
||||
|
||||
F1AP_ProtocolExtensionContainer_10696P228_t *p = calloc(1, sizeof(F1AP_ProtocolExtensionContainer_10696P228_t));
|
||||
asn1cSequenceAdd(p->list, F1AP_RRC_Version_ExtIEs_t, rrcv_ext);
|
||||
rrcv_ext->id = F1AP_ProtocolIE_ID_id_latest_RRC_Version_Enhanced;
|
||||
rrcv_ext->criticality = F1AP_Criticality_ignore;
|
||||
rrcv_ext->extensionValue.present = F1AP_RRC_Version_ExtIEs__extensionValue_PR_OCTET_STRING_SIZE_3_;
|
||||
OCTET_STRING_t *os = &rrcv_ext->extensionValue.choice.OCTET_STRING_SIZE_3_;
|
||||
os->size = 3;
|
||||
os->buf = malloc(3 * sizeof(*os->buf));
|
||||
AssertFatal(os->buf != NULL, "out of memory\n");
|
||||
for (int i = 0; i < 3; ++i)
|
||||
os->buf[i] = setup_req->rrc_ver[i];
|
||||
ie2->value.choice.RRC_Version.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)p;
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
if (f1ap_encode_pdu(pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 setup request\n");
|
||||
/* free PDU */
|
||||
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
|
||||
/* free PDU */
|
||||
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
/* Send to ITTI */
|
||||
f1ap_itti_send_sctp_data_req(assoc_id, buffer, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,8 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
|
||||
f1ap_du_data->du.assoc_id = sctp_new_association_resp->assoc_id;
|
||||
f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams;
|
||||
f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams;
|
||||
/* next transaction ID */
|
||||
f1ap_du_data->setupReq.transaction_id = F1AP_get_next_transaction_identifier(0, 0);
|
||||
/* setup parameters for F1U and start the server */
|
||||
DU_send_F1_SETUP_REQUEST(f1ap_du_data->du.assoc_id, &f1ap_du_data->setupReq);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "mac_rrc_ul.h"
|
||||
#include "f1ap_lib_extern.h"
|
||||
#include "lib/f1ap_interface_management.h"
|
||||
|
||||
static void f1_reset_du_initiated_direct(const f1ap_reset_t *reset)
|
||||
{
|
||||
@@ -41,47 +42,8 @@ static void f1_setup_request_direct(const f1ap_setup_req_t *req)
|
||||
{
|
||||
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_SETUP_REQ);
|
||||
msg->ittiMsgHeader.originInstance = -1; // means monolithic
|
||||
f1ap_setup_req_t *f1ap_msg = &F1AP_SETUP_REQ(msg);
|
||||
f1ap_msg->gNB_DU_id = req->gNB_DU_id;
|
||||
f1ap_msg->gNB_DU_name = strdup(req->gNB_DU_name);
|
||||
f1ap_msg->num_cells_available = req->num_cells_available;
|
||||
for (int n = 0; n < req->num_cells_available; ++n) {
|
||||
f1ap_msg->cell[n].info = req->cell[n].info; // copy most fields
|
||||
if (req->cell[n].info.tac) {
|
||||
f1ap_msg->cell[n].info.tac = malloc(sizeof(*f1ap_msg->cell[n].info.tac));
|
||||
AssertFatal(f1ap_msg->cell[n].info.tac != NULL, "out of memory\n");
|
||||
*f1ap_msg->cell[n].info.tac = *req->cell[n].info.tac;
|
||||
}
|
||||
if (req->cell[n].info.measurement_timing_config_len > 0) {
|
||||
f1ap_msg->cell[n].info.measurement_timing_config = calloc(req->cell[n].info.measurement_timing_config_len, sizeof(uint8_t));
|
||||
AssertFatal(f1ap_msg->cell[n].info.measurement_timing_config != NULL, "out of memory\n");
|
||||
memcpy(f1ap_msg->cell[n].info.measurement_timing_config,
|
||||
req->cell[n].info.measurement_timing_config,
|
||||
req->cell[n].info.measurement_timing_config_len);
|
||||
f1ap_msg->cell[n].info.measurement_timing_config_len = req->cell[n].info.measurement_timing_config_len;
|
||||
}
|
||||
|
||||
if (req->cell[n].sys_info) {
|
||||
f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info;
|
||||
f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info));
|
||||
AssertFatal(copy_sys_info, "out of memory\n");
|
||||
f1ap_msg->cell[n].sys_info = copy_sys_info;
|
||||
|
||||
copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t));
|
||||
AssertFatal(copy_sys_info->mib, "out of memory\n");
|
||||
memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length);
|
||||
copy_sys_info->mib_length = orig_sys_info->mib_length;
|
||||
|
||||
if (orig_sys_info->sib1_length > 0) {
|
||||
copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t));
|
||||
AssertFatal(copy_sys_info->sib1, "out of memory\n");
|
||||
memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length);
|
||||
copy_sys_info->sib1_length = orig_sys_info->sib1_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
memcpy(f1ap_msg->rrc_ver, req->rrc_ver, sizeof(req->rrc_ver));
|
||||
|
||||
f1ap_setup_req_t cp = cp_f1ap_setup_request(req);
|
||||
F1AP_SETUP_REQ(msg) = cp;
|
||||
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "mac_rrc_ul.h"
|
||||
|
||||
#include "f1ap_lib_extern.h"
|
||||
#include "lib/f1ap_interface_management.h"
|
||||
|
||||
static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params, const char *f1u_ip_addr)
|
||||
{
|
||||
@@ -68,50 +69,9 @@ static void f1_reset_acknowledge_cu_initiated_f1ap(const f1ap_reset_ack_t *ack)
|
||||
static void f1_setup_request_f1ap(const f1ap_setup_req_t *req)
|
||||
{
|
||||
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_DU_REGISTER_REQ);
|
||||
|
||||
f1ap_setup_req_t *f1ap_setup = &F1AP_DU_REGISTER_REQ(msg).setup_req;
|
||||
f1ap_setup->gNB_DU_id = req->gNB_DU_id;
|
||||
f1ap_setup->gNB_DU_name = strdup(req->gNB_DU_name);
|
||||
f1ap_setup->num_cells_available = req->num_cells_available;
|
||||
for (int n = 0; n < req->num_cells_available; ++n) {
|
||||
f1ap_setup->cell[n].info = req->cell[n].info; // copy most fields
|
||||
if (req->cell[n].info.tac) {
|
||||
f1ap_setup->cell[n].info.tac = malloc(sizeof(*f1ap_setup->cell[n].info.tac));
|
||||
AssertFatal(f1ap_setup->cell[n].info.tac != NULL, "out of memory\n");
|
||||
*f1ap_setup->cell[n].info.tac = *req->cell[n].info.tac;
|
||||
}
|
||||
if (req->cell[n].info.measurement_timing_config_len > 0) {
|
||||
f1ap_setup->cell[n].info.measurement_timing_config = calloc(req->cell[n].info.measurement_timing_config_len, sizeof(uint8_t));
|
||||
AssertFatal(f1ap_setup->cell[n].info.measurement_timing_config != NULL, "out of memory\n");
|
||||
memcpy(f1ap_setup->cell[n].info.measurement_timing_config,
|
||||
req->cell[n].info.measurement_timing_config,
|
||||
req->cell[n].info.measurement_timing_config_len);
|
||||
f1ap_setup->cell[n].info.measurement_timing_config_len = req->cell[n].info.measurement_timing_config_len;
|
||||
}
|
||||
|
||||
if (req->cell[n].sys_info) {
|
||||
f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info;
|
||||
f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info));
|
||||
AssertFatal(copy_sys_info, "out of memory\n");
|
||||
f1ap_setup->cell[n].sys_info = copy_sys_info;
|
||||
|
||||
copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t));
|
||||
AssertFatal(copy_sys_info->mib, "out of memory\n");
|
||||
memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length);
|
||||
copy_sys_info->mib_length = orig_sys_info->mib_length;
|
||||
|
||||
if (orig_sys_info->sib1_length > 0) {
|
||||
copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t));
|
||||
AssertFatal(copy_sys_info->sib1, "out of memory\n");
|
||||
memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length);
|
||||
copy_sys_info->sib1_length = orig_sys_info->sib1_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
memcpy(f1ap_setup->rrc_ver, req->rrc_ver, sizeof(req->rrc_ver));
|
||||
|
||||
f1ap_setup_req_t f1ap_setup = cp_f1ap_setup_request(req);
|
||||
F1AP_DU_REGISTER_REQ(msg).setup_req = f1ap_setup;
|
||||
F1AP_DU_REGISTER_REQ(msg).net_config = read_DU_IP_config(&RC.nrmac[0]->eth_params_n, RC.nrmac[0]->f1u_addr);
|
||||
|
||||
itti_send_msg_to_task(TASK_DU_F1, 0, msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "common/utils/ds/seq_arr.h"
|
||||
#include "common/utils/alg/foreach.h"
|
||||
#include "lib/f1ap_interface_management.h"
|
||||
|
||||
int get_dl_band(const struct f1ap_served_cell_info_t *cell_info)
|
||||
{
|
||||
@@ -261,7 +262,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
||||
DevAssert(rrc);
|
||||
|
||||
LOG_I(NR_RRC, "Received F1 Setup Request from gNB_DU %lu (%s) on assoc_id %d\n", req->gNB_DU_id, req->gNB_DU_name, assoc_id);
|
||||
|
||||
// check:
|
||||
// - it is one cell
|
||||
// - PLMN and Cell ID matches
|
||||
@@ -358,7 +358,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
||||
* allocate memory and copy it in */
|
||||
du->setup_req = calloc(1,sizeof(*du->setup_req));
|
||||
AssertFatal(du->setup_req, "out of memory\n");
|
||||
*du->setup_req = *req;
|
||||
// Copy F1AP message
|
||||
*du->setup_req = cp_f1ap_setup_request(req);
|
||||
// MIB can be null and configured later via DU Configuration Update
|
||||
du->mib = mib;
|
||||
du->sib1 = sib1;
|
||||
@@ -379,6 +380,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
||||
f1ap_setup_resp_t resp = {.transaction_id = req->transaction_id,
|
||||
.num_cells_to_activate = 1,
|
||||
.cells_to_activate[0] = cell};
|
||||
// free F1AP message after use
|
||||
free_f1ap_setup_request(req);
|
||||
int num = read_version(TO_STRING(NR_RRC_VERSION), &resp.rrc_ver[0], &resp.rrc_ver[1], &resp.rrc_ver[2]);
|
||||
AssertFatal(num == 3, "could not read RRC version string %s\n", TO_STRING(NR_RRC_VERSION));
|
||||
if (rrc->node_name != NULL)
|
||||
|
||||
Reference in New Issue
Block a user