diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 00201cdd8d..1b317890ae 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -414,6 +414,25 @@ static void handle_dl_harq(NR_UE_info_t * UE, } } +// Referred Table 10.1.16.1-1 in 38.133 V16.7.0. +static int get_measured_sinr(int index) +{ + if (index < 0 || index > 127) + return INT_MAX; + + return -235 + index * 5; +} + +// Referred Table 10.1.16.1-2 in 38.133 V16.7.0. +static int get_diff_sinr(int index, int best_SINRx10) +{ + if (index <= 0) + return best_SINRx10; + if (index >= 15) + return best_SINRx10 - 150; + return best_SINRx10 - index * 10; +} + //returns the measured RSRP value (upper limit) static bool get_measured_rsrp(uint8_t index, int *rsrp) { @@ -498,22 +517,24 @@ static void evaluate_sinr_report(gNB_MAC_INST *nrmac, } curr_payload = pickandreverse_bits(payload, 7, *cumul_bits); - sinr_report->SINR_index[0] = curr_payload & 0x7f; + int sinr_index = curr_payload & 0x7f; *cumul_bits += 7; csi_report->nb_of_csi_ssb_report++; - if (sinr_report->SINR_index[0] < 0 || sinr_report->SINR_index[0] > 127) { - LOG_E(NR_MAC, "UE %04x: reported SINR index %d invalid\n", UE->rnti, sinr_report->SINR_index[0]); + int SINRx10 = get_measured_sinr(sinr_index); + if (SINRx10 == INT_MAX) { + LOG_E(NR_MAC, "UE %04x: reported SINR index %d invalid\n", UE->rnti, sinr_index); return; } + sinr_report->SINRx10[0] = SINRx10; for (int i = 1; i < sinr_report->nr_reports; i++) { curr_payload = pickandreverse_bits(payload, 4, *cumul_bits); - sinr_report->SINR_index[i] = curr_payload & 0x0f; + sinr_report->SINRx10[i] = get_diff_sinr(curr_payload & 0x0f, sinr_report->SINRx10[0]); *cumul_bits += 4; } - LOG_D(MAC, "Reported SSB-SINR index = %d\n", sinr_report->SINR_index[0]); + LOG_D(MAC, "Reported SSB-SINR = %d.%d\n", sinr_report->SINRx10[0] / 10, sinr_report->SINRx10[0] % 10); } static void evaluate_rsrp_report(gNB_MAC_INST *nrmac, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 2627c9162b..db12640893 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -521,8 +521,7 @@ typedef struct RSRP_report { uint8_t nr_reports; uint8_t resource_id[MAX_NR_OF_REPORTED_RS]; int RSRP[MAX_NR_OF_REPORTED_RS]; - // SINR index according to tables 10.1.16.1-1, 10.1.16.1-2 - int SINR_index[MAX_NR_OF_REPORTED_RS]; + int SINRx10[MAX_NR_OF_REPORTED_RS]; } RSRP_report_t; struct CSI_Report {