From 7badfb1c881ed254772bcd8321813405342ab6cf Mon Sep 17 00:00:00 2001 From: Francisco Date: Fri, 4 Jun 2021 11:41:35 +0100 Subject: [PATCH] bugfix: avoid multiple TPC=0 for a single PHR<0 --- srsenb/hdr/stack/mac/sched_ue_ctrl/tpc.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/srsenb/hdr/stack/mac/sched_ue_ctrl/tpc.h b/srsenb/hdr/stack/mac/sched_ue_ctrl/tpc.h index fa3a9424c..379c87c5f 100644 --- a/srsenb/hdr/stack/mac/sched_ue_ctrl/tpc.h +++ b/srsenb/hdr/stack/mac/sched_ue_ctrl/tpc.h @@ -165,16 +165,17 @@ private: assert(ch_snr.pending_delta == 0); // ensure called once per {cc,tti} float target_snr_dB = cc == PUSCH_CODE ? target_pusch_snr_dB : target_pucch_snr_dB; - if (target_snr_dB < 0 or last_phr == 0) { - // undefined target sinr case, or no more PHR - return encode_tpc_delta(0); - } - if (last_phr < 0) { + if (last_phr < 0 and not ch_snr.phr_flag) { // negative PHR logger.info( "TPC: rnti=0x%x, %s command=-1 due to PHR=%d < 0", rnti, cc == PUSCH_CODE ? "PUSCH" : "PUCCH", last_phr); + ch_snr.phr_flag = true; return encode_tpc_delta(-1); } + if (target_snr_dB < 0 or last_phr <= 0) { + // undefined target sinr case, or no more PHR + return encode_tpc_delta(0); + } if ((tti_count - ch_snr.last_tpc_tti_count) < min_tpc_tti_interval) { // more time required before sending next TPC return encode_tpc_delta(0);