1010
1111#pragma once
1212
13+ #include " ../slicing/ran_slice_id.h"
1314#include " srsran/adt/intrusive_list.h"
1415#include " srsran/adt/optional.h"
1516#include " srsran/ran/csi_report/csi_report_data.h"
2425
2526namespace srsran {
2627
28+ struct pdsch_information ;
29+ struct pusch_information ;
30+
2731class unique_ue_harq_entity ;
2832
2933// / \brief Notifier of HARQ process timeouts.
@@ -79,6 +83,8 @@ struct dl_harq_process_impl : public base_harq_process {
7983 pdsch_mcs_table mcs_table;
8084 sch_mcs_index mcs;
8185 unsigned tbs_bytes;
86+ // / RAN slice identifier.
87+ std::optional<ran_slice_id_t > slice_id;
8288 // / \brief MCS originally suggested by the OLLA. It might differ from the actual MCS used.
8389 std::optional<sch_mcs_index> olla_mcs;
8490 };
@@ -99,13 +105,14 @@ struct dl_harq_process_impl : public base_harq_process {
99105struct ul_harq_process_impl : public base_harq_process {
100106 // / \brief Parameters relative to the last allocated PUSCH PDU for this HARQ process.
101107 struct alloc_params {
102- dci_ul_rnti_config_type dci_cfg_type;
103- vrb_alloc rbs;
104- pusch_mcs_table mcs_table;
105- sch_mcs_index mcs;
106- unsigned tbs_bytes;
107- unsigned nof_symbols;
108- std::optional<sch_mcs_index> olla_mcs;
108+ dci_ul_rnti_config_type dci_cfg_type;
109+ vrb_alloc rbs;
110+ pusch_mcs_table mcs_table;
111+ sch_mcs_index mcs;
112+ unsigned tbs_bytes;
113+ unsigned nof_symbols;
114+ std::optional<ran_slice_id_t > slice_id;
115+ std::optional<sch_mcs_index> olla_mcs;
109116 };
110117
111118 // / Parameters used for the last Tx of this HARQ process.
@@ -139,21 +146,41 @@ struct cell_harq_repository {
139146
140147 unsigned get_harq_ref_idx (const harq_type& h) const ;
141148
142- void slot_indication (slot_point sl_tx);
143- void handle_harq_ack_timeout (harq_type& h, slot_point sl_tx);
144- harq_type* alloc_harq (du_ue_index_t ue_idx, slot_point sl_tx, slot_point sl_ack, unsigned max_nof_harq_retxs);
145- void dealloc_harq (harq_type& h);
146- void handle_ack (harq_type& h, bool ack);
147- void set_pending_retx (harq_type& h);
148- void handle_new_retx (harq_type& h, slot_point sl_tx, slot_point sl_ack);
149- void reserve_ue_harqs (du_ue_index_t ue_idx, unsigned nof_harqs);
150- void destroy_ue_harqs (du_ue_index_t ue_idx);
151- void cancel_retxs (harq_type& h);
152- unsigned find_ue_harq_in_state (du_ue_index_t ue_idx, harq_utils::harq_state_t state) const ;
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);
155+ [[nodiscard]] bool handle_new_retx (harq_type& h, slot_point sl_tx, slot_point sl_ack);
156+ void reserve_ue_harqs (du_ue_index_t ue_idx, unsigned nof_harqs);
157+ void destroy_ue_harqs (du_ue_index_t ue_idx);
158+ void cancel_retxs (harq_type& h);
159+ unsigned find_ue_harq_in_state (du_ue_index_t ue_idx, harq_utils::harq_state_t state) const ;
153160};
154161
155162} // namespace harq_utils
156163
164+ // / \brief Context of the scheduler during the current PDSCH allocation.
165+ struct dl_harq_sched_context {
166+ // / DCI format used to signal the PDSCH allocation.
167+ dci_dl_rnti_config_type dci_cfg_type;
168+ // / MCS suggested by the OLLA.
169+ std::optional<sch_mcs_index> olla_mcs;
170+ // / RAN slice identifier of the slice to which PDSCH belongs to.
171+ std::optional<ran_slice_id_t > slice_id;
172+ };
173+
174+ // / \brief Context of the scheduler during the current PUSCH allocation.
175+ struct ul_harq_sched_context {
176+ // / DCI format used to signal the PUSCH allocation.
177+ dci_ul_rnti_config_type dci_cfg_type;
178+ // / MCS suggested by the OLLA.
179+ std::optional<sch_mcs_index> olla_mcs;
180+ // / RAN slice identifier of the slice to which PUSCH belongs to.
181+ std::optional<ran_slice_id_t > slice_id;
182+ };
183+
157184class cell_harq_manager
158185{
159186public:
@@ -206,10 +233,11 @@ class cell_harq_manager
206233 harq_utils::ul_harq_process_impl* new_ul_tx (du_ue_index_t ue_idx, slot_point pusch_slot, unsigned max_harq_nof_retxs);
207234
208235 // / \brief Called on a new retx of a DL HARQ process.
209- void new_dl_retx (harq_utils::dl_harq_process_impl& h, slot_point pdsch_slot, unsigned k1, uint8_t harq_bit_idx);
236+ [[nodiscard]] bool
237+ new_dl_retx (harq_utils::dl_harq_process_impl& h, slot_point pdsch_slot, unsigned k1, uint8_t harq_bit_idx);
210238
211239 // / \brief Called on a new retx of a UL HARQ process.
212- void new_ul_retx (harq_utils::ul_harq_process_impl& h, slot_point pusch_slot);
240+ [[nodiscard]] bool new_ul_retx (harq_utils::ul_harq_process_impl& h, slot_point pusch_slot);
213241
214242 // / Updates a DL HARQ process given the received HARQ-ACK info.
215243 harq_utils::dl_harq_process_impl::status_update
@@ -241,18 +269,15 @@ class dl_harq_process_view
241269 " Empty HARQ process created" );
242270 }
243271
244- harq_id_t id () const { return cell_harq_mng->dl .harqs [harq_ref_idx].h_id ; }
245-
246- bool is_waiting_ack () const
272+ harq_id_t id () const { return fetch_impl ().h_id ; }
273+ bool is_waiting_ack () const { return fetch_impl ().status == harq_utils::harq_state_t ::waiting_ack; }
274+ bool has_pending_retx () const { return fetch_impl ().status == harq_utils::harq_state_t ::pending_retx; }
275+ bool empty () const
247276 {
248- return cell_harq_mng->dl .harqs [harq_ref_idx].status == harq_utils::harq_state_t ::waiting_ack;
249- }
250- bool has_pending_retx () const
251- {
252- return cell_harq_mng->dl .harqs [harq_ref_idx].status == harq_utils::harq_state_t ::pending_retx;
277+ return harq_ref_idx == cell_harq_manager::INVALID_HARQ or fetch_impl ().status == harq_utils::harq_state_t ::empty;
253278 }
254279
255- void new_retx (slot_point pdsch_slot, unsigned k1, uint8_t harq_bit_idx);
280+ [[nodiscard]] bool new_retx (slot_point pdsch_slot, unsigned k1, uint8_t harq_bit_idx);
256281
257282 // / \brief Update the state of the DL HARQ process waiting for an HARQ-ACK.
258283 // / \param[in] ack HARQ-ACK status received.
@@ -262,7 +287,17 @@ class dl_harq_process_view
262287
263288 void increment_pucch_counter ();
264289
265- const grant_params& get_grant_params () const { return cell_harq_mng->dl .harqs [harq_ref_idx].prev_tx_params ; }
290+ // / \brief Stores grant parameters that are associated with the HARQ process (e.g. DCI format, PRBs, MCS) so that
291+ // / they can be later fetched and optionally reused.
292+ void save_grant_params (const dl_harq_sched_context& ctx, const pdsch_information& pdsch);
293+
294+ slot_point pdsch_slot () const { return fetch_impl ().slot_tx ; }
295+ slot_point uci_slot () const { return fetch_impl ().slot_ack ; }
296+ unsigned max_nof_retxs () const { return fetch_impl ().max_nof_harq_retxs ; }
297+ unsigned nof_retxs () const { return fetch_impl ().nof_retxs ; }
298+ bool ndi () const { return fetch_impl ().ndi ; }
299+
300+ const grant_params& get_grant_params () const { return fetch_impl ().prev_tx_params ; }
266301
267302 bool operator ==(const dl_harq_process_view& other) const
268303 {
@@ -271,6 +306,9 @@ class dl_harq_process_view
271306 bool operator !=(const dl_harq_process_view& other) const { return !(*this == other); }
272307
273308private:
309+ harq_utils::dl_harq_process_impl& fetch_impl () { return cell_harq_mng->dl .harqs [harq_ref_idx]; }
310+ const harq_utils::dl_harq_process_impl& fetch_impl () const { return cell_harq_mng->dl .harqs [harq_ref_idx]; }
311+
274312 cell_harq_manager* cell_harq_mng = nullptr ;
275313 unsigned harq_ref_idx = cell_harq_manager::INVALID_HARQ;
276314};
@@ -281,34 +319,39 @@ class ul_harq_process_view
281319 ul_harq_process_view (cell_harq_manager& cell_harq_mng_, unsigned h_ref_idx) :
282320 cell_harq_mng (&cell_harq_mng_), harq_ref_idx(h_ref_idx)
283321 {
284- srsran_sanity_check (cell_harq_mng->ul .harqs [harq_ref_idx].status != harq_utils::harq_state_t ::empty,
285- " Empty HARQ process created" );
322+ srsran_sanity_check (fetch_impl ().status != harq_utils::harq_state_t ::empty, " Empty HARQ process created" );
286323 }
287324
288- harq_id_t id () const { return cell_harq_mng-> ul . harqs [harq_ref_idx] .h_id ; }
325+ harq_id_t id () const { return fetch_impl () .h_id ; }
289326
290- bool is_waiting_ack () const
291- {
292- return cell_harq_mng->ul .harqs [harq_ref_idx].status == harq_utils::harq_state_t ::waiting_ack;
293- }
294- bool has_pending_retx () const
295- {
296- return cell_harq_mng->ul .harqs [harq_ref_idx].status == harq_utils::harq_state_t ::pending_retx;
297- }
327+ bool is_waiting_ack () const { return fetch_impl ().status == harq_utils::harq_state_t ::waiting_ack; }
328+ bool has_pending_retx () const { return fetch_impl ().status == harq_utils::harq_state_t ::pending_retx; }
298329
299- void new_retx (slot_point pusch_slot);
330+ [[nodiscard]] bool new_retx (slot_point pusch_slot);
300331
301332 // / Update UL HARQ state given the received CRC indication.
302333 // / \return Transport Block size of the HARQ whose state was updated.
303334 int ul_crc_info (bool ack);
304335
336+ // / \brief Stores grant parameters that are associated with the HARQ process (e.g. DCI format, PRBs, MCS) so that
337+ // / they can be later fetched and optionally reused.
338+ void save_grant_params (const ul_harq_sched_context& ctx, const pusch_information& pdsch);
339+
340+ slot_point pusch_slot () const { return fetch_impl ().slot_tx ; }
341+ unsigned max_nof_retxs () const { return fetch_impl ().max_nof_harq_retxs ; }
342+ unsigned nof_retxs () const { return fetch_impl ().nof_retxs ; }
343+ bool ndi () const { return fetch_impl ().ndi ; }
344+
305345 bool operator ==(const ul_harq_process_view& other) const
306346 {
307347 return cell_harq_mng == other.cell_harq_mng and harq_ref_idx == other.harq_ref_idx ;
308348 }
309349 bool operator !=(const ul_harq_process_view& other) const { return !(*this == other); }
310350
311351private:
352+ harq_utils::ul_harq_process_impl& fetch_impl () { return cell_harq_mng->ul .harqs [harq_ref_idx]; }
353+ const harq_utils::ul_harq_process_impl& fetch_impl () const { return cell_harq_mng->ul .harqs [harq_ref_idx]; }
354+
312355 cell_harq_manager* cell_harq_mng = nullptr ;
313356 unsigned harq_ref_idx = cell_harq_manager::INVALID_HARQ;
314357};
0 commit comments