Skip to content

Commit 2b8b4db

Browse files
committed
sched: add more tx_params to HARQ manager allocations
1 parent a420c55 commit 2b8b4db

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

lib/scheduler/ue_scheduling/cell_harq_manager.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,10 @@ bool cell_harq_repository<IsDl>::handle_new_retx(harq_type& h, slot_point sl_tx,
255255
// Remove HARQ from pending Retx list.
256256
harq_pending_retx_list.pop(&h);
257257

258-
h.status = harq_state_t::waiting_ack;
259-
h.slot_tx = sl_tx;
260-
h.slot_ack = sl_ack;
261-
h.ndi = !h.ndi;
262-
h.ack_on_timeout = false;
263-
h.retxs_cancelled = false;
258+
h.status = harq_state_t::waiting_ack;
259+
h.slot_tx = sl_tx;
260+
h.slot_ack = sl_ack;
261+
h.ack_on_timeout = false;
264262
h.nof_retxs++;
265263

266264
// Add HARQ to the timeout list.
@@ -487,6 +485,8 @@ void dl_harq_process_handle::save_grant_params(const dl_harq_sched_context& ctx,
487485
{
488486
srsran_assert(pdsch.codewords.size() == 1, "Only one codeword supported");
489487
dl_harq_process_impl& impl = fetch_impl();
488+
srsran_sanity_check(pdsch.rnti == impl.rnti, "RNTI mismatch");
489+
srsran_sanity_check(pdsch.harq_id == impl.h_id, "HARQ-id mismatch");
490490
srsran_assert(impl.status == harq_utils::harq_state_t::waiting_ack,
491491
"Setting allocation parameters for DL HARQ process id={} in invalid state",
492492
id());
@@ -497,8 +497,11 @@ void dl_harq_process_handle::save_grant_params(const dl_harq_sched_context& ctx,
497497
if (impl.nof_retxs == 0) {
498498
prev_params.tbs_bytes = cw.tb_size_bytes;
499499
prev_params.dci_cfg_type = ctx.dci_cfg_type;
500+
prev_params.nof_layers = pdsch.nof_layers;
500501
prev_params.olla_mcs = ctx.olla_mcs;
501502
prev_params.slice_id = ctx.slice_id;
503+
prev_params.cqi = ctx.cqi.has_value() ? ctx.cqi.value() : cqi_value{1};
504+
prev_params.is_fallback = ctx.is_fallback;
502505
} else {
503506
srsran_assert(ctx.dci_cfg_type == prev_params.dci_cfg_type,
504507
"DCI format and RNTI type cannot change during DL HARQ retxs");
@@ -510,6 +513,8 @@ void dl_harq_process_handle::save_grant_params(const dl_harq_sched_context& ctx,
510513
prev_params.rbs,
511514
cw.mcs_index,
512515
pdsch.rbs);
516+
srsran_assert(prev_params.nof_layers == pdsch.nof_layers, "Number of layers cannot change during HARQ retxs");
517+
srsran_assert(prev_params.is_fallback == ctx.is_fallback, "Fallback state cannot change across DL HARQ retxs");
513518
}
514519
prev_params.mcs_table = cw.mcs_table;
515520
prev_params.mcs = cw.mcs_index;
@@ -539,6 +544,8 @@ int ul_harq_process_handle::ul_crc_info(bool ack)
539544
void ul_harq_process_handle::save_grant_params(const ul_harq_sched_context& ctx, const pusch_information& pusch)
540545
{
541546
ul_harq_process_impl& impl = fetch_impl();
547+
srsran_sanity_check(pusch.rnti == impl.rnti, "RNTI mismatch");
548+
srsran_sanity_check(pusch.harq_id == impl.h_id, "HARQ-id mismatch");
542549
srsran_assert(impl.status == harq_utils::harq_state_t::waiting_ack,
543550
"Setting allocation parameters for DL HARQ process id={} in invalid state",
544551
id());

lib/scheduler/ue_scheduling/cell_harq_manager.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ struct dl_harq_sched_context {
222222
std::optional<sch_mcs_index> olla_mcs;
223223
/// RAN slice identifier of the slice to which PDSCH belongs to.
224224
std::optional<ran_slice_id_t> slice_id;
225+
/// CQI value at the moment of newTx.
226+
std::optional<cqi_value> cqi;
227+
/// Whether the HARQ allocation was done in fallback mode.
228+
bool is_fallback = false;
225229
};
226230

227231
/// \brief Context of the scheduler during the current PUSCH allocation.
@@ -290,6 +294,8 @@ class ul_harq_process_handle : public harq_utils::base_harq_process_handle<false
290294
using base_type = harq_utils::base_harq_process_handle<false>;
291295

292296
public:
297+
using grant_params = harq_utils::ul_harq_process_impl::alloc_params;
298+
293299
using base_type::base_type;
294300

295301
using base_type::empty;
@@ -311,9 +317,11 @@ class ul_harq_process_handle : public harq_utils::base_harq_process_handle<false
311317

312318
/// \brief Stores grant parameters that are associated with the HARQ process (e.g. DCI format, PRBs, MCS) so that
313319
/// they can be later fetched and optionally reused.
314-
void save_grant_params(const ul_harq_sched_context& ctx, const pusch_information& pdsch);
320+
void save_grant_params(const ul_harq_sched_context& ctx, const pusch_information& pusch);
315321

316322
slot_point pusch_slot() const { return fetch_impl().slot_tx; }
323+
324+
const grant_params& get_grant_params() const { return fetch_impl().prev_tx_params; }
317325
};
318326

319327
namespace harq_utils {
@@ -371,6 +379,7 @@ class harq_pending_retx_list_impl
371379

372380
} // namespace harq_utils
373381

382+
/// List of HARQ processes with pending retransmissions
374383
using dl_harq_pending_retx_list = harq_utils::harq_pending_retx_list_impl<true>;
375384
using ul_harq_pending_retx_list = harq_utils::harq_pending_retx_list_impl<false>;
376385

@@ -434,6 +443,7 @@ class cell_harq_manager
434443
harq_utils::cell_harq_repository<false> ul;
435444
};
436445

446+
/// HARQ entity that manages a set of HARQ processes of a single UE.
437447
class unique_ue_harq_entity
438448
{
439449
public:

tests/unittests/scheduler/ue_scheduling/harq_manager_test.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ mac_harq_ack_report_status get_random_harq_ack()
3131
pdsch_information make_dummy_pdsch_info()
3232
{
3333
pdsch_information pdsch;
34+
pdsch.rnti = to_rnti(0x4601);
35+
pdsch.harq_id = to_harq_id(0);
3436
pdsch.codewords.resize(1);
3537
pdsch.codewords[0].mcs_table = srsran::pdsch_mcs_table::qam64;
3638
pdsch.codewords[0].mcs_index = 10;
@@ -42,6 +44,8 @@ pdsch_information make_dummy_pdsch_info()
4244
pusch_information make_dummy_pusch_info()
4345
{
4446
pusch_information pusch;
47+
pusch.rnti = to_rnti(0x4601);
48+
pusch.harq_id = to_harq_id(0);
4549
pusch.mcs_table = pusch_mcs_table::qam64;
4650
pusch.mcs_index = 10;
4751
pusch.tb_size_bytes = 10000;
@@ -350,10 +354,8 @@ TEST_F(single_harq_process_test, when_max_retxs_reached_then_harq_becomes_empty)
350354
ASSERT_TRUE(h_ul.new_retx(current_slot + k2));
351355
ASSERT_EQ(h_dl.nof_retxs(), i + 1);
352356
ASSERT_EQ(h_ul.nof_retxs(), i + 1);
353-
ASSERT_NE(old_dl_ndi, h_dl.ndi());
354-
ASSERT_NE(old_ul_ndi, h_ul.ndi());
355-
old_dl_ndi = h_dl.ndi();
356-
old_ul_ndi = h_dl.ndi();
357+
ASSERT_EQ(old_dl_ndi, h_dl.ndi());
358+
ASSERT_EQ(old_ul_ndi, h_ul.ndi());
357359
}
358360
ASSERT_EQ(h_dl.dl_ack_info(mac_harq_ack_report_status::nack, 5), dl_harq_process_handle::status_update::nacked);
359361
ASSERT_EQ(h_ul.ul_crc_info(false), 0);

0 commit comments

Comments
 (0)