Commit ca374e86 authored by Robert Schmidt's avatar Robert Schmidt

Refactor F1 Setup Req: sys_info is specific to each cell

parent d21aa79f
...@@ -139,6 +139,13 @@ typedef struct f1ap_served_cell_info_t { ...@@ -139,6 +139,13 @@ typedef struct f1ap_served_cell_info_t {
char *measurement_timing_information; char *measurement_timing_information;
} f1ap_served_cell_info_t; } 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 { typedef struct f1ap_setup_req_s {
// F1_Setup_Req payload // F1_Setup_Req payload
...@@ -149,16 +156,8 @@ typedef struct f1ap_setup_req_s { ...@@ -149,16 +156,8 @@ typedef struct f1ap_setup_req_s {
uint16_t num_cells_available; //0< num_cells_available <= 512; uint16_t num_cells_available; //0< num_cells_available <= 512;
struct { struct {
f1ap_served_cell_info_t info; f1ap_served_cell_info_t info;
f1ap_gnb_du_system_info_t *sys_info;
} cell[F1AP_MAX_NB_CELLS]; } 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; } f1ap_setup_req_t;
typedef struct f1ap_du_register_req_t { typedef struct f1ap_du_register_req_t {
......
...@@ -189,20 +189,17 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, ...@@ -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; struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information;
// 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 */ /* mib */
req->mib[i] = calloc(DUsi->mIB_message.size + 1, sizeof(char)); sys_info->mib = calloc(DUsi->mIB_message.size, sizeof(char));
memcpy(req->mib[i], DUsi->mIB_message.buf, DUsi->mIB_message.size); memcpy(sys_info->mib, DUsi->mIB_message.buf, DUsi->mIB_message.size);
/* Convert the mme name to a printable string */ sys_info->mib_length = DUsi->mIB_message.size;
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]);
/* sib1 */ /* sib1 */
req->sib1[i] = calloc(DUsi->sIB1_message.size + 1, sizeof(char)); sys_info->sib1 = calloc(DUsi->sIB1_message.size, sizeof(char));
memcpy(req->sib1[i], DUsi->sIB1_message.buf, DUsi->sIB1_message.size); memcpy(sys_info->sib1, DUsi->sIB1_message.buf, DUsi->sIB1_message.size);
/* Convert the mme name to a printable string */ sys_info->sib1_length = DUsi->sIB1_message.size;
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]);
} }
// char *measurement_timing_information[F1AP_MAX_NB_CELLS]; // 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) ...@@ -281,12 +281,10 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req)
strlen(measurementTimingConfiguration)); strlen(measurementTimingConfiguration));
asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, gNB_DU_System_Information); asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, gNB_DU_System_Information);
/* 4.1.2 gNB-DU System Information */ /* 4.1.2 gNB-DU System Information */
OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 AssertFatal(setup_req->cell[i].sys_info != NULL, "assume that sys_info is present, which is not the case\n");
(const char *)setup_req->mib[i], //f1ap_du_data->mib, const f1ap_gnb_du_system_info_t *sys_info = setup_req->cell[i].sys_info;
setup_req->mib_length[i]); 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, // sept. 2018 OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, (const char *)sys_info->sib1, sys_info->sib1_length);
(const char *)setup_req->sib1[i],
setup_req->sib1_length[i]);
} }
/* mandatory */ /* mandatory */
......
...@@ -2013,10 +2013,13 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { ...@@ -2013,10 +2013,13 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
DevAssert(rrc->carrier.mib != NULL); DevAssert(rrc->carrier.mib != NULL);
int buf_len = 3; // this is what we assume in monolithic int buf_len = 3; // this is what we assume in monolithic
f1Setup->mib[k] = calloc(buf_len, sizeof(*f1Setup->mib[k])); f1Setup->cell[k].sys_info = calloc(1, sizeof(*f1Setup->cell[k].sys_info));
DevAssert(f1Setup->mib[k] != NULL); AssertFatal(f1Setup->cell[k].sys_info != NULL, "out of memory\n");
f1Setup->mib_length[k] = encode_MIB_NR(rrc->carrier.mib, 0, f1Setup->mib[k], buf_len); f1ap_gnb_du_system_info_t *sys_info = f1Setup->cell[k].sys_info;
DevAssert(f1Setup->mib_length[k] == buf_len); 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; NR_BCCH_DL_SCH_Message_t *bcch_message = NULL;
asn_codec_ctx_t st={100*1000}; asn_codec_ctx_t st={100*1000};
...@@ -2034,12 +2037,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { ...@@ -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; NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
f1Setup->sib1[k] = calloc(1,rrc->carrier.sizeof_SIB1); sys_info->sib1 = calloc(1,rrc->carrier.sizeof_SIB1);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, asn_enc_rval_t enc_rval =
NULL, uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8);
(void *)bcch_SIB1,
f1Setup->sib1[k],
NR_MAX_SIB_LENGTH/8);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
...@@ -2047,7 +2047,7 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { ...@@ -2047,7 +2047,7 @@ 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"); 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 ); xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1 );
//} //}
f1Setup->sib1_length[k] = (enc_rval.encoded+7)/8; sys_info->sib1_length = (enc_rval.encoded + 7) / 8;
break; break;
} }
} }
......
...@@ -1873,13 +1873,15 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { ...@@ -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 //fixme: multi instance is not consistent here
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; 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) // 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"); 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_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_BCH_Message, &asn_DEF_NR_BCCH_BCH_Message,
(void **)&rrc->carrier.mib, (void **)&rrc->carrier.mib,
f1_setup_req->mib[i], sys_info->mib,
f1_setup_req->mib_length[i]); sys_info->mib_length);
AssertFatal(dec_rval.code == RC_OK, AssertFatal(dec_rval.code == RC_OK,
"[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n", "[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n",
j, j,
...@@ -1888,8 +1890,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { ...@@ -1888,8 +1890,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
dec_rval = uper_decode_complete(NULL, dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_SIB1, //&asn_DEF_NR_BCCH_DL_SCH_Message, &asn_DEF_NR_SIB1, //&asn_DEF_NR_BCCH_DL_SCH_Message,
(void **)&rrc->carrier.siblock1_DU, (void **)&rrc->carrier.siblock1_DU,
f1_setup_req->sib1[i], sys_info->sib1,
f1_setup_req->sib1_length[i]); sys_info->sib1_length);
AssertFatal(dec_rval.code == RC_OK, AssertFatal(dec_rval.code == RC_OK,
"[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n", "[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n",
j, 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