Commit 07da84ed authored by Guido Casati's avatar Guido Casati

Use F1 gNB-DU Configuration Update lib in stack

parent 2cc50832
......@@ -411,8 +411,6 @@ typedef struct f1ap_cudu_inst_s {
instance_t gtpInst;
} f1ap_cudu_inst_t;
static const int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273};
uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP);
f1ap_cudu_inst_t *getCxt(instance_t instanceP);
......
......@@ -51,7 +51,7 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint3
/*
* gNB-DU Configuration Update
*/
int DU_send_gNB_DU_CONFIGURATION_UPDATE(sctp_assoc_t assoc_id, const f1ap_gnb_du_configuration_update_t *upd);
int DU_send_gNB_DU_CONFIGURATION_UPDATE(sctp_assoc_t assoc_id, f1ap_gnb_du_configuration_update_t *msg);
/*
* gNB-CU Configuration Update
......
......@@ -51,51 +51,8 @@ static void gnb_du_configuration_update_direct(const f1ap_gnb_du_configuration_u
{
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_GNB_DU_CONFIGURATION_UPDATE);
msg->ittiMsgHeader.originInstance = -1; // means monolithic
f1ap_gnb_du_configuration_update_t *f1ap_msg = &F1AP_GNB_DU_CONFIGURATION_UPDATE(msg);
DevAssert(upd->gNB_DU_ID == NULL);
f1ap_msg->transaction_id = upd->transaction_id;
DevAssert(upd->num_cells_to_add == 0);
DevAssert(upd->num_cells_to_delete == 0);
f1ap_msg->num_cells_to_modify = upd->num_cells_to_modify;
for (int n = 0; n < upd->num_cells_to_modify; ++n) {
f1ap_msg->cell_to_modify[n].old_nr_cellid = upd->cell_to_modify[n].old_nr_cellid;
f1ap_msg->cell_to_modify[n].info = upd->cell_to_modify[n].info; // copy most fields
if (upd->cell_to_modify[n].info.tac) {
f1ap_msg->cell_to_modify[n].info.tac = malloc(sizeof(*f1ap_msg->cell_to_modify[n].info.tac));
AssertFatal(f1ap_msg->cell_to_modify[n].info.tac != NULL, "out of memory\n");
*f1ap_msg->cell_to_modify[n].info.tac = *upd->cell_to_modify[n].info.tac;
}
if (upd->cell_to_modify[n].info.measurement_timing_config_len > 0) {
f1ap_msg->cell_to_modify[n].info.measurement_timing_config =
calloc(upd->cell_to_modify[n].info.measurement_timing_config_len, sizeof(uint8_t));
AssertFatal(f1ap_msg->cell_to_modify[n].info.measurement_timing_config != NULL, "out of memory\n");
memcpy(f1ap_msg->cell_to_modify[n].info.measurement_timing_config,
upd->cell_to_modify[n].info.measurement_timing_config,
upd->cell_to_modify[n].info.measurement_timing_config_len);
f1ap_msg->cell_to_modify[n].info.measurement_timing_config_len = upd->cell_to_modify[n].info.measurement_timing_config_len;
}
if (upd->cell_to_modify[n].sys_info) {
f1ap_gnb_du_system_info_t *orig_sys_info = upd->cell_to_modify[n].sys_info;
f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info));
AssertFatal(copy_sys_info != NULL, "out of memory\n");
f1ap_msg->cell_to_modify[n].sys_info = copy_sys_info;
copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t));
AssertFatal(copy_sys_info->mib != NULL, "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 != NULL, "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;
}
}
}
/* transfer to RRC via ITTI */
F1AP_GNB_DU_CONFIGURATION_UPDATE(msg) = cp_f1ap_du_configuration_update(upd);
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
......
......@@ -78,34 +78,14 @@ static void f1_setup_request_f1ap(const f1ap_setup_req_t *req)
static void gnb_du_configuration_update_f1ap(const f1ap_gnb_du_configuration_update_t *upd)
{
MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_GNB_DU_CONFIGURATION_UPDATE);
f1ap_gnb_du_configuration_update_t *f1_upd = &F1AP_GNB_DU_CONFIGURATION_UPDATE(msg);
f1_upd->transaction_id = upd->transaction_id;
AssertFatal(upd->num_cells_to_add == 0, "gNB-DU config update: cells to add not supported\n");
f1_upd->num_cells_to_modify = upd->num_cells_to_modify;
for (int n = 0; n < upd->num_cells_to_modify; ++n) {
f1_upd->cell_to_modify[n].old_plmn = upd->cell_to_modify[n].old_plmn;
f1_upd->cell_to_modify[n].old_nr_cellid = upd->cell_to_modify[n].old_nr_cellid;
f1_upd->cell_to_modify[n].info = upd->cell_to_modify[n].info;
if (upd->cell_to_modify[n].sys_info) {
f1ap_gnb_du_system_info_t *orig_sys_info = upd->cell_to_modify[n].sys_info;
f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info));
f1_upd->cell_to_modify[n].sys_info = copy_sys_info;
copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t));
AssertFatal(copy_sys_info->mib != NULL, "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 != NULL, "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;
}
}
}
AssertFatal(upd->num_cells_to_delete == 0, "gNB-DU config update: cells to add not supported\n");
itti_send_msg_to_task(TASK_DU_F1, 0, msg);
/* copy F1AP message */
f1ap_gnb_du_configuration_update_t cp = cp_f1ap_du_configuration_update(upd);
/* transfer to ITTI message */
F1AP_GNB_DU_CONFIGURATION_UPDATE(msg) = cp;
/* free after copy */
free_f1ap_du_configuration_update(upd);
/* send to RRC task */
itti_send_msg_to_task(TASK_RRC_GNB, 0, msg);
}
static void ue_context_setup_response_f1ap(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp)
......
......@@ -516,8 +516,9 @@ void rrc_gNB_process_f1_du_configuration_update(f1ap_gnb_du_configuration_update
/* Send DU Configuration Acknowledgement */
f1ap_gnb_du_configuration_update_acknowledge_t ack = {.transaction_id = conf_up->transaction_id};
rrc->mac_rrc.gnb_du_configuration_update_acknowledge(assoc_id, &ack);
/* free F1AP message after use */
free_f1ap_du_configuration_update(conf_up);
}
void rrc_CU_process_f1_lost_connection(gNB_RRC_INST *rrc, f1ap_lost_connection_t *lc, sctp_assoc_t assoc_id)
......
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