Commit 5378c4d8 authored by Robert Schmidt's avatar Robert Schmidt

Refactor RRC Reconfiguration function

Refactor the RRC reconfiguration function to reuse it also later for
sending the reconfiguration including the handover trigger.
parent 1783932e
......@@ -481,6 +481,60 @@ static void rrc_gNB_process_RRCSetupComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE
rrc_gNB_send_NGAP_NAS_FIRST_REQ(rrc, UE, rrcSetupComplete);
}
static int rrc_gNB_encode_RRCReconfiguration(gNB_RRC_INST *rrc,
gNB_RRC_UE_t *UE,
uint8_t xid,
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *nas_messages,
uint8_t *buf,
int max_len,
bool reestablish)
{
NR_CellGroupConfig_t *cellGroupConfig = UE->masterCellGroup;
nr_rrc_du_container_t *du = get_du_for_ue(rrc, UE->rrc_ue_id);
DevAssert(du != NULL);
f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info;
NR_MeasConfig_t *measconfig = NULL;
if (du->mtc != NULL) {
int scs = get_ssb_scs(cell_info);
int band = get_dl_band(cell_info);
const NR_MeasTimingList_t *mtlist = du->mtc->criticalExtensions.choice.c1->choice.measTimingConf->measTiming;
const NR_MeasTiming_t *mt = mtlist->list.array[0];
const neighbour_cell_configuration_t *neighbour_config = get_neighbour_config(cell_info->nr_cellid);
seq_arr_t *neighbour_cells = NULL;
if (neighbour_config)
neighbour_cells = neighbour_config->neighbour_cells;
measconfig = get_MeasConfig(mt, band, scs, &rrc->measurementConfiguration, neighbour_cells);
}
if (UE->measConfig)
free_MeasConfig(UE->measConfig);
UE->measConfig = measconfig;
NR_SRB_ToAddModList_t *SRBs = createSRBlist(UE, reestablish);
NR_DRB_ToAddModList_t *DRBs = createDRBlist(UE, reestablish);
int size = do_RRCReconfiguration(UE,
buf,
max_len,
xid,
SRBs,
DRBs,
UE->DRB_ReleaseList,
NULL,
measconfig,
nas_messages,
cellGroupConfig);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buf, size, "[MSG] RRC Reconfiguration\n");
freeSRBlist(SRBs);
freeDRBlist(DRBs);
ASN_STRUCT_FREE(asn_DEF_NR_DRB_ToReleaseList, UE->DRB_ReleaseList);
UE->DRB_ReleaseList = NULL;
return size;
}
static void rrc_gNB_generate_dedicatedRRCReconfiguration(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p)
{
uint8_t xid = rrc_gNB_get_next_transaction_identifier(rrc->module_id);
......@@ -517,51 +571,10 @@ static void rrc_gNB_generate_dedicatedRRCReconfiguration(gNB_RRC_INST *rrc, gNB_
for (int i = 0; i < ue_p->nb_of_pdusessions; i++)
clear_nas_pdu(&ue_p->pduSession[i].param.nas_pdu);
NR_CellGroupConfig_t *cellGroupConfig = ue_p->masterCellGroup;
const nr_rrc_du_container_t *du = get_du_for_ue(rrc, ue_p->rrc_ue_id);
DevAssert(du != NULL);
f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info;
NR_MeasConfig_t *measconfig = NULL;
if (du->mtc != NULL) {
int scs = get_ssb_scs(cell_info);
int band = get_dl_band(cell_info);
const NR_MeasTimingList_t *mtlist = du->mtc->criticalExtensions.choice.c1->choice.measTimingConf->measTiming;
const NR_MeasTiming_t *mt = mtlist->list.array[0];
const neighbour_cell_configuration_t *neighbour_config = get_neighbour_config(cell_info->nr_cellid);
seq_arr_t *neighbour_cells = NULL;
if (neighbour_config)
neighbour_cells = neighbour_config->neighbour_cells;
measconfig = get_MeasConfig(mt, band, scs, &rrc->measurementConfiguration, neighbour_cells);
}
if (ue_p->measConfig)
free_MeasConfig(ue_p->measConfig);
ue_p->measConfig = measconfig;
uint8_t buffer[NR_RRC_BUF_SIZE] = {0};
NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false);
NR_DRB_ToAddModList_t *DRBs = createDRBlist(ue_p, false);
int size = do_RRCReconfiguration(ue_p,
buffer,
NR_RRC_BUF_SIZE,
xid,
SRBs,
DRBs,
ue_p->DRB_ReleaseList,
NULL,
measconfig,
dedicatedNAS_MessageList,
cellGroupConfig);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n");
freeSRBlist(SRBs);
freeDRBlist(DRBs);
ASN_STRUCT_FREE(asn_DEF_NR_DRB_ToReleaseList, ue_p->DRB_ReleaseList);
ue_p->DRB_ReleaseList = NULL;
// TODO refactor dedicatedNAS_MessageList
int size = rrc_gNB_encode_RRCReconfiguration(rrc, ue_p, xid, dedicatedNAS_MessageList, buffer, sizeof(buffer), false);
DevAssert(size > 0 && size <= sizeof(buffer));
LOG_I(NR_RRC, "UE %d: Generate RRCReconfiguration (bytes %d, xid %d)\n", ue_p->rrc_ue_id, size, xid);
nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size);
......
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