Commit 20b62f34 authored by Robert Schmidt's avatar Robert Schmidt

Implement restart using gNB-DU configuratino update

parent 2413dc74
......@@ -573,16 +573,7 @@ int stop_L1L2(module_id_t gnb_id)
*/
}
/* these tasks need to pick up new configuration */
/*
terminate_task(TASK_RRC_GNB, gnb_id);
*/
gNB_MAC_INST *mac = RC.nrmac[0];
mac->f1_config.setup_resp = NULL;
MessageDef *msg = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_LOST_CONNECTION);
msg->ittiMsgHeader.originInstance = -1;
itti_send_msg_to_task (TASK_RRC_GNB, 0, msg);
/* these tasks/layers need to pick up new configuration */
if (RC.nb_nr_L1_inst > 0)
stop_gNB(RC.nb_nr_L1_inst);
......@@ -602,6 +593,8 @@ int stop_L1L2(module_id_t gnb_id)
return 0;
}
extern f1ap_tdd_info_t read_tdd_config(const NR_ServingCellConfigCommon_t *scc);
extern f1ap_gnb_du_system_info_t *get_sys_info(NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1);
/*
* Restart the nr-softmodem after it has been soft-stopped with stop_L1L2()
*/
......@@ -635,24 +628,33 @@ int start_L1L2(module_id_t gnb_id)
NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon;
nr_mac_config_scc(mac, scc, &mac->radio_config);
/* send new F1 Setup Request to RRC */
NR_BCCH_BCH_Message_t *mib = mac->common_channels[0].mib;
NR_BCCH_DL_SCH_Message_t *sib1 = mac->common_channels[0].sib1;
f1ap_setup_req_t *old = mac->f1_config.setup_req;
const f1ap_served_cell_info_t *info = &old->cell[0].info;
f1ap_setup_req_t *req = RC_read_F1Setup(old->gNB_DU_id, old->gNB_DU_name, info, scc, mib, sib1);
AssertFatal(req != NULL, "could not read F1 Setup information\n");
RC.nrmac[0]->f1_config.setup_req = req;
nr_mac_send_f1_setup_req();
//wait_gNBs();
const NR_BCCH_DL_SCH_Message_t *sib1 = mac->common_channels[0].sib1;
/* update existing config in F1 Setup request structures */
f1ap_setup_req_t *sr = mac->f1_config.setup_req;
DevAssert(sr->num_cells_available == 1);
f1ap_served_cell_info_t *info = &sr->cell[0].info;
DevAssert(info->mode == F1AP_MODE_TDD);
DevAssert(scc->tdd_UL_DL_ConfigurationCommon != NULL);
info->tdd = read_tdd_config(scc); /* updates radio config */
/* send gNB-DU configuration update to RRC */
f1ap_gnb_du_configuration_update_t update = {
.transaction_id = 1,
.num_cells_to_modify = 1,
};
update.cell_to_modify[0].old_nr_cellid = info->nr_cellid;
update.cell_to_modify[0].info = *info;
update.cell_to_modify[0].sys_info = get_sys_info(mib, sib1);
mac->mac_rrc.gnb_du_configuration_update(&update);
//sleep(2);
init_NR_RU(config_get_if(), NULL);
wait_f1_setup_response();
start_NR_RU();
//ru->rf_map.carD = 0;
//ru->rf_map.chain = 0; /* CC_id + chain_offset;*/
wait_RUs();
// TODO eNB->RU_list[ru_id]->common.rxdataF
init_eNB_afterRU();
printf("Sending sync to all threads\n");
pthread_mutex_lock(&sync_mutex);
......
......@@ -1113,7 +1113,7 @@ static int read_du_cell_info(configmodule_interface_t *cfg,
return 1;
}
static f1ap_tdd_info_t read_tdd_config(const NR_ServingCellConfigCommon_t *scc)
f1ap_tdd_info_t read_tdd_config(const NR_ServingCellConfigCommon_t *scc)
{
const NR_FrequencyInfoDL_t *dl = scc->downlinkConfigCommon->frequencyInfoDL;
f1ap_tdd_info_t tdd = {
......@@ -1142,6 +1142,28 @@ static f1ap_fdd_info_t read_fdd_config(const NR_ServingCellConfigCommon_t *scc)
return fdd;
}
f1ap_gnb_du_system_info_t *get_sys_info(NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1)
{
int buf_len = 3;
f1ap_gnb_du_system_info_t *sys_info = calloc(1, sizeof(*sys_info));
AssertFatal(sys_info != NULL, "out of memory\n");
sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib));
DevAssert(sys_info->mib != NULL);
DevAssert(mib != NULL);
sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len);
DevAssert(sys_info->mib_length == buf_len);
DevAssert(sib1 != NULL);
NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1;
sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->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);
sys_info->sib1_length = (enc_rval.encoded + 7) / 8;
return sys_info;
}
f1ap_setup_req_t *RC_read_F1Setup(uint64_t id,
const char *name,
const f1ap_served_cell_info_t *info,
......@@ -1183,22 +1205,7 @@ f1ap_setup_req_t *RC_read_F1Setup(uint64_t id,
// in NSA we don't transmit SIB1, so cannot fill DU system information
// so cannot send MIB either
int buf_len = 3; // this is what we assume in monolithic
req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info));
AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n");
f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info;
sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib));
DevAssert(sys_info->mib != NULL);
DevAssert(mib != NULL);
sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len);
DevAssert(sys_info->mib_length == buf_len);
DevAssert(sib1 != NULL);
NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1;
sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->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);
sys_info->sib1_length = (enc_rval.encoded + 7) / 8;
req->cell[0].sys_info = get_sys_info(mib, sib1);
}
int num = read_version(TO_STRING(NR_RRC_VERSION), &req->rrc_ver[0], &req->rrc_ver[1], &req->rrc_ver[2]);
......
......@@ -279,10 +279,13 @@ void rrc_gNB_process_f1_du_configuration_update(f1ap_gnb_du_configuration_update
// MIB is mandatory, so will be overwritten. SIB1 is optional, so will
// only be overwritten if present in sys_info
ASN_STRUCT_FREE(asn_DEF_NR_MIB, du->mib);
if (sys_info->sib1 != NULL)
if (sys_info->sib1 != NULL) {
ASN_STRUCT_FREE(asn_DEF_NR_SIB1, du->sib1);
du->sib1 = NULL;
}
NR_BCCH_BCH_Message_t *mib = NULL;
if (!extract_sys_info(sys_info, &mib, &du->sib1)) {
LOG_W(RRC, "cannot update sys_info for DU %ld\n", du->setup_req->gNB_DU_id);
} else {
......
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