diff --git a/lib/src/phy/phch/harq_ack.c b/lib/src/phy/phch/harq_ack.c index bd99cd1da..f53c52f70 100644 --- a/lib/src/phy/phch/harq_ack.c +++ b/lib/src/phy/phch/harq_ack.c @@ -290,6 +290,11 @@ int srsran_harq_ack_insert_m(srsran_pdsch_ack_nr_t* ack_info, const srsran_harq_ } srsran_harq_ack_cc_t* cc = &ack_info->cc[m->resource.scell_idx]; + if (cc->M >= SRSRAN_UCI_NR_MAX_M) { + ERROR("Accumulated M HARQ feedback exceeds maximum (%d)", SRSRAN_UCI_NR_MAX_M); + return SRSRAN_ERROR; + } + // Find insertion index uint32_t idx = cc->M; // Append at the end by default for (uint32_t i = 0; i < cc->M; i++) { @@ -303,7 +308,7 @@ int srsran_harq_ack_insert_m(srsran_pdsch_ack_nr_t* ack_info, const srsran_harq_ cc->M += 1; // Make space for insertion - for (uint32_t i = cc->M - 1; i > idx; i--) { + for (uint32_t i = cc->M - 1; i != idx; i--) { cc->m[i] = cc->m[i - 1]; } diff --git a/lib/src/phy/phch/ra_ul_nr.c b/lib/src/phy/phch/ra_ul_nr.c index 23ce7226e..d8159b87d 100644 --- a/lib/src/phy/phch/ra_ul_nr.c +++ b/lib/src/phy/phch/ra_ul_nr.c @@ -499,7 +499,7 @@ static int ra_ul_nr_pucch_resource_hl(const srsran_pucch_nr_hl_cfg_t* cfg, } else if (O_uci <= N3 && cfg->sets[2].nof_resources > 0) { resource_set_id = 2; } else if (cfg->sets[3].nof_resources == 0) { - ERROR("Invalid PUCCH resource configuration, N3=%d, O_uci=%d", N3, O_uci); + ERROR("Invalid PUCCH resource configuration, N2=%d, N3=%d, O_uci=%d", N2, N3, O_uci); return SRSRAN_ERROR; } else if (O_uci > SRSRAN_UCI_NR_MAX_NOF_BITS) { ERROR("The number of UCI bits (%d), exceeds the maximum (%d)", O_uci, SRSRAN_UCI_NR_MAX_NOF_BITS); diff --git a/srsue/hdr/phy/nr/state.h b/srsue/hdr/phy/nr/state.h index fed29376a..5c7d09f36 100644 --- a/srsue/hdr/phy/nr/state.h +++ b/srsue/hdr/phy/nr/state.h @@ -251,7 +251,7 @@ public: // Insert PDSCH transmission information if (srsran_harq_ack_insert_m(&ack, &ack_m) < SRSRAN_SUCCESS) { - ERROR("Error inserting ACK m value"); + ERROR("Error inserting ACK m value for Tx slot %d", tti_tx); } } diff --git a/srsue/src/phy/nr/cc_worker.cc b/srsue/src/phy/nr/cc_worker.cc index bbdea7910..6bf70fcb4 100644 --- a/srsue/src/phy/nr/cc_worker.cc +++ b/srsue/src/phy/nr/cc_worker.cc @@ -529,20 +529,29 @@ bool cc_worker::work_dl() bool cc_worker::work_ul() { + // Gather PDSCH ACK information independently if UL/DL + // If a HARQ ACK Feedback needs to be transmitted in this slot and it is NOT an UL slot, the accumulated HARQ feedback + // for this slot will be flushed + srsran_pdsch_ack_nr_t pdsch_ack = {}; + bool has_ul_ack = phy.get_pending_ack(ul_slot_cfg.idx, pdsch_ack); + // Check if it is a UL slot, if not skip if (!srsran_tdd_nr_is_ul(&phy.cfg.tdd, 0, ul_slot_cfg.idx)) { // No NR signal shall be transmitted srsran_vec_cf_zero(tx_buffer[0], ue_ul.ifft.sf_sz); + + // Check if there is any pending ACK for this DL slot... + if (pdsch_ack.nof_cc > 1) { + // ... in this case log a warning to inform about miss-configuration + logger.warning("Detected HARQ feedback on DL slot"); + } + return true; } srsran_uci_data_nr_t uci_data = {}; uint32_t pid = 0; - // Gather PDSCH ACK information - srsran_pdsch_ack_nr_t pdsch_ack = {}; - bool has_ul_ack = phy.get_pending_ack(ul_slot_cfg.idx, pdsch_ack); - // Request grant to PHY state for this transmit TTI srsran_sch_cfg_nr_t pusch_cfg = {}; bool has_pusch_grant = phy.get_ul_pending_grant(ul_slot_cfg.idx, pusch_cfg, pid);