Refactor F1 Setup Req: sys_info is specific to each cell
This commit is contained in:
@@ -139,6 +139,13 @@ typedef struct f1ap_served_cell_info_t {
|
||||
char *measurement_timing_information;
|
||||
} f1ap_served_cell_info_t;
|
||||
|
||||
typedef struct f1ap_gnb_du_system_info_t {
|
||||
uint8_t *mib;
|
||||
int mib_length;
|
||||
uint8_t *sib1;
|
||||
int sib1_length;
|
||||
} f1ap_gnb_du_system_info_t;
|
||||
|
||||
typedef struct f1ap_setup_req_s {
|
||||
|
||||
// F1_Setup_Req payload
|
||||
@@ -149,16 +156,8 @@ typedef struct f1ap_setup_req_s {
|
||||
uint16_t num_cells_available; //0< num_cells_available <= 512;
|
||||
struct {
|
||||
f1ap_served_cell_info_t info;
|
||||
f1ap_gnb_du_system_info_t *sys_info;
|
||||
} cell[F1AP_MAX_NB_CELLS];
|
||||
|
||||
|
||||
// System Information
|
||||
uint8_t *mib[F1AP_MAX_NB_CELLS];
|
||||
int mib_length[F1AP_MAX_NB_CELLS];
|
||||
uint8_t *sib1[F1AP_MAX_NB_CELLS];
|
||||
int sib1_length[F1AP_MAX_NB_CELLS];
|
||||
|
||||
|
||||
} f1ap_setup_req_t;
|
||||
|
||||
typedef struct f1ap_du_register_req_t {
|
||||
|
||||
@@ -189,20 +189,17 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
|
||||
|
||||
struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information;
|
||||
// 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 */
|
||||
req->mib[i] = calloc(DUsi->mIB_message.size + 1, sizeof(char));
|
||||
memcpy(req->mib[i], DUsi->mIB_message.buf, DUsi->mIB_message.size);
|
||||
/* Convert the mme name to a printable string */
|
||||
req->mib[i][DUsi->mIB_message.size] = '\0';
|
||||
req->mib_length[i] = DUsi->mIB_message.size;
|
||||
LOG_D(F1AP, "req->mib[%d] len = %d \n", i, req->mib_length[i]);
|
||||
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 */
|
||||
req->sib1[i] = calloc(DUsi->sIB1_message.size + 1, sizeof(char));
|
||||
memcpy(req->sib1[i], DUsi->sIB1_message.buf, DUsi->sIB1_message.size);
|
||||
/* Convert the mme name to a printable string */
|
||||
req->sib1[i][DUsi->sIB1_message.size] = '\0';
|
||||
req->sib1_length[i] = DUsi->sIB1_message.size;
|
||||
LOG_D(F1AP, "req->sib1[%d] len = %d \n", i, req->sib1_length[i]);
|
||||
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;
|
||||
}
|
||||
|
||||
// char *measurement_timing_information[F1AP_MAX_NB_CELLS];
|
||||
|
||||
@@ -281,12 +281,10 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req)
|
||||
strlen(measurementTimingConfiguration));
|
||||
asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, gNB_DU_System_Information);
|
||||
/* 4.1.2 gNB-DU System Information */
|
||||
OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018
|
||||
(const char *)setup_req->mib[i], //f1ap_du_data->mib,
|
||||
setup_req->mib_length[i]);
|
||||
OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018
|
||||
(const char *)setup_req->sib1[i],
|
||||
setup_req->sib1_length[i]);
|
||||
AssertFatal(setup_req->cell[i].sys_info != NULL, "assume that sys_info is present, which is not the case\n");
|
||||
const f1ap_gnb_du_system_info_t *sys_info = setup_req->cell[i].sys_info;
|
||||
OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, (const char *)sys_info->mib, sys_info->mib_length);
|
||||
OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, (const char *)sys_info->sib1, sys_info->sib1_length);
|
||||
}
|
||||
|
||||
/* mandatory */
|
||||
|
||||
@@ -2013,10 +2013,13 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
|
||||
|
||||
DevAssert(rrc->carrier.mib != NULL);
|
||||
int buf_len = 3; // this is what we assume in monolithic
|
||||
f1Setup->mib[k] = calloc(buf_len, sizeof(*f1Setup->mib[k]));
|
||||
DevAssert(f1Setup->mib[k] != NULL);
|
||||
f1Setup->mib_length[k] = encode_MIB_NR(rrc->carrier.mib, 0, f1Setup->mib[k], buf_len);
|
||||
DevAssert(f1Setup->mib_length[k] == buf_len);
|
||||
f1Setup->cell[k].sys_info = calloc(1, sizeof(*f1Setup->cell[k].sys_info));
|
||||
AssertFatal(f1Setup->cell[k].sys_info != NULL, "out of memory\n");
|
||||
f1ap_gnb_du_system_info_t *sys_info = f1Setup->cell[k].sys_info;
|
||||
sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib));
|
||||
DevAssert(sys_info->mib != NULL);
|
||||
sys_info->mib_length = encode_MIB_NR(rrc->carrier.mib, 0, sys_info->mib, buf_len);
|
||||
DevAssert(sys_info->mib_length == buf_len);
|
||||
|
||||
NR_BCCH_DL_SCH_Message_t *bcch_message = NULL;
|
||||
asn_codec_ctx_t st={100*1000};
|
||||
@@ -2034,12 +2037,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
|
||||
}
|
||||
|
||||
NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||
f1Setup->sib1[k] = calloc(1,rrc->carrier.sizeof_SIB1);
|
||||
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1,
|
||||
NULL,
|
||||
(void *)bcch_SIB1,
|
||||
f1Setup->sib1[k],
|
||||
NR_MAX_SIB_LENGTH/8);
|
||||
sys_info->sib1 = calloc(1,rrc->carrier.sizeof_SIB1);
|
||||
asn_enc_rval_t enc_rval =
|
||||
uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->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);
|
||||
|
||||
@@ -2047,8 +2047,8 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
|
||||
LOG_I(NR_RRC, "SIB1 container to be integrated in F1 Setup request:\n");
|
||||
xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1 );
|
||||
//}
|
||||
f1Setup->sib1_length[k] = (enc_rval.encoded+7)/8;
|
||||
break;
|
||||
sys_info->sib1_length = (enc_rval.encoded + 7) / 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1873,13 +1873,15 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
|
||||
//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)
|
||||
LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]);
|
||||
const f1ap_gnb_du_system_info_t *sys_info = f1_setup_req->cell[i].sys_info;
|
||||
AssertFatal(sys_info != NULL, "no system information found, should send F1 Setup Failure\n");
|
||||
LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, sys_info->sib1_length);
|
||||
AssertFatal(rrc->carrier.mib == NULL, "CU MIB is already initialized: double F1 setup request?\n");
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
|
||||
&asn_DEF_NR_BCCH_BCH_Message,
|
||||
(void **)&rrc->carrier.mib,
|
||||
f1_setup_req->mib[i],
|
||||
f1_setup_req->mib_length[i]);
|
||||
&asn_DEF_NR_BCCH_BCH_Message,
|
||||
(void **)&rrc->carrier.mib,
|
||||
sys_info->mib,
|
||||
sys_info->mib_length);
|
||||
AssertFatal(dec_rval.code == RC_OK,
|
||||
"[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n",
|
||||
j,
|
||||
@@ -1888,8 +1890,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
|
||||
dec_rval = uper_decode_complete(NULL,
|
||||
&asn_DEF_NR_SIB1, //&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||
(void **)&rrc->carrier.siblock1_DU,
|
||||
f1_setup_req->sib1[i],
|
||||
f1_setup_req->sib1_length[i]);
|
||||
sys_info->sib1,
|
||||
sys_info->sib1_length);
|
||||
AssertFatal(dec_rval.code == RC_OK,
|
||||
"[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n",
|
||||
j,
|
||||
|
||||
Reference in New Issue
Block a user