Skip to content

Commit e8ce4f8

Browse files
carlo-galcodebot
authored andcommitted
sched: don't schedule fallback pucch on pusch slots
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent 8957d42 commit e8ce4f8

File tree

3 files changed

+16
-27
lines changed

3 files changed

+16
-27
lines changed

lib/scheduler/uci_scheduling/uci_allocator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class uci_allocator
3232
/// \brief Reset the internal counter of the allocated PDSCHs to be acknowledged per slot.
3333
virtual void slot_indication(slot_point sl_tx) = 0;
3434

35-
/// Allocate the common PUCCH resource for HARQ-ACK for a given UE.
35+
/// Allocate a PUCCH resource for HARQ-ACK for a given UE.
3636
/// \param[out,in] res_alloc struct with scheduling results.
3737
/// \param[in] crnti RNTI of the UE.
3838
/// \param[in] ue_cell_cfg user configuration. For the fallback mode case, this configuration is used to determine
@@ -42,7 +42,7 @@ class uci_allocator
4242
/// \param[in] k1_list List of k1 candidates configured for UE.
4343
/// \param[in] fallback_dci_info pointer to the information with DL DCI, used for scheduling the UCI on common PUCCH
4444
/// resources. If this is not \c nullptr, it triggers the UCI scheduling using common PUCCH resources; else, UCI will
45-
/// be scheduled either on dedicated PUCCH resources or on PUSCH.
45+
/// be scheduled either on dedicated PUCCH resources.
4646
virtual std::optional<uci_allocation> alloc_uci_harq_ue(cell_resource_allocator& res_alloc,
4747
rnti_t crnti,
4848
const ue_cell_configuration& ue_cell_cfg,

lib/scheduler/uci_scheduling/uci_allocator_impl.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ uci_allocator_impl::slot_alloc_list::ue_uci* uci_allocator_impl::get_uci_alloc(s
9999
{
100100
auto& ucis = uci_alloc_grid[uci_slot.to_uint()].ucis;
101101
auto* it = std::find_if(ucis.begin(), ucis.end(), [rnti](const auto& uci) { return uci.rnti == rnti; });
102-
return it != ucis.end() ? &*it : nullptr;
102+
return it != ucis.end() ? it : nullptr;
103103
}
104104

105105
unsigned uci_allocator_impl::get_min_pdsch_to_ack_slot_distance(slot_point pdsch_slot,
@@ -108,7 +108,7 @@ unsigned uci_allocator_impl::get_min_pdsch_to_ack_slot_distance(slot_point pdsch
108108
unsigned max_k1)
109109
{
110110
srsran_assert(min_k1 <= max_k1, "Minimum k1 value must be greater than maximum k1 value");
111-
for (int sl_inc = max_k1; sl_inc >= (int)min_k1; --sl_inc) {
111+
for (int sl_inc = max_k1; sl_inc >= static_cast<int>(min_k1); --sl_inc) {
112112
const slot_point uci_slot = pdsch_slot + sl_inc;
113113
if (get_uci_alloc(uci_slot, rnti) != nullptr) {
114114
return sl_inc;
@@ -127,15 +127,9 @@ uci_allocator_impl::alloc_uci_harq_ue_helper(cell_resource_allocator& res_al
127127
{
128128
cell_slot_resource_allocator& slot_alloc = res_alloc[k0 + k1 + res_alloc.cfg.ntn_cs_koffset];
129129

130-
// Get existing PUSCH grant, if any, for a given UE's RNTI.
131-
auto& puschs = slot_alloc.result.ul.puschs;
132-
ul_sched_info* existing_pusch = std::find_if(
133-
puschs.begin(), puschs.end(), [crnti](ul_sched_info& pusch) { return pusch.pusch_cfg.rnti == crnti; });
134-
135-
const bool has_pusch_grants = existing_pusch != slot_alloc.result.ul.puschs.end();
136-
137-
// [Implementation-defined] Skip allocation of UCI if any existing PUSCH grants.
138-
if (has_pusch_grants) {
130+
// [Implementation-defined] Skip allocation of UCI if any existing PUSCH grants; this to avoid that the fallback
131+
// scheduler calling this function allocates a PUCCH that can potentially collide with an existing PUSCH.
132+
if (not slot_alloc.result.ul.puschs.empty()) {
139133
return {};
140134
}
141135

@@ -158,9 +152,8 @@ uci_allocator_impl::alloc_uci_harq_ue_helper(cell_resource_allocator& res_al
158152
else {
159153
pucch_res_indicator = pucch_alloc.alloc_ded_pucch_harq_ack_ue(res_alloc, crnti, ue_cell_cfg, k0, k1);
160154
}
161-
return pucch_res_indicator.has_value()
162-
? std::optional<uci_allocation>{uci_allocation{.pucch_res_indicator = pucch_res_indicator}}
163-
: std::nullopt;
155+
return pucch_res_indicator.has_value() ? std::optional{uci_allocation{.pucch_res_indicator = pucch_res_indicator}}
156+
: std::nullopt;
164157
}
165158

166159
//////////// Public functions ////////////
@@ -188,7 +181,7 @@ std::optional<uci_allocation> uci_allocator_impl::alloc_uci_harq_ue(cell_resourc
188181
// [Implementation-defined] We restrict the number of HARQ bits per PUCCH that are expected to carry CSI reporting to
189182
// 2 , until the PUCCH allocator supports more than this.
190183
// TODO: remove this, as with the new refactor we are not constrained by this anymore.
191-
static const uint8_t max_harq_bits_per_uci = 2U;
184+
static constexpr uint8_t max_harq_bits_per_uci = 2U;
192185

193186
const slot_point pdsch_slot = res_alloc[k0].slot;
194187
const cell_configuration& cell_cfg = ue_cell_cfg.cell_cfg_common;
@@ -254,7 +247,7 @@ std::optional<uci_allocation> uci_allocator_impl::alloc_uci_harq_ue(cell_resourc
254247
continue;
255248
}
256249

257-
// Step 2: Try to allocate UCI HARQ ACK for UE, either on PUSCH or PUCCH.
250+
// Step 2: Try to allocate UCI HARQ ACK for UE.
258251
std::optional<uci_allocation> uci_output =
259252
alloc_uci_harq_ue_helper(res_alloc, crnti, ue_cell_cfg, k0, k1_candidate, fallback_dci_info);
260253

@@ -313,7 +306,7 @@ void uci_allocator_impl::uci_allocate_sr_opportunity(cell_slot_resource_allocato
313306
// Retrieve the scheduling results for slot = k0 + k1;
314307
auto& puschs = slot_alloc.result.ul.puschs;
315308
ul_sched_info* existing_pusch = std::find_if(
316-
puschs.begin(), puschs.end(), [crnti](ul_sched_info& pusch) { return pusch.pusch_cfg.rnti == crnti; });
309+
puschs.begin(), puschs.end(), [crnti](const ul_sched_info& pusch) { return pusch.pusch_cfg.rnti == crnti; });
317310

318311
const bool has_pusch_grants =
319312
not slot_alloc.result.ul.puschs.empty() and existing_pusch != slot_alloc.result.ul.puschs.end();
@@ -333,7 +326,7 @@ void uci_allocator_impl::uci_allocate_csi_opportunity(cell_slot_resource_allocat
333326
{
334327
auto& puschs = slot_alloc.result.ul.puschs;
335328
ul_sched_info* existing_pusch = std::find_if(
336-
puschs.begin(), puschs.end(), [crnti](ul_sched_info& pusch) { return pusch.pusch_cfg.rnti == crnti; });
329+
puschs.begin(), puschs.end(), [crnti](const ul_sched_info& pusch) { return pusch.pusch_cfg.rnti == crnti; });
337330

338331
const bool has_pusch_grants =
339332
not slot_alloc.result.ul.puschs.empty() and existing_pusch != slot_alloc.result.ul.puschs.end();

lib/scheduler/ue_scheduling/ue_fallback_scheduler.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,9 @@ static std::optional<uci_allocation> allocate_ue_fallback_pucch(ue&
474474
// If it is not UL-enabled slot.
475475
continue;
476476
}
477-
// Skip any PUCCH allocation that would fall on a slot that is already occupied by a PUSCH for the same UE.
478-
const auto& puschs = res_alloc[k1_candidate].result.ul.puschs;
479-
const bool has_pusch_allocated =
480-
std::any_of(puschs.begin(), puschs.end(), [rnti = u.crnti](const ul_sched_info& pusch) {
481-
return pusch.pusch_cfg.rnti == rnti;
482-
});
483-
if (has_pusch_allocated) {
477+
// There can be PUSCHs that are already allocated: to avoid potential collisions between PUCCH and PUSCH, skip this
478+
// allocation if any allocated PUSCHs.
479+
if (not res_alloc[k1_candidate].result.ul.puschs.empty()) {
484480
continue;
485481
}
486482
last_valid_k1 = k1_candidate;

0 commit comments

Comments
 (0)