Skip to content

Commit fb48b39

Browse files
committed
sched: extend NTN HARQ unit tests
1 parent 926ce0d commit fb48b39

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

lib/scheduler/cell/cell_harq_manager.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ class base_ntn_harq_history
6262
}
6363
}
6464

65+
void handle_ack(harq_impl_type& h)
66+
{
67+
auto& hist_entry = history[get_offset_index(h.slot_ack)];
68+
if (&h < hist_entry.data() or &h >= hist_entry.data() + hist_entry.size()) {
69+
// Check if the HARQ Process being ACKed is the same as the one managed by the NTN history.
70+
srsran_assertion_failure("ACK Info handled for a non-NTN HARQ process");
71+
srslog::fetch_basic_logger("SCHED").error("ACK Info handled for a non-NTN HARQ process");
72+
return;
73+
}
74+
h.status = harq_state_t::empty;
75+
}
76+
6577
protected:
6678
unsigned get_current_index(slot_point sl) const { return mod(sl.to_uint()); }
6779
unsigned get_offset_index(slot_point sl) const { return get_current_index(sl + ntn_cs_koffset); }
@@ -320,6 +332,7 @@ void cell_harq_repository<IsDl>::handle_ack(harq_type& h, bool ack)
320332

321333
if (is_ntn_mode()) {
322334
// In NTN mode, ACK info does not affect the timeout/retx containers.
335+
alloc_hist->handle_ack(h);
323336
return;
324337
}
325338

lib/scheduler/cell/cell_harq_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ class cell_harq_manager
402402
unsigned nof_dl_harq_procs = MAX_NOF_HARQS,
403403
unsigned nof_ul_harq_procs = MAX_NOF_HARQS);
404404

405-
/// Checks whether an UE with the provided ue index exists.
405+
/// Checks whether a UE with the provided ue index exists.
406406
bool contains(du_ue_index_t ue_idx) const;
407407

408408
/// Retrieve list of HARQ processes with pending retxs.

tests/unittests/scheduler/cell/cell_harq_manager_test.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,4 +1064,24 @@ TEST_F(single_ntn_ue_harq_process_test, harq_history_is_reachable_after_timeout)
10641064
ASSERT_EQ(h_ul.get_grant_params().tbs_bytes, pusch_info.tb_size_bytes);
10651065

10661066
ASSERT_EQ(h_ul.get_grant_params().tbs_bytes, harq_ent.total_ul_bytes_waiting_crc());
1067+
}
1068+
1069+
TEST_F(single_ntn_ue_harq_process_test, when_harq_gets_acked_then_it_reports_the_correct_tbs)
1070+
{
1071+
slot_point pusch_slot = current_slot + k2;
1072+
slot_point uci_slot = current_slot + k1;
1073+
slot_point slot_timeout = std::max(pusch_slot, uci_slot) + 1;
1074+
while (current_slot != slot_timeout) {
1075+
run_slot();
1076+
}
1077+
1078+
h_ul = harq_ent.find_ul_harq(pusch_slot).value();
1079+
ASSERT_EQ(harq_ent.total_ul_bytes_waiting_crc(), pusch_info.tb_size_bytes);
1080+
ASSERT_EQ(h_ul.ul_crc_info(true), pusch_info.tb_size_bytes);
1081+
ASSERT_EQ(harq_ent.total_ul_bytes_waiting_crc(), 0);
1082+
1083+
h_dl = harq_ent.find_dl_harq(uci_slot, 0).value();
1084+
ASSERT_EQ(h_dl.dl_ack_info(mac_harq_ack_report_status::ack, std::nullopt),
1085+
dl_harq_process_handle::status_update::acked);
1086+
ASSERT_EQ(h_dl.get_grant_params().tbs_bytes, pdsch_info.codewords[0].tb_size_bytes);
10671087
}

0 commit comments

Comments
 (0)