Commit d4b1e7b5 authored by francescomani's avatar francescomani

improvements in handling measurememt identity addition, modification and removal

parent eeca8f9f
...@@ -152,7 +152,7 @@ static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc, ...@@ -152,7 +152,7 @@ static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc,
OCTET_STRING_t *masterCellGroup, OCTET_STRING_t *masterCellGroup,
long *fullConfig); long *fullConfig);
static void nr_rrc_ue_process_measConfig(rrcPerNB_t *rrc, NR_MeasConfig_t *const measConfig); static void nr_rrc_ue_process_measConfig(rrcPerNB_t *rrc, NR_MeasConfig_t *const measConfig, NR_UE_Timers_Constants_t *timers);
static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc,
int gNB_index, int gNB_index,
...@@ -221,8 +221,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, ...@@ -221,8 +221,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc,
} }
if (ie->measConfig != NULL) { if (ie->measConfig != NULL) {
LOG_I(NR_RRC, "Measurement Configuration is present\n"); LOG_I(NR_RRC, "Measurement Configuration is present\n");
// if some element need to be updated nr_rrc_ue_process_measConfig(rrcNB, ie->measConfig, &rrc->timers_and_constants);
nr_rrc_ue_process_measConfig(rrcNB, ie->measConfig);
} }
if (ie->lateNonCriticalExtension != NULL) { if (ie->lateNonCriticalExtension != NULL) {
// unuse now // unuse now
...@@ -1044,7 +1043,16 @@ static void nr_rrc_ue_process_securityModeCommand(NR_UE_RRC_INST_t *ue_rrc, ...@@ -1044,7 +1043,16 @@ static void nr_rrc_ue_process_securityModeCommand(NR_UE_RRC_INST_t *ue_rrc,
securityModeCommand->criticalExtensions.present); securityModeCommand->criticalExtensions.present);
} }
static void handle_measobj_remove(rrcPerNB_t *rrc, struct NR_MeasObjectToRemoveList *remove_list) static void handle_meas_reporting_remove(rrcPerNB_t *rrc, int id, NR_UE_Timers_Constants_t *timers)
{
// remove the measurement reporting entry for this measId if included
asn1cFreeStruc(asn_DEF_NR_VarMeasReport, rrc->MeasReport[id]);
// TODO stop the periodical reporting timer or timer T321, whichever is running,
// and reset the associated information (e.g. timeToTrigger) for this measId
nr_timer_stop(&timers->T321);
}
static void handle_measobj_remove(rrcPerNB_t *rrc, struct NR_MeasObjectToRemoveList *remove_list, NR_UE_Timers_Constants_t *timers)
{ {
// section 5.5.2.4 in 38.331 // section 5.5.2.4 in 38.331
for (int i = 0; i < remove_list->list.count; i++) { for (int i = 0; i < remove_list->list.count; i++) {
...@@ -1058,10 +1066,7 @@ static void handle_measobj_remove(rrcPerNB_t *rrc, struct NR_MeasObjectToRemoveL ...@@ -1058,10 +1066,7 @@ static void handle_measobj_remove(rrcPerNB_t *rrc, struct NR_MeasObjectToRemoveL
for (int j = 0; j < MAX_MEAS_ID; j++) { for (int j = 0; j < MAX_MEAS_ID; j++) {
if (rrc->MeasId[j] && rrc->MeasId[j]->measObjectId == id) { if (rrc->MeasId[j] && rrc->MeasId[j]->measObjectId == id) {
asn1cFreeStruc(asn_DEF_NR_MeasIdToAddMod, rrc->MeasId[j]); asn1cFreeStruc(asn_DEF_NR_MeasIdToAddMod, rrc->MeasId[j]);
// remove the measurement reporting entry for this measId if included handle_meas_reporting_remove(rrc, j, timers);
asn1cFreeStruc(asn_DEF_NR_VarMeasReport, rrc->MeasReport[j]);
// TODO stop the periodical reporting timer or timer T321, whichever is running,
// and reset the associated information (e.g. timeToTrigger) for this measId
} }
} }
} }
...@@ -1148,7 +1153,9 @@ static void handle_measobj_addmod(rrcPerNB_t *rrc, struct NR_MeasObjectToAddModL ...@@ -1148,7 +1153,9 @@ static void handle_measobj_addmod(rrcPerNB_t *rrc, struct NR_MeasObjectToAddModL
} }
} }
static void handle_reportconfig_remove(rrcPerNB_t *rrc, struct NR_ReportConfigToRemoveList *remove_list) static void handle_reportconfig_remove(rrcPerNB_t *rrc,
struct NR_ReportConfigToRemoveList *remove_list,
NR_UE_Timers_Constants_t *timers)
{ {
for (int i = 0; i < remove_list->list.count; i++) { for (int i = 0; i < remove_list->list.count; i++) {
NR_ReportConfigId_t id = *remove_list->list.array[i]; NR_ReportConfigId_t id = *remove_list->list.array[i];
...@@ -1158,16 +1165,15 @@ static void handle_reportconfig_remove(rrcPerNB_t *rrc, struct NR_ReportConfigTo ...@@ -1158,16 +1165,15 @@ static void handle_reportconfig_remove(rrcPerNB_t *rrc, struct NR_ReportConfigTo
if (rrc->MeasId[j] && rrc->MeasId[j]->reportConfigId == id) { if (rrc->MeasId[j] && rrc->MeasId[j]->reportConfigId == id) {
// remove all measId associated with the reportConfigId from the measIdList // remove all measId associated with the reportConfigId from the measIdList
asn1cFreeStruc(asn_DEF_NR_MeasIdToAddMod, rrc->MeasId[j]); asn1cFreeStruc(asn_DEF_NR_MeasIdToAddMod, rrc->MeasId[j]);
// remove the measurement reporting entry for this measId if included handle_meas_reporting_remove(rrc, j, timers);
asn1cFreeStruc(asn_DEF_NR_VarMeasReport, rrc->MeasReport[j]);
// TODO stop the periodical reporting timer or timer T321, whichever one is running
// and reset the associated information (e.g. timeToTrigger) for this measId
} }
} }
} }
} }
static void handle_reportconfig_addmod(rrcPerNB_t *rrc, struct NR_ReportConfigToAddModList *addmod_list) static void handle_reportconfig_addmod(rrcPerNB_t *rrc,
struct NR_ReportConfigToAddModList *addmod_list,
NR_UE_Timers_Constants_t *timers)
{ {
for (int i = 0; i < addmod_list->list.count; i++) { for (int i = 0; i < addmod_list->list.count; i++) {
NR_ReportConfigToAddMod_t *rep = addmod_list->list.array[i]; NR_ReportConfigToAddMod_t *rep = addmod_list->list.array[i];
...@@ -1179,19 +1185,15 @@ static void handle_reportconfig_addmod(rrcPerNB_t *rrc, struct NR_ReportConfigTo ...@@ -1179,19 +1185,15 @@ static void handle_reportconfig_addmod(rrcPerNB_t *rrc, struct NR_ReportConfigTo
if (rrc->ReportConfig[id]) { if (rrc->ReportConfig[id]) {
for (int j = 0; j < MAX_MEAS_ID; j++) { for (int j = 0; j < MAX_MEAS_ID; j++) {
// for each measId associated with this reportConfigId included in the measIdList // for each measId associated with this reportConfigId included in the measIdList
if (rrc->MeasId[j] && rrc->MeasId[j]->reportConfigId == id) { if (rrc->MeasId[j] && rrc->MeasId[j]->reportConfigId == id)
// remove the measurement reporting entry for this measId if included handle_meas_reporting_remove(rrc, j, timers);
asn1cFreeStruc(asn_DEF_NR_VarMeasReport, rrc->MeasReport[j]);
// TODO stop the periodical reporting timer or timer T321, whichever one is running
// and reset the associated information (e.g. timeToTrigger) for this measId
}
} }
} }
UPDATE_IE(rrc->ReportConfig[id], addmod_list->list.array[i], NR_ReportConfigToAddMod_t); UPDATE_IE(rrc->ReportConfig[id], addmod_list->list.array[i], NR_ReportConfigToAddMod_t);
} }
} }
static void handle_quantityconfig(rrcPerNB_t *rrc, NR_QuantityConfig_t *quantityConfig) static void handle_quantityconfig(rrcPerNB_t *rrc, NR_QuantityConfig_t *quantityConfig, NR_UE_Timers_Constants_t *timers)
{ {
if (quantityConfig->quantityConfigNR_List) { if (quantityConfig->quantityConfigNR_List) {
for (int i = 0; i < quantityConfig->quantityConfigNR_List->list.count; i++) { for (int i = 0; i < quantityConfig->quantityConfigNR_List->list.count; i++) {
...@@ -1205,55 +1207,82 @@ static void handle_quantityconfig(rrcPerNB_t *rrc, NR_QuantityConfig_t *quantity ...@@ -1205,55 +1207,82 @@ static void handle_quantityconfig(rrcPerNB_t *rrc, NR_QuantityConfig_t *quantity
} }
for (int j = 0; j < MAX_MEAS_ID; j++) { for (int j = 0; j < MAX_MEAS_ID; j++) {
// for each measId included in the measIdList // for each measId included in the measIdList
if (rrc->MeasId[j]) { if (rrc->MeasId[j])
// remove the measurement reporting entry for this measId if included handle_meas_reporting_remove(rrc, j, timers);
asn1cFreeStruc(asn_DEF_NR_VarMeasReport, rrc->MeasReport[j]); }
// TODO stop the periodical reporting timer or timer T321, whichever one is running }
// and reset the associated information (e.g. timeToTrigger) for this measId
static void handle_measid_remove(rrcPerNB_t *rrc, struct NR_MeasIdToRemoveList *remove_list, NR_UE_Timers_Constants_t *timers)
{
for (int i = 0; i < remove_list->list.count; i++) {
NR_MeasId_t id = *remove_list->list.array[i];
if (rrc->MeasId[id]) {
asn1cFreeStruc(asn_DEF_NR_MeasIdToAddMod, rrc->MeasId[id]);
handle_meas_reporting_remove(rrc, id, timers);
} }
} }
} }
static void nr_rrc_ue_process_measConfig(rrcPerNB_t *rrc, NR_MeasConfig_t *const measConfig) static void handle_measid_addmod(rrcPerNB_t *rrc, struct NR_MeasIdToAddModList *addmod_list, NR_UE_Timers_Constants_t *timers)
{ {
int i; for (int i = 0; i < addmod_list->list.count; i++) {
long ind; NR_MeasId_t id = addmod_list->list.array[i]->measId;
NR_ReportConfigId_t reportId = addmod_list->list.array[i]->reportConfigId;
NR_MeasObjectId_t measObjectId = addmod_list->list.array[i]->measObjectId;
UPDATE_IE(rrc->MeasId[id], addmod_list->list.array[i], NR_MeasIdToAddMod_t);
handle_meas_reporting_remove(rrc, id, timers);
if (rrc->ReportConfig[reportId]) {
NR_ReportConfigToAddMod_t *report = rrc->ReportConfig[reportId];
AssertFatal(report->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR,
"Only NR config report is supported\n");
NR_ReportConfigNR_t *reportNR = report->reportConfig.choice.reportConfigNR;
// if the reportType is set to reportCGI in the reportConfig associated with this measId
if (reportNR->reportType.present == NR_ReportConfigNR__reportType_PR_reportCGI) {
if (rrc->MeasObj[measObjectId]) {
if (rrc->MeasObj[measObjectId]->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) {
NR_MeasObjectNR_t *obj_nr = rrc->MeasObj[measObjectId]->measObject.choice.measObjectNR;
NR_ARFCN_ValueNR_t freq = 0;
if (obj_nr->ssbFrequency)
freq = *obj_nr->ssbFrequency;
else if (obj_nr->refFreqCSI_RS)
freq = *obj_nr->refFreqCSI_RS;
AssertFatal(freq > 0, "Invalid ARFCN frequency for this measurement object\n");
if (freq > 2016666)
nr_timer_setup(&timers->T321, 16000, 10); // 16 seconds for FR2
else
nr_timer_setup(&timers->T321, 2000, 10); // 2 seconds for FR1
}
else // EUTRA
nr_timer_setup(&timers->T321, 1000, 10); // 1 second for EUTRA
nr_timer_start(&timers->T321);
}
}
}
}
}
static void nr_rrc_ue_process_measConfig(rrcPerNB_t *rrc, NR_MeasConfig_t *const measConfig, NR_UE_Timers_Constants_t *timers)
{
if (measConfig->measObjectToRemoveList) if (measConfig->measObjectToRemoveList)
handle_measobj_remove(rrc, measConfig->measObjectToRemoveList); handle_measobj_remove(rrc, measConfig->measObjectToRemoveList, timers);
if (measConfig->measObjectToAddModList) if (measConfig->measObjectToAddModList)
handle_measobj_addmod(rrc, measConfig->measObjectToAddModList); handle_measobj_addmod(rrc, measConfig->measObjectToAddModList);
if (measConfig->reportConfigToRemoveList) if (measConfig->reportConfigToRemoveList)
handle_reportconfig_remove(rrc, measConfig->reportConfigToRemoveList); handle_reportconfig_remove(rrc, measConfig->reportConfigToRemoveList, timers);
if (measConfig->reportConfigToAddModList) if (measConfig->reportConfigToAddModList)
handle_reportconfig_addmod(rrc, measConfig->reportConfigToAddModList); handle_reportconfig_addmod(rrc, measConfig->reportConfigToAddModList, timers);
if (measConfig->quantityConfig) if (measConfig->quantityConfig)
handle_quantityconfig(rrc, measConfig->quantityConfig); handle_quantityconfig(rrc, measConfig->quantityConfig, timers);
if (measConfig->measIdToRemoveList != NULL) {
for (i = 0; i < measConfig->measIdToRemoveList->list.count; i++) {
ind = *measConfig->measIdToRemoveList->list.array[i];
free(rrc->MeasId[ind - 1]);
}
}
if (measConfig->measIdToAddModList != NULL) { if (measConfig->measIdToRemoveList)
for (i = 0; i < measConfig->measIdToAddModList->list.count; i++) { handle_measid_remove(rrc, measConfig->measIdToRemoveList, timers);
ind = measConfig->measIdToAddModList->list.array[i]->measId;
if (rrc->MeasId[ind - 1]) { if (measConfig->measIdToAddModList)
LOG_D(NR_RRC, "Modifying Measurement ID %ld\n", ind - 1); handle_measid_addmod(rrc, measConfig->measIdToAddModList, timers);
memcpy(rrc->MeasId[ind - 1], (char *)measConfig->measIdToAddModList->list.array[i], sizeof(NR_MeasIdToAddMod_t));
} else {
LOG_D(NR_RRC, "Adding Measurement ID %ld %p\n", ind - 1, measConfig->measIdToAddModList->list.array[i]);
rrc->MeasId[ind - 1] = measConfig->measIdToAddModList->list.array[i];
}
}
}
if (measConfig->measGapConfig != NULL) { if (measConfig->measGapConfig != NULL) {
if (rrc->measGapConfig) { if (rrc->measGapConfig) {
......
...@@ -158,6 +158,7 @@ typedef struct NR_UE_Timers_Constants_s { ...@@ -158,6 +158,7 @@ typedef struct NR_UE_Timers_Constants_s {
NR_timer_t T311; NR_timer_t T311;
NR_timer_t T319; NR_timer_t T319;
NR_timer_t T320; NR_timer_t T320;
NR_timer_t T321;
NR_timer_t T325; NR_timer_t T325;
NR_timer_t T390; NR_timer_t T390;
// counters // counters
......
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