Skip to content

Commit dd8db14

Browse files
yagodacodebot
authored andcommitted
sched: changing the output of dl_ack_info
1 parent 723c051 commit dd8db14

File tree

6 files changed

+57
-47
lines changed

6 files changed

+57
-47
lines changed

lib/scheduler/ue_scheduling/harq_process.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,10 @@ void harq_entity::slot_indication(slot_point slot_tx_)
396396
}
397397
}
398398

399-
std::pair<const dl_harq_process*, dl_harq_process::status_update>
400-
harq_entity::dl_ack_info(slot_point uci_slot,
401-
mac_harq_ack_report_status ack,
402-
uint8_t harq_bit_idx,
403-
optional<float> pucch_snr)
399+
dl_harq_process::dl_ack_info_result harq_entity::dl_ack_info(slot_point uci_slot,
400+
mac_harq_ack_report_status ack,
401+
uint8_t harq_bit_idx,
402+
optional<float> pucch_snr)
404403
{
405404
// For the time being, we assume 1 TB only.
406405
static const size_t tb_index = 0;
@@ -410,11 +409,15 @@ harq_entity::dl_ack_info(slot_point uci_slot,
410409
h_dl.tb(tb_index).harq_bit_idx == harq_bit_idx) {
411410
// Update HARQ state.
412411
dl_harq_process::status_update status_upd = h_dl.ack_info(tb_index, ack, pucch_snr);
413-
return std::make_pair(&h_dl, status_upd);
412+
return {h_dl.id,
413+
h_dl.last_alloc_params().tb[0]->mcs_table,
414+
h_dl.last_alloc_params().tb[0]->mcs,
415+
h_dl.last_alloc_params().tb[0]->tbs_bytes,
416+
status_upd};
414417
}
415418
}
416419
logger.warning("DL HARQ for rnti={:#x}, uci slot={} not found.", rnti, uci_slot);
417-
return std::make_pair(nullptr, dl_harq_process::status_update::error);
420+
return {INVALID_HARQ_ID, pdsch_mcs_table::qam64, sch_mcs_index{0}, 0, dl_harq_process::status_update::error};
418421
}
419422

420423
int harq_entity::ul_crc_info(harq_id_t h_id, bool ack, slot_point pusch_slot)

lib/scheduler/ue_scheduling/harq_process.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,19 @@ class dl_harq_process : public detail::harq_process<true>
268268
unsigned nof_layers;
269269
};
270270

271+
struct dl_ack_info_result {
272+
/// \brief HARQ process ID.
273+
harq_id_t h_id;
274+
/// \brief mcs_table used for the last PDSCH transmission.
275+
pdsch_mcs_table mcs_table;
276+
/// \brief MCS used for the last PDSCH transmission.
277+
sch_mcs_index mcs;
278+
/// \brief Number of bytes of the last PDSCH transmission.
279+
unsigned tbs_bytes;
280+
/// \brief HARQ process status update.
281+
dl_harq_process::status_update update;
282+
};
283+
271284
using base_type::transport_block;
272285

273286
using base_type::empty;
@@ -424,9 +437,9 @@ class harq_entity
424437
void slot_indication(slot_point slot_tx_);
425438

426439
/// \brief Update the state of the DL HARQ for the specified UCI slot.
427-
/// \return HARQ process whose state was updated and the update that occurred. Nullptr, if no HARQ for which the
440+
/// \return struct containing the HARQ process ID, MCS, TBS and status update.
428441
/// ACK/NACK was directed was found.
429-
std::pair<const dl_harq_process*, dl_harq_process::status_update>
442+
dl_harq_process::dl_ack_info_result
430443
dl_ack_info(slot_point uci_slot, mac_harq_ack_report_status ack, uint8_t harq_bit_idx, optional<float> pucch_snr);
431444

432445
/// Update UL HARQ state given the received CRC indication.

lib/scheduler/ue_scheduling/ue_cell.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,18 @@ void ue_cell::handle_reconfiguration_request(const ue_cell_configuration& ue_cel
5757
ue_cfg = &ue_cell_cfg;
5858
}
5959

60-
std::pair<const dl_harq_process*, dl_harq_process::status_update>
61-
ue_cell::handle_dl_ack_info(slot_point uci_slot,
62-
mac_harq_ack_report_status ack_value,
63-
unsigned harq_bit_idx,
64-
optional<float> pucch_snr)
60+
dl_harq_process::dl_ack_info_result ue_cell::handle_dl_ack_info(slot_point uci_slot,
61+
mac_harq_ack_report_status ack_value,
62+
unsigned harq_bit_idx,
63+
optional<float> pucch_snr)
6564
{
66-
std::pair<const dl_harq_process*, dl_harq_process::status_update> result =
67-
harqs.dl_ack_info(uci_slot, ack_value, harq_bit_idx, pucch_snr);
68-
const dl_harq_process* h_dl = result.first;
65+
dl_harq_process::dl_ack_info_result result = harqs.dl_ack_info(uci_slot, ack_value, harq_bit_idx, pucch_snr);
6966

70-
if (result.second == dl_harq_process::status_update::acked or
71-
result.second == dl_harq_process::status_update::nacked) {
67+
if (result.update == dl_harq_process::status_update::acked or
68+
result.update == dl_harq_process::status_update::nacked) {
7269
// HARQ is not expecting more ACK bits. Consider the feedback in the link adaptation controller.
73-
ue_mcs_calculator.handle_dl_ack_info(result.second == dl_harq_process::status_update::acked,
74-
h_dl->last_alloc_params().tb[0]->mcs,
75-
h_dl->last_alloc_params().tb[0]->mcs_table);
70+
ue_mcs_calculator.handle_dl_ack_info(
71+
result.update == dl_harq_process::status_update::acked, result.mcs, result.mcs_table);
7672
}
7773

7874
return result;

lib/scheduler/ue_scheduling/ue_cell.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ class ue_cell
6262

6363
void handle_reconfiguration_request(const ue_cell_configuration& ue_cell_cfg);
6464

65-
std::pair<const dl_harq_process*, dl_harq_process::status_update>
66-
handle_dl_ack_info(slot_point uci_slot,
67-
mac_harq_ack_report_status ack_value,
68-
unsigned harq_bit_idx,
69-
optional<float> pucch_snr);
65+
dl_harq_process::dl_ack_info_result handle_dl_ack_info(slot_point uci_slot,
66+
mac_harq_ack_report_status ack_value,
67+
unsigned harq_bit_idx,
68+
optional<float> pucch_snr);
7069

7170
/// \brief Estimate the number of required DL PRBs to allocate the given number of bytes.
7271
grant_prbs_mcs required_dl_prbs(const pdsch_time_domain_resource_allocation& pdsch_td_cfg,

lib/scheduler/ue_scheduling/ue_event_manager.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,21 @@ void ue_event_manager::handle_harq_ind(ue_cell& ue
181181
{
182182
for (unsigned harq_idx = 0; harq_idx != harq_bits.size(); ++harq_idx) {
183183
// Update UE HARQ state with received HARQ-ACK.
184-
std::pair<const dl_harq_process*, dl_harq_process::status_update> result =
184+
dl_harq_process::dl_ack_info_result result =
185185
ue_cc.handle_dl_ack_info(uci_sl, harq_bits[harq_idx], harq_idx, pucch_snr);
186-
const dl_harq_process* h_dl = result.first;
187186

188-
if (h_dl != nullptr) {
187+
if (result.h_id != INVALID_HARQ_ID) {
189188
// Respective HARQ was found.
190-
const units::bytes tbs{h_dl->last_alloc_params().tb[0]->tbs_bytes};
189+
const units::bytes tbs{result.tbs_bytes};
191190

192191
// Log Event.
193192
ev_logger.enqueue(scheduler_event_logger::harq_ack_event{
194-
ue_cc.ue_index, ue_cc.rnti(), ue_cc.cell_index, uci_sl, h_dl->id, harq_bits[harq_idx], tbs});
193+
ue_cc.ue_index, ue_cc.rnti(), ue_cc.cell_index, uci_sl, result.h_id, harq_bits[harq_idx], tbs});
195194

196-
if (result.second == dl_harq_process::status_update::acked or
197-
result.second == dl_harq_process::status_update::nacked) {
195+
if (result.update == dl_harq_process::status_update::acked or
196+
result.update == dl_harq_process::status_update::nacked) {
198197
// In case the HARQ process is not waiting for more HARQ-ACK bits. Notify metrics handler with HARQ outcome.
199-
metrics_handler.handle_dl_harq_ack(ue_cc.ue_index, result.second == dl_harq_process::status_update::acked, tbs);
198+
metrics_handler.handle_dl_harq_ack(ue_cc.ue_index, result.update == dl_harq_process::status_update::acked, tbs);
200199
}
201200
}
202201
}

tests/unittests/scheduler/ue_scheduling/harq_entity_test.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ TEST_F(harq_entity_harq_1bit_tester, when_dtx_received_after_ack_then_dtx_is_ign
104104

105105
// ACK received.
106106
auto result = this->harq_ent.dl_ack_info(pucch_slot, mac_harq_ack_report_status::ack, dai, nullopt);
107-
ASSERT_EQ(result.first, &this->h_dl);
108-
ASSERT_EQ(result.second, dl_harq_process::status_update::no_update);
107+
ASSERT_EQ(result.h_id, this->h_dl.id);
108+
ASSERT_EQ(result.update, dl_harq_process::status_update::no_update);
109109

110110
// DTX received one slot late.
111111
run_slot();
112112
result = this->harq_ent.dl_ack_info(pucch_slot, mac_harq_ack_report_status::dtx, dai, nullopt);
113-
ASSERT_EQ(result.first, &this->h_dl);
114-
ASSERT_EQ(result.second, dl_harq_process::status_update::acked);
113+
ASSERT_EQ(result.h_id, this->h_dl.id);
114+
ASSERT_EQ(result.update, dl_harq_process::status_update::acked);
115115
}
116116

117117
// Note: When two F1 PUCCHs are decoded (one with SR and the other without), there is a small chance that none of them
@@ -131,13 +131,13 @@ TEST_F(harq_entity_harq_1bit_tester, when_ack_received_after_nack_then_process_b
131131

132132
// NACK received.
133133
auto result = this->harq_ent.dl_ack_info(pucch_slot, mac_harq_ack_report_status::nack, dai, 1.0F);
134-
ASSERT_EQ(result.first, &this->h_dl);
135-
ASSERT_EQ(result.second, dl_harq_process::status_update::no_update);
134+
ASSERT_EQ(result.h_id, this->h_dl.id);
135+
ASSERT_EQ(result.update, dl_harq_process::status_update::no_update);
136136

137137
// ACK received.
138138
result = this->harq_ent.dl_ack_info(pucch_slot, srsran::mac_harq_ack_report_status::ack, dai, 2.0F);
139-
ASSERT_EQ(result.first, &this->h_dl);
140-
ASSERT_EQ(result.second, dl_harq_process::status_update::acked);
139+
ASSERT_EQ(result.h_id, this->h_dl.id);
140+
ASSERT_EQ(result.update, dl_harq_process::status_update::acked);
141141

142142
// HARQ should be empty.
143143
ASSERT_TRUE(this->h_dl.empty());
@@ -298,8 +298,8 @@ TEST_F(harq_entity_harq_5bit_tester, when_5_harq_bits_are_acks_then_all_5_active
298298
// ACK received.
299299
for (unsigned i = 0; i != active_harqs; ++i) {
300300
auto result = this->harq_ent.dl_ack_info(pucch_slot, srsran::mac_harq_ack_report_status::ack, i, nullopt);
301-
ASSERT_NE(result.first, nullptr);
302-
ASSERT_EQ(result.second, dl_harq_process::status_update::acked);
301+
ASSERT_NE(result.h_id, INVALID_HARQ_ID);
302+
ASSERT_EQ(result.update, dl_harq_process::status_update::acked);
303303
}
304304

305305
for (unsigned i = 0; i != h_dls.size(); ++i) {
@@ -325,8 +325,8 @@ TEST_F(harq_entity_harq_5bit_tester, when_5_harq_bits_are_nacks_then_all_5_activ
325325
// NACK received.
326326
for (unsigned i = 0; i != active_harqs; ++i) {
327327
auto result = this->harq_ent.dl_ack_info(pucch_slot, srsran::mac_harq_ack_report_status::nack, i, nullopt);
328-
ASSERT_NE(result.first, nullptr);
329-
ASSERT_EQ(result.second, dl_harq_process::status_update::nacked);
328+
ASSERT_NE(result.h_id, INVALID_HARQ_ID);
329+
ASSERT_EQ(result.update, dl_harq_process::status_update::nacked);
330330
}
331331

332332
for (unsigned i = 0; i != h_dls.size(); ++i) {

0 commit comments

Comments
 (0)