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.
This commit is contained in:
Jan Fromme
2025-09-19 09:18:30 +02:00
committed by francescomani
parent e5ea77f629
commit b462fa45e8
+13 -12
View File
@@ -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;
}