@@ -170,20 +170,24 @@ class base_harq_process_handle
170170 base_harq_process_handle () = default ;
171171 base_harq_process_handle (harq_pool& pool_, harq_impl_type& h_) : harq_repo(&pool_), impl(&h_) {}
172172
173- rnti_t rnti () const { return impl->rnti ; }
174- harq_id_t id () const { return impl->h_id ; }
175- bool is_waiting_ack () const { return impl->status == harq_utils::harq_state_t ::waiting_ack; }
176- bool has_pending_retx () const { return impl->status == harq_utils::harq_state_t ::pending_retx; }
177- bool empty () const { return impl->status == harq_utils::harq_state_t ::empty; }
178- unsigned max_nof_retxs () const { return impl->max_nof_harq_retxs ; }
179- unsigned nof_retxs () const { return impl->nof_retxs ; }
180- bool ndi () const { return impl->ndi ; }
173+ du_ue_index_t ue_index () const { return impl->ue_idx ; }
174+ rnti_t rnti () const { return impl->rnti ; }
175+ harq_id_t id () const { return impl->h_id ; }
176+ bool is_waiting_ack () const { return impl->status == harq_utils::harq_state_t ::waiting_ack; }
177+ bool has_pending_retx () const { return impl->status == harq_utils::harq_state_t ::pending_retx; }
178+ bool empty () const { return impl->status == harq_utils::harq_state_t ::empty; }
179+ unsigned max_nof_retxs () const { return impl->max_nof_harq_retxs ; }
180+ unsigned nof_retxs () const { return impl->nof_retxs ; }
181+ bool ndi () const { return impl->ndi ; }
181182
182183 // / \brief Cancels any retransmissions for this HARQ process.
183184 // / If the HARQ process has a pending retransmission, it is reset. If the ACK/CRC info has not been received yet, the
184185 // / HARQ process waits for it to arrive before being reset.
185186 void cancel_retxs ();
186187
188+ // / Empty the HARQ process.
189+ void reset ();
190+
187191 bool operator ==(const base_harq_process_handle& other) const
188192 {
189193 return harq_repo == other.harq_repo and impl == other.impl ;
@@ -198,7 +202,7 @@ class base_harq_process_handle
198202} // namespace harq_utils
199203
200204// / \brief Context of the scheduler during the current PDSCH allocation.
201- struct dl_harq_sched_context {
205+ struct dl_harq_alloc_context {
202206 // / DCI format used to signal the PDSCH allocation.
203207 dci_dl_rnti_config_type dci_cfg_type;
204208 // / MCS suggested by the OLLA.
@@ -212,7 +216,7 @@ struct dl_harq_sched_context {
212216};
213217
214218// / \brief Context of the scheduler during the current PUSCH allocation.
215- struct ul_harq_sched_context {
219+ struct ul_harq_alloc_context {
216220 // / DCI format used to signal the PUSCH allocation.
217221 dci_ul_rnti_config_type dci_cfg_type;
218222 // / MCS suggested by the OLLA.
@@ -261,7 +265,7 @@ class dl_harq_process_handle : public harq_utils::base_harq_process_handle<true>
261265
262266 // / \brief Stores grant parameters that are associated with the HARQ process (e.g. DCI format, PRBs, MCS) so that
263267 // / they can be later fetched and optionally reused.
264- void save_grant_params (const dl_harq_sched_context & ctx, const pdsch_information& pdsch);
268+ void save_grant_params (const dl_harq_alloc_context & ctx, const pdsch_information& pdsch);
265269
266270 slot_point pdsch_slot () const { return impl->slot_tx ; }
267271 slot_point uci_slot () const { return impl->slot_ack ; }
@@ -300,7 +304,7 @@ class ul_harq_process_handle : public harq_utils::base_harq_process_handle<false
300304
301305 // / \brief Stores grant parameters that are associated with the HARQ process (e.g. DCI format, PRBs, MCS) so that
302306 // / they can be later fetched and optionally reused.
303- void save_grant_params (const ul_harq_sched_context & ctx, const pusch_information& pusch);
307+ void save_grant_params (const ul_harq_alloc_context & ctx, const pusch_information& pusch);
304308
305309 slot_point pusch_slot () const { return impl->slot_tx ; }
306310
@@ -436,6 +440,8 @@ class unique_ue_harq_entity
436440 unique_ue_harq_entity& operator =(const unique_ue_harq_entity&) = delete ;
437441 unique_ue_harq_entity& operator =(unique_ue_harq_entity&& other) noexcept ;
438442
443+ bool empty () const { return cell_harq_mgr == nullptr ; }
444+
439445 // / Gets the maximum number of HARQ processes a UE can use, which depends on its configuration.
440446 unsigned nof_dl_harqs () const { return get_dl_ue ().harqs .size (); }
441447 unsigned nof_ul_harqs () const { return get_ul_ue ().harqs .size (); }
@@ -454,20 +460,36 @@ class unique_ue_harq_entity
454460 }
455461 return std::nullopt ;
456462 }
463+ std::optional<const dl_harq_process_handle> dl_harq (harq_id_t h_id) const
464+ {
465+ if (get_dl_ue ().harqs [h_id].status != harq_utils::harq_state_t ::empty) {
466+ return dl_harq_process_handle{cell_harq_mgr->dl , cell_harq_mgr->dl .ues [ue_index].harqs [h_id]};
467+ }
468+ return std::nullopt ;
469+ }
457470 std::optional<ul_harq_process_handle> ul_harq (harq_id_t h_id)
458471 {
459472 if (get_ul_ue ().harqs [h_id].status != harq_utils::harq_state_t ::empty) {
460473 return ul_harq_process_handle{cell_harq_mgr->ul , get_ul_ue ().harqs [h_id]};
461474 }
462475 return std::nullopt ;
463476 }
477+ std::optional<const ul_harq_process_handle> ul_harq (harq_id_t h_id) const
478+ {
479+ if (get_ul_ue ().harqs [h_id].status != harq_utils::harq_state_t ::empty) {
480+ return ul_harq_process_handle{cell_harq_mgr->ul , cell_harq_mgr->ul .ues [ue_index].harqs [h_id]};
481+ }
482+ return std::nullopt ;
483+ }
464484
465485 std::optional<dl_harq_process_handle>
466486 alloc_dl_harq (slot_point sl_tx, unsigned k1, unsigned max_harq_nof_retxs, unsigned harq_bit_idx);
467487 std::optional<ul_harq_process_handle> alloc_ul_harq (slot_point sl_tx, unsigned max_harq_nof_retxs);
468488
469- std::optional<dl_harq_process_handle> find_pending_dl_retx ();
470- std::optional<ul_harq_process_handle> find_pending_ul_retx ();
489+ std::optional<dl_harq_process_handle> find_pending_dl_retx ();
490+ std::optional<const dl_harq_process_handle> find_pending_dl_retx () const ;
491+ std::optional<ul_harq_process_handle> find_pending_ul_retx ();
492+ std::optional<const ul_harq_process_handle> find_pending_ul_retx () const ;
471493
472494 std::optional<dl_harq_process_handle> find_dl_harq_waiting_ack ();
473495 std::optional<ul_harq_process_handle> find_ul_harq_waiting_ack ();
@@ -483,6 +505,18 @@ class unique_ue_harq_entity
483505 // / \return Active UL HARQ process with matching PUSCH slot, if found.
484506 std::optional<ul_harq_process_handle> find_ul_harq (slot_point pusch_slot);
485507
508+ // / \brief The UCI scheduling associated with a given slot was cancelled. The associated DL HARQs will be NACKed, and
509+ // / won't expect further UCIs.
510+ // /
511+ // / This function can be called for instance when there is an error indication coming from lower layers.
512+ void uci_sched_failed (slot_point uci_slot);
513+
514+ unsigned ntn_get_tbs_pending_crcs () const
515+ {
516+ // TODO
517+ return 0 ;
518+ }
519+
486520private:
487521 dl_harq_ent_impl& get_dl_ue () { return cell_harq_mgr->dl .ues [ue_index]; }
488522 const dl_harq_ent_impl& get_dl_ue () const { return cell_harq_mgr->dl .ues [ue_index]; }
@@ -494,4 +528,4 @@ class unique_ue_harq_entity
494528 rnti_t crnti = rnti_t ::INVALID_RNTI;
495529};
496530
497- } // namespace srsran
531+ } // namespace srsran
0 commit comments