Compare commits

...

4 Commits

Author SHA1 Message Date
Karim Boutiba
bd7a0646c8 RIC RSRP GNW 2025-04-03 15:00:54 +00:00
Cedric Roux
4e5a230022 print measurement to stdout 2025-04-05 13:55:13 +02:00
Cedric Roux
b261ebcd09 unlimited, more frequent measurements 2025-04-05 13:38:52 +02:00
Cedric Roux
d202b550b4 hack: add fr2 measurement 2025-04-04 21:58:44 +02:00
6 changed files with 180 additions and 3 deletions

View File

@@ -36,6 +36,21 @@ bool read_mac_sm(void* data)
mac->msg.tstamp = time_now_us();
NR_UEs_t *UE_info = &RC.nrmac[mod_id]->UE_info;
/*rrc_gNB_ue_context_t *ue_context_p;
gNB_RRC_UE_t *ue2;
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &RC.nrrrc[mod_id]->rrc_ue_head) {
ue2 = &ue_context_p->ue_context; // get first UE context.
//if (ue2)
//break;
if (ue2)
printf("E2 = %d\n",ue2);
}*/
//printf("E2 rsrp = %d\n",RC.nrrrc[mod_id]->rsrp);
size_t num_ues = 0;
UE_iterator(UE_info->list, ue) {
if (ue)
@@ -91,7 +106,8 @@ bool read_mac_sm(void* data)
rd->ul_bler = sched_ctrl->ul_bler_stats.bler;
rd->dl_mcs2 = 0;
rd->ul_mcs2 = 0;
rd->phr = sched_ctrl->ph;
rd->phr = RC.nrrrc[mod_id]->rsrp; //sched_ctrl->ph;
const uint32_t bufferSize = sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes;
rd->bsr = bufferSize;

View File

@@ -26,6 +26,8 @@
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
#include "openair2/RRC/NR/nr_rrc_defs.h"
bool read_mac_sm(void*);

View File

@@ -81,6 +81,7 @@
#include "NR_UE-CapabilityRequestFilterNR.h"
#include "NR_HandoverPreparationInformation.h"
#include "NR_HandoverPreparationInformation-IEs.h"
#include "NR_UECapabilityEnquiry-v1560-IEs.h"
#include "common/utils/nr/nr_common.h"
#if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h"
@@ -581,7 +582,7 @@ int do_NR_SA_UECapabilityEnquiry(uint8_t *const buffer, const uint8_t Transactio
ue_capabilityrat_request->rat_Type = NR_RAT_Type_nr;
sa_band_infoNR = (NR_FreqBandInformationNR_t*)calloc(1,sizeof(NR_FreqBandInformationNR_t));
sa_band_infoNR->bandNR = 78;
sa_band_infoNR->bandNR = 77;
sa_band_info = (NR_FreqBandInformation_t*)calloc(1,sizeof(NR_FreqBandInformation_t));
sa_band_info->present = NR_FreqBandInformation_PR_bandInformationNR;
sa_band_info->choice.bandInformationNR = sa_band_infoNR;
@@ -589,6 +590,16 @@ int do_NR_SA_UECapabilityEnquiry(uint8_t *const buffer, const uint8_t Transactio
sa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t));
asn1cSeqAdd(&sa_band_list->list, sa_band_info);
NR_FreqBandInformation_t *sa2_band_info;
NR_FreqBandInformationNR_t *sa2_band_infoNR;
sa2_band_infoNR = (NR_FreqBandInformationNR_t*)calloc(1,sizeof(NR_FreqBandInformationNR_t));
sa2_band_infoNR->bandNR = 257;
sa2_band_info = (NR_FreqBandInformation_t*)calloc(1,sizeof(NR_FreqBandInformation_t));
sa2_band_info->present = NR_FreqBandInformation_PR_bandInformationNR;
sa2_band_info->choice.bandInformationNR = sa2_band_infoNR;
asn1cSeqAdd(&sa_band_list->list, sa2_band_info);
sa_band_filter = (NR_UE_CapabilityRequestFilterNR_t*)calloc(1,sizeof(NR_UE_CapabilityRequestFilterNR_t));
sa_band_filter->frequencyBandListFilter = sa_band_list;
@@ -607,6 +618,34 @@ int do_NR_SA_UECapabilityEnquiry(uint8_t *const buffer, const uint8_t Transactio
asn1cSeqAdd(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list,
ue_capabilityrat_request);
/* NR-DC request */
NR_UECapabilityEnquiry_v1560_IEs_t nr_dc_cap = { 0 };
NR_UE_CapabilityRequestFilterCommon_t nr_dc_filter = { 0 };
nr_dc_cap.capabilityRequestFilterCommon = &nr_dc_filter;
nr_dc_filter.mrdc_Request = &(struct NR_UE_CapabilityRequestFilterCommon__mrdc_Request) {
.omitEN_DC = NULL,
.includeNR_DC = &(long){ NR_UE_CapabilityRequestFilterCommon__mrdc_Request__includeNR_DC_true },
.includeNE_DC = NULL
};
nr_dc_filter.ext2 = &(struct NR_UE_CapabilityRequestFilterCommon__ext2) {
.requestedCellGrouping_r16 = &(struct NR_UE_CapabilityRequestFilterCommon__ext2__requestedCellGrouping_r16) {
.list = { 0 }
}
};
NR_CellGrouping_r16_t nr_dc_combination = { 0 };
nr_dc_combination.mode_r16 = NR_CellGrouping_r16__mode_r16_async;
NR_FreqBandIndicatorNR_t b77 = 77;
NR_FreqBandIndicatorNR_t b257 = 257;
asn1cSeqAdd(&nr_dc_combination.mcg_r16.list, &b77);
asn1cSeqAdd(&nr_dc_combination.scg_r16.list, &b257);
asn1cSeqAdd(&nr_dc_filter.ext2->requestedCellGrouping_r16->list, &nr_dc_combination);
OCTET_STRING_t *nr_dc = calloc_or_fail(1, sizeof(*nr_dc));
nr_dc->size = uper_encode_to_new_buffer(&asn_DEF_NR_UECapabilityEnquiry_v1560_IEs, NULL, &nr_dc_cap, (void **)&nr_dc->buf);
dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityEnquiryExt = nr_dc;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
@@ -1354,6 +1393,114 @@ NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt,
asn1cSeqAdd(&mc->measIdToAddModList->list, measid);
}
/* add FR2 measurement */
{
/* measObject */
NR_MeasObjectToAddMod_t *mo1 = calloc(1, sizeof(*mo1));
mo1->measObjectId = 2;
mo1->measObject.present = NR_MeasObjectToAddMod__measObject_PR_measObjectNR;
NR_MeasObjectNR_t *monr1 = calloc(1, sizeof(*monr1));
asn1cCallocOne(monr1->ssbFrequency, 2090683);
asn1cCallocOne(monr1->ssbSubcarrierSpacing, 3 /* 120KHz */);
monr1->referenceSignalConfig.ssb_ConfigMobility = calloc(1, sizeof(*monr1->referenceSignalConfig.ssb_ConfigMobility));
monr1->referenceSignalConfig.ssb_ConfigMobility->deriveSSB_IndexFromCell = true;
monr1->absThreshSS_BlocksConsolidation = calloc(1, sizeof(*monr1->absThreshSS_BlocksConsolidation));
asn1cCallocOne(monr1->absThreshSS_BlocksConsolidation->thresholdRSRP, 36);
asn1cCallocOne(monr1->nrofSS_BlocksToAverage, 8);
monr1->smtc1 = calloc(1, sizeof(*monr1->smtc1));
monr1->smtc1->periodicityAndOffset = ssb_mtc->periodicityAndOffset;
monr1->smtc1->periodicityAndOffset.choice.sf20 = 2;
monr1->smtc1->duration = 1;
monr1->quantityConfigIndex = 1;
monr1->ext1 = calloc(1, sizeof(*monr1->ext1));
asn1cCallocOne(monr1->ext1->freqBandIndicatorNR, 257);
#if 0
if (neighbourConfiguration && measurementConfiguration->a3_event_list) {
for (uint8_t nCell = 0; nCell < neighbourConfiguration->size; nCell++) {
const nr_neighbour_gnb_configuration_t *neighbourCell =
(const nr_neighbour_gnb_configuration_t *)seq_arr_at(neighbourConfiguration, nCell);
if (!neighbourCell->isIntraFrequencyNeighbour)
continue;
if (monr1->cellsToAddModList == NULL) {
monr1->cellsToAddModList = calloc(1, sizeof(*monr1->cellsToAddModList));
}
NR_CellsToAddMod_t *cell = calloc(1, sizeof(*cell));
cell->physCellId = neighbourCell->physicalCellId;
ASN_SEQUENCE_ADD(&monr1->cellsToAddModList->list, cell);
}
}
#endif
mo1->measObject.choice.measObjectNR = monr1;
asn1cSeqAdd(&mc->measObjectToAddModList->list, mo1);
/* measReportConfig */
#if 0
/* periodic measurement (does not seem to work, UE reports similar values to b77 master cell, plus there is no fr2 cell running) */
NR_ReportConfigToAddMod_t *rc = calloc(1, sizeof(*rc));
rc->reportConfigId = 3;
rc->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR;
NR_PeriodicalReportConfig_t *prc = calloc(1, sizeof(*prc));
prc->rsType = NR_NR_RS_Type_ssb;
prc->reportInterval = NR_ReportInterval_ms1024;
prc->reportAmount = NR_PeriodicalReportConfig__reportAmount_infinity;
prc->reportQuantityCell.rsrp = true;
prc->reportQuantityCell.rsrq = true;
prc->reportQuantityCell.sinr = true;
prc->reportQuantityRS_Indexes = calloc(1, sizeof(*prc->reportQuantityRS_Indexes));
prc->reportQuantityRS_Indexes->rsrp = true;
prc->reportQuantityRS_Indexes->rsrq = true;
prc->reportQuantityRS_Indexes->sinr = true;
asn1cCallocOne(prc->maxNrofRS_IndexesToReport, 4);
prc->maxReportCells = 4;
prc->includeBeamMeasurements = 1;
NR_ReportConfigNR_t *rcnr = calloc(1, sizeof(*rcnr));
rcnr->reportType.present = NR_ReportConfigNR__reportType_PR_periodical;
rcnr->reportType.choice.periodical = prc;
rc->reportConfig.choice.reportConfigNR = rcnr;
asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc);
#endif
/* A4 event */
NR_ReportConfigToAddMod_t *rc_A4 = calloc(1, sizeof(*rc_A4));
rc_A4->reportConfigId = 3;
rc_A4->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR;
NR_EventTriggerConfig_t *etrc_A4 = calloc(1, sizeof(*etrc_A4));
etrc_A4->eventId.present = NR_EventTriggerConfig__eventId_PR_eventA4;
etrc_A4->eventId.choice.eventA4 = calloc(1, sizeof(*etrc_A4->eventId.choice.eventA4));
etrc_A4->eventId.choice.eventA4->a4_Threshold.present = NR_MeasTriggerQuantity_PR_rsrp;
etrc_A4->eventId.choice.eventA4->a4_Threshold.choice.rsrp = 20;
etrc_A4->eventId.choice.eventA4->reportOnLeave = true;
etrc_A4->eventId.choice.eventA4->hysteresis = 0;
etrc_A4->eventId.choice.eventA4->timeToTrigger = 1; // ms40
etrc_A4->rsType = NR_NR_RS_Type_ssb;
etrc_A4->reportInterval = NR_ReportInterval_ms120; //NR_ReportInterval_ms1024;
etrc_A4->reportAmount = NR_EventTriggerConfig__reportAmount_infinity;
etrc_A4->reportQuantityCell.rsrp = true;
etrc_A4->reportQuantityCell.rsrq = true;
etrc_A4->reportQuantityCell.sinr = true;
asn1cCallocOne(etrc_A4->maxNrofRS_IndexesToReport, 4);
etrc_A4->maxReportCells = 4;
etrc_A4->includeBeamMeasurements = false;
NR_ReportConfigNR_t *rcnr_A4 = calloc(1, sizeof(*rcnr_A4));
rcnr_A4->reportType.present = NR_ReportConfigNR__reportType_PR_eventTriggered;
rcnr_A4->reportType.choice.eventTriggered = etrc_A4;
rc_A4->reportConfig.choice.reportConfigNR = rcnr_A4;
asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc_A4);
/* measId */
NR_MeasIdToAddMod_t *measid = calloc(1, sizeof(NR_MeasIdToAddMod_t));
measid->measId = 3;
measid->reportConfigId = 3;
measid->measObjectId = 2;
asn1cSeqAdd(&mc->measIdToAddModList->list, measid);
}
mc->quantityConfig = calloc(1, sizeof(*mc->quantityConfig));
mc->quantityConfig->quantityConfigNR_List = calloc(1, sizeof(*mc->quantityConfig->quantityConfigNR_List));
NR_QuantityConfigNR_t *qcnr = calloc(1, sizeof(*qcnr));

View File

@@ -255,6 +255,8 @@ typedef struct gNB_RRC_UE_s {
/* Nas Pdu */
ngap_pdu_t nas_pdu;
int rsrp; // tmp for GNW
} gNB_RRC_UE_t;
typedef struct rrc_gNB_ue_context_s {
@@ -402,6 +404,8 @@ typedef struct gNB_RRC_INST_s {
RB_HEAD(rrc_cuup_tree, nr_rrc_cuup_container_t) cuups; // CU-UPs, indexed by assoc_id
size_t num_cuups;
int rsrp;
} gNB_RRC_INST;
#define UE_LOG_FMT "(cellID %lx, UE ID %d RNTI %04x)"

View File

@@ -1373,6 +1373,14 @@ static void rrc_gNB_process_MeasurementReport(gNB_RRC_UE_t *UE, NR_MeasurementRe
NR_MeasurementReport_IEs_t *measurementReport_IEs = measurementReport->criticalExtensions.choice.measurementReport;
const NR_MeasId_t measId = measurementReport_IEs->measResults.measId;
LOG_I(NR_RRC, "receive measurement ID %ld\n", measId);
if (measId == 3) {
//xer_fprint(stdout, &asn_DEF_NR_MeasurementReport, (void *)measurementReport);
if (measurementReport->criticalExtensions.choice.measurementReport->measResults.measResultNeighCells)
RC.nrrrc[0]->rsrp = *measurementReport->criticalExtensions.choice.measurementReport->measResults.measResultNeighCells->choice.measResultListNR->list.array[0]->measResult.cellResults.resultsSSB_Cell->rsrp - 156;
}
NR_MeasIdToAddMod_t *meas_id_s = NULL;
for (int meas_idx = 0; meas_idx < meas_config->measIdToAddModList->list.count; meas_idx++) {
if (measId == meas_config->measIdToAddModList->list.array[meas_idx]->measId) {