Skip to content

Commit a2d8049

Browse files
committed
sched: test retx cancellation
1 parent 01da77d commit a2d8049

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

lib/scheduler/ue_scheduling/cell_harq_manager.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ void cell_harq_repository<IsDl>::handle_ack(harq_type& h, bool ack)
176176
{
177177
if (not ack and h.nof_retxs >= h.max_nof_harq_retxs) {
178178
if (h.retxs_cancelled) {
179-
logger.info("rnti={} h_id={}: Discarding {} HARQ process TB with tbs={}. Cause: Retxs for this HARQ process were "
180-
"cancelled",
181-
h.rnti,
182-
h.h_id,
183-
IsDl ? "DL" : "UL",
184-
h.prev_tx_params.tbs_bytes);
179+
logger.debug("rnti={} h_id={}: Discarding {} HARQ process TB with tbs={}. Cause: Retxs for this HARQ process "
180+
"were cancelled",
181+
h.rnti,
182+
h.h_id,
183+
IsDl ? "DL" : "UL",
184+
h.prev_tx_params.tbs_bytes);
185185
} else {
186186
logger.info(
187187
"rnti={} h_id={}: Discarding {} HARQ process TB with tbs={}. Cause: Maximum number of reTxs {} exceeded",
@@ -465,6 +465,11 @@ void dl_harq_process_view::increment_pucch_counter()
465465
++fetch_impl().pucch_ack_to_receive;
466466
}
467467

468+
void dl_harq_process_view::cancel_retxs()
469+
{
470+
cell_harq_mng->dl.cancel_retxs(fetch_impl());
471+
}
472+
468473
void dl_harq_process_view::save_grant_params(const dl_harq_sched_context& ctx, const pdsch_information& pdsch)
469474
{
470475
srsran_assert(pdsch.codewords.size() == 1, "Only one codeword supported");
@@ -509,6 +514,11 @@ int ul_harq_process_view::ul_crc_info(bool ack)
509514
return cell_harq_mng->ul_crc_info(cell_harq_mng->ul.harqs[harq_ref_idx], ack);
510515
}
511516

517+
void ul_harq_process_view::cancel_retxs()
518+
{
519+
cell_harq_mng->ul.cancel_retxs(fetch_impl());
520+
}
521+
512522
void ul_harq_process_view::save_grant_params(const ul_harq_sched_context& ctx, const pusch_information& pusch)
513523
{
514524
ul_harq_process_impl& impl = fetch_impl();

lib/scheduler/ue_scheduling/cell_harq_manager.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ class dl_harq_process_view
291291

292292
void increment_pucch_counter();
293293

294+
void cancel_retxs();
295+
294296
/// \brief Stores grant parameters that are associated with the HARQ process (e.g. DCI format, PRBs, MCS) so that
295297
/// they can be later fetched and optionally reused.
296298
void save_grant_params(const dl_harq_sched_context& ctx, const pdsch_information& pdsch);
@@ -330,13 +332,19 @@ class ul_harq_process_view
330332

331333
bool is_waiting_ack() const { return fetch_impl().status == harq_utils::harq_state_t::waiting_ack; }
332334
bool has_pending_retx() const { return fetch_impl().status == harq_utils::harq_state_t::pending_retx; }
335+
bool empty() const
336+
{
337+
return harq_ref_idx == cell_harq_manager::INVALID_HARQ or fetch_impl().status == harq_utils::harq_state_t::empty;
338+
}
333339

334340
[[nodiscard]] bool new_retx(slot_point pusch_slot);
335341

336342
/// Update UL HARQ state given the received CRC indication.
337343
/// \return Transport Block size of the HARQ whose state was updated.
338344
int ul_crc_info(bool ack);
339345

346+
void cancel_retxs();
347+
340348
/// \brief Stores grant parameters that are associated with the HARQ process (e.g. DCI format, PRBs, MCS) so that
341349
/// they can be later fetched and optionally reused.
342350
void save_grant_params(const ul_harq_sched_context& ctx, const pusch_information& pdsch);

tests/unittests/scheduler/ue_scheduling/harq_manager_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,20 @@ TEST_F(single_harq_process_test, when_ack_wait_timeout_reached_then_harq_is_avai
413413
}
414414
}
415415

416+
TEST_F(single_harq_process_test, when_harq_retx_is_cancelled_then_harq_nack_empties_it)
417+
{
418+
h_dl.cancel_retxs();
419+
h_ul.cancel_retxs();
420+
ASSERT_TRUE(h_dl.is_waiting_ack());
421+
ASSERT_TRUE(h_ul.is_waiting_ack());
422+
423+
ASSERT_EQ(h_dl.dl_ack_info(mac_harq_ack_report_status::nack, std::nullopt),
424+
dl_harq_process_view::status_update::nacked);
425+
ASSERT_EQ(h_ul.ul_crc_info(false), 0);
426+
ASSERT_TRUE(h_dl.empty());
427+
ASSERT_TRUE(h_ul.empty());
428+
}
429+
416430
// DL HARQ process with multi PUCCH test
417431

418432
TEST_F(dl_harq_process_multi_pucch_test, when_dtx_received_after_ack_then_dtx_is_ignored)

0 commit comments

Comments
 (0)