From 98c309ffe3a510d8c98d3b6c8bce9a4470efd2a7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 27 Feb 2024 18:52:07 +0100 Subject: [PATCH] Refactor nr_decode_pucch0() to not rely on uci_stats the uci_stats variable (pointing to per-UE statistics for UCI) is used in function nr_decode_pucch0() to store information which is important beyond statistics, e.g., uci_stats->pucch0_thres as a threshold (which comes from somewhere else) This commit refactors to use original or intermediate variables to not mix uci_stats usage with actual processing. Also, group uci_stats a bit more. --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 35b5b1be3d..4ef42119bf 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -348,9 +348,14 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, #endif index=maxpos; - uci_stats->pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]]; - uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; - LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); + int pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]]; + int pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; + LOG_D(PHY, "n00[%d] = %d, n01[%d] = %d\n", prb_offset[0], pucch0_n00, prb_offset[1], pucch0_n01); + + uci_stats->pucch0_n00 = pucch0_n00; + uci_stats->pucch0_n01 = pucch0_n01; + uci_stats->pucch0_thres = gNB->pucch0_thres; + // estimate CQI for MAC (from antenna port 0 only) int max_n0 = max(gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]], gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]); @@ -363,7 +368,6 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, else cqi = (640 + SNRtimes10) / 5; - uci_stats->pucch0_thres = gNB->pucch0_thres; /* + (10*max_n0);*/ bool no_conf=false; if (nr_sequences>1) { if (/*xrtmag_dBtimes10 < (30+xrtmag_next_dBtimes10) ||*/ SNRtimes10 < gNB->pucch0_thres) { @@ -372,7 +376,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, "%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n", frame, slot, - uci_stats->pucch0_thres, + gNB->pucch0_thres, SNRtimes10, xrtmag_dBtimes10, xrtmag_next_dBtimes10); @@ -388,7 +392,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->rssi = 1280 - (10 * dB_fixed(32767 * 32767)) - dB_fixed_times10(signal_energy_ant0); if (pucch_pdu->bit_len_harq==0) { - uci_pdu->sr.sr_confidence_level = SNRtimes10 < uci_stats->pucch0_thres; + uci_pdu->sr.sr_confidence_level = SNRtimes10 < gNB->pucch0_thres; uci_stats->pucch0_sr_trials++; if (xrtmag_dBtimes10>(10*max_n0+100)) { uci_pdu->sr.sr_indication = 1; @@ -415,9 +419,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, xrtmag_next_dBtimes10, pucch_power_dBtimes10, max_n0, - uci_stats->pucch0_n00, - uci_stats->pucch0_n01, - uci_stats->pucch0_thres, + pucch0_n00, + pucch0_n01, + gNB->pucch0_thres, cqi, SNRtimes10, 10 * log10((double)signal_energy_ant0)); @@ -450,9 +454,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, xrtmag_next_dBtimes10, pucch_power_dBtimes10, max_n0, - uci_stats->pucch0_n00, - uci_stats->pucch0_n01, - uci_stats->pucch0_thres, + pucch0_n00, + pucch0_n01, + gNB->pucch0_thres, cqi, SNRtimes10); if (pucch_pdu->sr_flag == 1) {