Refactor code, add inter-freq neighbors, avoid mem leak
Previously, we only supported intra-frequency handovers, so the measurements where only for intra-frequency, reusing the same measurement object. Now that we would support inter-frequency handover, also add multiple MeasObjects for each neighbor.
This commit is contained in:
@@ -998,7 +998,7 @@ NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt,
|
||||
NR_ReportConfigToAddMod_t *rc_PER,
|
||||
NR_ReportConfigToAddMod_t *rc_A2,
|
||||
seq_arr_t *rc_A3_seq,
|
||||
seq_arr_t *pci_seq)
|
||||
seq_arr_t *neigh_seq)
|
||||
{
|
||||
NR_MeasConfig_t *mc = calloc_or_fail(1, sizeof(*mc));
|
||||
mc->measObjectToAddModList = calloc_or_fail(1, sizeof(*mc->measObjectToAddModList));
|
||||
@@ -1024,30 +1024,44 @@ NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt,
|
||||
// Measurement Objects: Specifies what is to be measured. For NR and inter-RAT E-UTRA measurements, this may include
|
||||
// cell-specific offsets, blacklisted cells to be ignored and whitelisted cells to consider for measurements.
|
||||
NR_MeasObjectToAddMod_t *mo1 = get_MeasObject(ft, band, ft->carrierFreq, 1);
|
||||
|
||||
if (pci_seq) {
|
||||
if (neigh_seq) {
|
||||
NR_MeasObjectNR_t *monr1 = mo1->measObject.choice.measObjectNR;
|
||||
for (int i = 0; i < pci_seq->size; i++) {
|
||||
if (monr1->cellsToAddModList == NULL) {
|
||||
monr1->cellsToAddModList = calloc(1, sizeof(*monr1->cellsToAddModList));
|
||||
}
|
||||
|
||||
NR_CellsToAddMod_t *cell = calloc(1, sizeof(*cell));
|
||||
int *pci = (int *)seq_arr_at(pci_seq, i);
|
||||
cell->physCellId = *pci;
|
||||
if (monr1->cellsToAddModList == NULL)
|
||||
monr1->cellsToAddModList = calloc_or_fail(1, sizeof(*monr1->cellsToAddModList));
|
||||
FOR_EACH_SEQ_ARR(nr_neighbour_cell_t *, n, neigh_seq) {
|
||||
NR_CellsToAddMod_t *cell = calloc_or_fail(1, sizeof(*cell));
|
||||
cell->physCellId = n->physicalCellId;
|
||||
ASN_SEQUENCE_ADD(&monr1->cellsToAddModList->list, cell);
|
||||
}
|
||||
}
|
||||
|
||||
asn1cSeqAdd(&mc->measObjectToAddModList->list, mo1);
|
||||
|
||||
// Preparation of measId
|
||||
for (uint8_t reportIdx = 0; reportIdx < mc->reportConfigToAddModList->list.count; reportIdx++) {
|
||||
uint8_t reportIdx = 0;
|
||||
for (; reportIdx < mc->reportConfigToAddModList->list.count; reportIdx++) {
|
||||
const NR_ReportConfigId_t reportId = mc->reportConfigToAddModList->list.array[reportIdx]->reportConfigId;
|
||||
NR_MeasIdToAddMod_t *measid = get_MeasId(reportIdx + 1, reportId, 1);
|
||||
asn1cSeqAdd(&mc->measIdToAddModList->list, measid);
|
||||
}
|
||||
|
||||
// Preparation of measId for neighbour cells for periodic report
|
||||
if (neigh_seq) {
|
||||
int mo_id = 2;
|
||||
FOR_EACH_SEQ_ARR(nr_neighbour_cell_t *, neigh_cell, neigh_seq) {
|
||||
NR_MeasObjectToAddMod_t *mo_neighbour = get_MeasObject(ft, band, neigh_cell->absoluteFrequencySSB, mo_id);
|
||||
NR_MeasObjectNR_t *monr = mo_neighbour->measObject.choice.measObjectNR;
|
||||
monr->cellsToAddModList = calloc_or_fail(1, sizeof(*monr->cellsToAddModList));
|
||||
NR_CellsToAddMod_t *cell = calloc_or_fail(1, sizeof(*cell));
|
||||
cell->physCellId = neigh_cell->physicalCellId;
|
||||
ASN_SEQUENCE_ADD(&monr->cellsToAddModList->list, cell);
|
||||
asn1cSeqAdd(&mc->measObjectToAddModList->list, mo_neighbour);
|
||||
NR_MeasIdToAddMod_t *measid = get_MeasId(reportIdx + 1, rc_PER->reportConfigId, mo_id);
|
||||
asn1cSeqAdd(&mc->measIdToAddModList->list, measid);
|
||||
reportIdx++;
|
||||
mo_id++;
|
||||
}
|
||||
}
|
||||
|
||||
mc->quantityConfig = calloc_or_fail(1, sizeof(*mc->quantityConfig));
|
||||
mc->quantityConfig->quantityConfigNR_List = calloc_or_fail(1, sizeof(*mc->quantityConfig->quantityConfigNR_List));
|
||||
NR_QuantityConfigNR_t *qcnr = calloc_or_fail(1, sizeof(*qcnr));
|
||||
|
||||
@@ -151,7 +151,7 @@ NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt,
|
||||
NR_ReportConfigToAddMod_t *rc_PER,
|
||||
NR_ReportConfigToAddMod_t *rc_A2,
|
||||
seq_arr_t *rc_A3_seq,
|
||||
seq_arr_t *pci_seq);
|
||||
seq_arr_t *neigh_seq);
|
||||
void free_MeasConfig(NR_MeasConfig_t *mc);
|
||||
int do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi);
|
||||
|
||||
|
||||
@@ -568,7 +568,6 @@ nr_rrc_reconfig_param_t get_RRCReconfiguration_params(gNB_RRC_INST *rrc, gNB_RRC
|
||||
NR_ReportConfigToAddMod_t *rc_PER = NULL;
|
||||
NR_ReportConfigToAddMod_t *rc_A2 = NULL;
|
||||
seq_arr_t *rc_A3_seq = NULL;
|
||||
seq_arr_t *pci_seq = NULL;
|
||||
if (du->mtc != NULL) {
|
||||
int scs = get_ssb_scs(cell_info);
|
||||
int band = get_dl_band(cell_info);
|
||||
@@ -587,16 +586,11 @@ nr_rrc_reconfig_param_t get_RRCReconfiguration_params(gNB_RRC_INST *rrc, gNB_RRC
|
||||
If default one added once as a report, no need to add it again && duplication.
|
||||
*/
|
||||
rc_A3_seq = malloc(sizeof(seq_arr_t));
|
||||
pci_seq = malloc(sizeof(seq_arr_t));
|
||||
seq_arr_init(rc_A3_seq, sizeof(NR_ReportConfigToAddMod_t));
|
||||
seq_arr_init(pci_seq, sizeof(int));
|
||||
LOG_D(NR_RRC, "HO LOG: Preparing A3 Event Measurement Configuration!\n");
|
||||
bool is_default_a3_added = false;
|
||||
for (int i = 0; i < neighbour_cells->size; i++) {
|
||||
nr_neighbour_cell_t *neighbourCell = (nr_neighbour_cell_t *)seq_arr_at(neighbour_cells, i);
|
||||
if (!neighbourCell->isIntraFrequencyNeighbour)
|
||||
continue;
|
||||
seq_arr_push_back(pci_seq, &neighbourCell->physicalCellId, sizeof(int));
|
||||
const nr_a3_event_t *a3Event = get_a3_configuration(rrc, neighbourCell->physicalCellId);
|
||||
if (!a3Event || is_default_a3_added)
|
||||
continue;
|
||||
@@ -610,7 +604,7 @@ nr_rrc_reconfig_param_t get_RRCReconfiguration_params(gNB_RRC_INST *rrc, gNB_RRC
|
||||
if (rrc->measurementConfiguration.a2_event)
|
||||
rc_A2 = prepare_a2_event_report(rrc->measurementConfiguration.a2_event);
|
||||
|
||||
measconfig = get_MeasConfig(mt, band, scs, rc_PER, rc_A2, rc_A3_seq, pci_seq);
|
||||
measconfig = get_MeasConfig(mt, band, scs, rc_PER, rc_A2, rc_A3_seq, neighbour_cells);
|
||||
}
|
||||
|
||||
if (UE->measConfig)
|
||||
|
||||
Reference in New Issue
Block a user