Skip to content

Commit 01da77d

Browse files
committed
sched: log rnti in harq manager and improve tests
1 parent 22abff4 commit 01da77d

File tree

3 files changed

+203
-217
lines changed

3 files changed

+203
-217
lines changed

lib/scheduler/ue_scheduling/cell_harq_manager.cpp

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@ void cell_harq_repository<IsDl>::handle_harq_ack_timeout(harq_type& h, slot_poin
7070
// Only in non-NTN case, we log a warning.
7171
if (h.ack_on_timeout) {
7272
// Case: Not all HARQ-ACKs were received, but at least one positive ACK was received.
73-
logger.debug("ue={} h_id={}: Setting {} HARQ to \"ACKed\" state. Cause: HARQ-ACK wait timeout ({} slots) was "
73+
logger.debug("rnti={} h_id={}: Setting {} HARQ to \"ACKed\" state. Cause: HARQ-ACK wait timeout ({} slots) was "
7474
"reached with still missing PUCCH HARQ-ACKs. However, one positive ACK was received.",
75-
h.ue_idx,
75+
h.rnti,
7676
h.h_id,
7777
IsDl ? "DL" : "UL",
7878
h.slot_ack_timeout - h.slot_ack);
7979
} else {
8080
// At least one of the expected ACKs went missing and we haven't received any positive ACK.
81-
logger.warning(
82-
"ue={} h_id={}: Discarding {} HARQ. Cause: HARQ-ACK wait timeout ({} slots) was reached, but there are still "
83-
"missing HARQ-ACKs and none of the received ones are positive.",
84-
h.ue_idx,
85-
h.h_id,
86-
IsDl ? "DL" : "UL",
87-
h.slot_ack_timeout - h.slot_ack);
81+
logger.warning("rnti={} h_id={}: Discarding {} HARQ. Cause: HARQ-ACK wait timeout ({} slots) was reached, but "
82+
"there are still "
83+
"missing HARQ-ACKs and none of the received ones are positive.",
84+
h.rnti,
85+
h.h_id,
86+
IsDl ? "DL" : "UL",
87+
h.slot_ack_timeout - h.slot_ack);
8888
}
8989

9090
// Report timeout with NACK.
@@ -103,6 +103,7 @@ unsigned cell_harq_repository<IsDl>::get_harq_ref_idx(const harq_type& h) const
103103

104104
template <bool IsDl>
105105
typename cell_harq_repository<IsDl>::harq_type* cell_harq_repository<IsDl>::alloc_harq(du_ue_index_t ue_idx,
106+
rnti_t rnti,
106107
slot_point sl_tx,
107108
slot_point sl_ack,
108109
unsigned max_nof_harq_retxs)
@@ -124,6 +125,7 @@ typename cell_harq_repository<IsDl>::harq_type* cell_harq_repository<IsDl>::allo
124125

125126
// Set allocated HARQ common params.
126127
h.ue_idx = ue_idx;
128+
h.rnti = rnti;
127129
h.h_id = h_id;
128130
h.status = harq_state_t::waiting_ack;
129131
h.slot_tx = sl_tx;
@@ -174,16 +176,16 @@ void cell_harq_repository<IsDl>::handle_ack(harq_type& h, bool ack)
174176
{
175177
if (not ack and h.nof_retxs >= h.max_nof_harq_retxs) {
176178
if (h.retxs_cancelled) {
177-
logger.info(
178-
"ue={} h_id={}: Discarding {} HARQ process TB with tbs={}. Cause: Retxs for this HARQ process were cancelled",
179-
h.ue_idx,
180-
h.h_id,
181-
IsDl ? "DL" : "UL",
182-
h.prev_tx_params.tbs_bytes);
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);
183185
} else {
184186
logger.info(
185-
"ue={} h_id={}: Discarding {} HARQ process TB with tbs={}. Cause: Maximum number of reTxs {} exceeded",
186-
h.ue_idx,
187+
"rnti={} h_id={}: Discarding {} HARQ process TB with tbs={}. Cause: Maximum number of reTxs {} exceeded",
188+
h.rnti,
187189
h.h_id,
188190
IsDl ? "DL" : "UL",
189191
h.prev_tx_params.tbs_bytes,
@@ -223,7 +225,7 @@ template <bool IsDl>
223225
bool cell_harq_repository<IsDl>::handle_new_retx(harq_type& h, slot_point sl_tx, slot_point sl_ack)
224226
{
225227
if (h.status != harq_state_t::pending_retx) {
226-
logger.warning("ue={} h_id={}: Attempt of retx in a HARQ process that has no pending retx", h.ue_idx, h.h_id);
228+
logger.warning("rnti={} h_id={}: Attempt of retx in a HARQ process that has no pending retx", h.rnti, h.h_id);
227229
return false;
228230
}
229231

@@ -338,12 +340,13 @@ void cell_harq_manager::destroy_ue(du_ue_index_t ue_idx)
338340
}
339341

340342
harq_utils::dl_harq_process_impl* cell_harq_manager::new_dl_tx(du_ue_index_t ue_idx,
343+
rnti_t rnti,
341344
slot_point pdsch_slot,
342345
unsigned k1,
343346
unsigned max_harq_nof_retxs,
344347
uint8_t harq_bit_idx)
345348
{
346-
dl_harq_process_impl* h = dl.alloc_harq(ue_idx, pdsch_slot, pdsch_slot + k1, max_harq_nof_retxs);
349+
dl_harq_process_impl* h = dl.alloc_harq(ue_idx, rnti, pdsch_slot, pdsch_slot + k1, max_harq_nof_retxs);
347350
if (h == nullptr) {
348351
return nullptr;
349352
}
@@ -359,9 +362,9 @@ harq_utils::dl_harq_process_impl* cell_harq_manager::new_dl_tx(du_ue_index_t ue_
359362
}
360363

361364
harq_utils::ul_harq_process_impl*
362-
cell_harq_manager::new_ul_tx(du_ue_index_t ue_idx, slot_point pusch_slot, unsigned max_harq_nof_retxs)
365+
cell_harq_manager::new_ul_tx(du_ue_index_t ue_idx, rnti_t rnti, slot_point pusch_slot, unsigned max_harq_nof_retxs)
363366
{
364-
ul_harq_process_impl* h = ul.alloc_harq(ue_idx, pusch_slot, pusch_slot, max_harq_nof_retxs);
367+
ul_harq_process_impl* h = ul.alloc_harq(ue_idx, rnti, pusch_slot, pusch_slot, max_harq_nof_retxs);
365368
if (h == nullptr) {
366369
return nullptr;
367370
}
@@ -400,7 +403,7 @@ dl_harq_process_impl::status_update cell_harq_manager::dl_ack_info(harq_utils::d
400403

401404
if (h.status != harq_state_t::waiting_ack) {
402405
// If the HARQ process is not expecting an HARQ-ACK, it means that it has already been ACKed/NACKed.
403-
logger.warning("ue={} h_id={}: ACK arrived for inactive DL HARQ", h.ue_idx, h.h_id);
406+
logger.warning("rnti={} h_id={}: ACK arrived for inactive DL HARQ", h.rnti, h.h_id);
404407
return status_update::error;
405408
}
406409

@@ -437,7 +440,7 @@ int cell_harq_manager::ul_crc_info(harq_utils::ul_harq_process_impl& h, bool ack
437440
{
438441
if (h.status != harq_state_t::waiting_ack) {
439442
// HARQ is not expecting CRC info.
440-
logger.warning("ue={} h_id={}: CRC arrived for UL HARQ not expecting it", h.ue_idx, h.h_id);
443+
logger.warning("rnti={} h_id={}: CRC arrived for UL HARQ not expecting it", h.rnti, h.h_id);
441444
return -1;
442445
}
443446

@@ -533,6 +536,11 @@ void ul_harq_process_view::save_grant_params(const ul_harq_sched_context& ctx, c
533536

534537
// UE HARQ entity.
535538

539+
unique_ue_harq_entity::unique_ue_harq_entity(cell_harq_manager* mgr, du_ue_index_t ue_idx, rnti_t crnti_) :
540+
cell_harq_mgr(mgr), ue_index(ue_idx), crnti(crnti_)
541+
{
542+
}
543+
536544
unique_ue_harq_entity::unique_ue_harq_entity(unique_ue_harq_entity&& other) noexcept :
537545
cell_harq_mgr(other.cell_harq_mgr), ue_index(other.ue_index)
538546
{
@@ -570,7 +578,7 @@ void unique_ue_harq_entity::reset()
570578
std::optional<dl_harq_process_view>
571579
unique_ue_harq_entity::alloc_dl_harq(slot_point sl_tx, unsigned k1, unsigned max_harq_nof_retxs, unsigned harq_bit_idx)
572580
{
573-
dl_harq_process_impl* h = cell_harq_mgr->new_dl_tx(ue_index, sl_tx, k1, max_harq_nof_retxs, harq_bit_idx);
581+
dl_harq_process_impl* h = cell_harq_mgr->new_dl_tx(ue_index, crnti, sl_tx, k1, max_harq_nof_retxs, harq_bit_idx);
574582
if (h == nullptr) {
575583
return std::nullopt;
576584
}
@@ -579,7 +587,7 @@ unique_ue_harq_entity::alloc_dl_harq(slot_point sl_tx, unsigned k1, unsigned max
579587

580588
std::optional<ul_harq_process_view> unique_ue_harq_entity::alloc_ul_harq(slot_point sl_tx, unsigned max_harq_nof_retxs)
581589
{
582-
ul_harq_process_impl* h = cell_harq_mgr->new_ul_tx(ue_index, sl_tx, max_harq_nof_retxs);
590+
ul_harq_process_impl* h = cell_harq_mgr->new_ul_tx(ue_index, crnti, sl_tx, max_harq_nof_retxs);
583591
if (h == nullptr) {
584592
return std::nullopt;
585593
}

lib/scheduler/ue_scheduling/cell_harq_manager.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ enum class harq_state_t { empty, pending_retx, waiting_ack };
5050
/// Parameters that are common to DL and UL HARQ processes.
5151
struct base_harq_process : public intrusive_double_linked_list_element<> {
5252
du_ue_index_t ue_idx;
53+
rnti_t rnti;
5354
harq_id_t h_id;
5455
harq_state_t status = harq_state_t::empty;
5556
slot_point slot_tx;
@@ -146,12 +147,13 @@ struct cell_harq_repository {
146147

147148
unsigned get_harq_ref_idx(const harq_type& h) const;
148149

149-
void slot_indication(slot_point sl_tx);
150-
void handle_harq_ack_timeout(harq_type& h, slot_point sl_tx);
151-
harq_type* alloc_harq(du_ue_index_t ue_idx, slot_point sl_tx, slot_point sl_ack, unsigned max_nof_harq_retxs);
152-
void dealloc_harq(harq_type& h);
153-
void handle_ack(harq_type& h, bool ack);
154-
void set_pending_retx(harq_type& h);
150+
void slot_indication(slot_point sl_tx);
151+
void handle_harq_ack_timeout(harq_type& h, slot_point sl_tx);
152+
harq_type*
153+
alloc_harq(du_ue_index_t ue_idx, rnti_t rnti, slot_point sl_tx, slot_point sl_ack, unsigned max_nof_harq_retxs);
154+
void dealloc_harq(harq_type& h);
155+
void handle_ack(harq_type& h, bool ack);
156+
void set_pending_retx(harq_type& h);
155157
[[nodiscard]] bool handle_new_retx(harq_type& h, slot_point sl_tx, slot_point sl_ack);
156158
void reserve_ue_harqs(du_ue_index_t ue_idx, unsigned nof_harqs);
157159
void destroy_ue_harqs(du_ue_index_t ue_idx);
@@ -224,13 +226,15 @@ class cell_harq_manager
224226

225227
/// \brief Called on every DL new Tx to allocate an DL HARQ process.
226228
harq_utils::dl_harq_process_impl* new_dl_tx(du_ue_index_t ue_idx,
229+
rnti_t rnti,
227230
slot_point pdsch_slot,
228231
unsigned k1,
229232
unsigned max_harq_nof_retxs,
230233
uint8_t harq_bit_idx);
231234

232235
/// \brief Called on every UL new Tx to allocate an UL HARQ process.
233-
harq_utils::ul_harq_process_impl* new_ul_tx(du_ue_index_t ue_idx, slot_point pusch_slot, unsigned max_harq_nof_retxs);
236+
harq_utils::ul_harq_process_impl*
237+
new_ul_tx(du_ue_index_t ue_idx, rnti_t rnti, slot_point pusch_slot, unsigned max_harq_nof_retxs);
234238

235239
/// \brief Called on a new retx of a DL HARQ process.
236240
[[nodiscard]] bool
@@ -360,11 +364,7 @@ class unique_ue_harq_entity
360364
{
361365
public:
362366
unique_ue_harq_entity() = default;
363-
unique_ue_harq_entity(cell_harq_manager* mgr, du_ue_index_t ue_idx, rnti_t crnti_) :
364-
cell_harq_mgr(mgr), ue_index(ue_idx), crnti(crnti_)
365-
{
366-
(void)crnti;
367-
}
367+
unique_ue_harq_entity(cell_harq_manager* mgr, du_ue_index_t ue_idx, rnti_t crnti_);
368368
~unique_ue_harq_entity();
369369
unique_ue_harq_entity(const unique_ue_harq_entity&) = delete;
370370
unique_ue_harq_entity(unique_ue_harq_entity&& other) noexcept;

0 commit comments

Comments
 (0)