From b462fa45e81dcc17c3de966c3e3558108126fc68 Mon Sep 17 00:00:00 2001 From: Jan Fromme Date: Thu, 14 Aug 2025 12:29:12 +0200 Subject: [PATCH] Fix RSRP report unpacking logic in gNB scheduler UCI Correctly handle unpacking of the first RSRP report and its resource ID before processing additional reports. Use the initial RSRP value as the reference for differential RSRP calculations in subsequent reports. --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 682ea765ac..7edbf95600 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -588,28 +588,29 @@ static void evaluate_rsrp_report(gNB_MAC_INST *nrmac, } rsrp_report->nr_reports = csi_report->CSI_report_bitlen.nb_ssbri_cri; - uint16_t curr_payload; - for (int i = 0; i < rsrp_report->nr_reports; i++) { - int bitlen = csi_report->CSI_report_bitlen.cri_ssbri_bitlen; - curr_payload = pickandreverse_bits(payload, bitlen, *cumul_bits); - rsrp_report->resource_id[i] = *(index_list[bitlen > 0 ? ((curr_payload) & ~(~1U << (bitlen - 1))) : bitlen]); - LOG_D(MAC,"SSB/CSI-RS index = %d\n", rsrp_report->resource_id[i]); - *cumul_bits += bitlen; - } + int bitlen = csi_report->CSI_report_bitlen.cri_ssbri_bitlen; + uint8_t curr_payload = pickandreverse_bits(payload, bitlen, *cumul_bits); + rsrp_report->resource_id[0] = *(index_list[bitlen > 0 ? ((curr_payload) & ~(~1U << (bitlen - 1))) : bitlen]); + LOG_D(NR_MAC, "SSB/CSI-RS index = %d\n", rsrp_report->resource_id[0]); + *cumul_bits += bitlen; curr_payload = pickandreverse_bits(payload, 7, *cumul_bits); - int rsrp_index = curr_payload & 0x7f; + int rsrp = curr_payload & 0x7f; *cumul_bits += 7; - csi_report->nb_of_csi_ssb_report++; - bool valid = get_measured_rsrp(rsrp_index, &rsrp_report->RSRP[0]); + bool valid = get_measured_rsrp(rsrp, &rsrp_report->RSRP[0]); if (!valid) { - LOG_E(NR_MAC, "UE %04x: reported RSRP index %d invalid\n", UE->rnti, rsrp_index); + LOG_E(NR_MAC, "UE %04x: reported RSRP index %d invalid\n", UE->rnti, rsrp); return; } for (int i = 1; i < rsrp_report->nr_reports; i++) { + curr_payload = pickandreverse_bits(payload, bitlen, *cumul_bits); + rsrp_report->resource_id[i] = *(index_list[bitlen > 0 ? ((curr_payload) & ~(~1U << (bitlen - 1))) : bitlen]); + *cumul_bits += bitlen; + curr_payload = pickandreverse_bits(payload, 4, *cumul_bits); + csi_report->nb_of_csi_ssb_report++; rsrp_report->RSRP[i] = get_diff_rsrp(curr_payload & 0x0f, rsrp_report->RSRP[0]); *cumul_bits += 4; }