Skip to content

Commit c220d4d

Browse files
committed
sched: helper for checking for PUCCH F0 and F2 case in cell_configuration
1 parent 7b68284 commit c220d4d

File tree

4 files changed

+43
-37
lines changed

4 files changed

+43
-37
lines changed

lib/scheduler/config/cell_configuration.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ class cell_configuration
7979
/// UL HARQ Mode B.
8080
bool ul_harq_mode_b;
8181

82+
/// Checks if the cell is configured in TDD mode.
8283
bool is_tdd() const { return tdd_cfg_common.has_value(); }
8384

84-
/// Checks if DL/UL is active for current slot
85+
/// Checks if DL is active for all symbols in the given slot.
8586
bool is_fully_dl_enabled(slot_point sl) const
8687
{
8788
if (dl_symbols_per_slot_lst.empty()) {
@@ -95,6 +96,8 @@ class cell_configuration
9596
return dl_symbols_per_slot_lst[sl.to_uint() % dl_symbols_per_slot_lst.size()] ==
9697
get_nsymb_per_slot(dl_cfg_common.init_dl_bwp.generic_params.cp);
9798
}
99+
100+
/// Checks if UL is active for all symbols in the given slot.
98101
bool is_fully_ul_enabled(slot_point sl) const
99102
{
100103
if (ul_symbols_per_slot_lst.empty()) {
@@ -109,6 +112,7 @@ class cell_configuration
109112
get_nsymb_per_slot(ul_cfg_common.init_ul_bwp.generic_params.cp);
110113
}
111114

115+
/// Checks if DL is active for at least one symbol in the given slot.
112116
bool is_dl_enabled(slot_point sl) const
113117
{
114118
if (dl_symbols_per_slot_lst.empty()) {
@@ -121,6 +125,8 @@ class cell_configuration
121125
}
122126
return dl_symbols_per_slot_lst[sl.to_uint() % dl_symbols_per_slot_lst.size()] > 0;
123127
}
128+
129+
/// Checks if UL is active for at least one symbol in the given slot.
124130
bool is_ul_enabled(slot_point sl) const
125131
{
126132
if (ul_symbols_per_slot_lst.empty()) {
@@ -133,6 +139,8 @@ class cell_configuration
133139
}
134140
return ul_symbols_per_slot_lst[sl.to_uint() % ul_symbols_per_slot_lst.size()] > 0;
135141
}
142+
143+
/// Returns the number of active DL symbols in the given slot.
136144
unsigned get_nof_dl_symbol_per_slot(slot_point sl) const
137145
{
138146
if (dl_symbols_per_slot_lst.empty()) {
@@ -145,6 +153,8 @@ class cell_configuration
145153
}
146154
return dl_symbols_per_slot_lst[sl.to_uint() % dl_symbols_per_slot_lst.size()];
147155
}
156+
157+
/// Returns the number of active UL symbols in the given slot.
148158
unsigned get_nof_ul_symbol_per_slot(slot_point sl) const
149159
{
150160
if (ul_symbols_per_slot_lst.empty()) {
@@ -157,6 +167,8 @@ class cell_configuration
157167
}
158168
return ul_symbols_per_slot_lst[sl.to_uint() % ul_symbols_per_slot_lst.size()];
159169
}
170+
171+
/// Returns the coreset configuration for the given coreset ID.
160172
const coreset_configuration& get_common_coreset(coreset_id cs_id) const
161173
{
162174
// The existence of the Coreset (either CommonCoreset or Coreset0) has been verified by the validator.
@@ -166,6 +178,15 @@ class cell_configuration
166178
: dl_cfg_common.init_dl_bwp.pdcch_common.coreset0.value();
167179
}
168180

181+
/// Checks if the cell is configured with PUCCH Format 0 and Format 2 resources.
182+
bool is_pucch_f0_and_f2() const
183+
{
184+
// [Implementation-defined] Format 0/1 resources are at the beginning of the list, while Format 2/3/4 are at the
185+
// end.
186+
return not ded_pucch_resources.empty() and ded_pucch_resources.front().format == pucch_format::FORMAT_0 and
187+
ded_pucch_resources.back().format == pucch_format::FORMAT_2;
188+
}
189+
169190
/// \brief Determines the use of transform precoding according to the parameter \e msg3-transformPrecoder.
170191
///
171192
/// The UE determines the use of the transform precoder in TS 38.214 Section 6.1.3. It uses this parameter when a

lib/scheduler/pucch_scheduling/pucch_allocator_impl.cpp

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,7 @@ pucch_allocator_impl::find_common_and_ded_harq_res_available(cell_slot_resource_
857857
// In the case of Formats 0 and 2, the PUCCH (dedicated) resources that can be used when there are SR/CSI
858858
// pre-allocated are constrained in the PUCCH resource indicator. Therefore, the \ref multiplex_and_allocate_pucch
859859
// function might not preserve the requested PUCCH resource indicator \ref d_pri.
860-
const bool is_f0_and_f2 = pucch_cfg.pucch_res_list.front().format == pucch_format::FORMAT_0 and
861-
pucch_cfg.pucch_res_list.back().format == pucch_format::FORMAT_2;
862-
if (not d_pri_ded.has_value() or (is_f0_and_f2 and d_pri_ded.value() != d_pri)) {
860+
if (not d_pri_ded.has_value() or (cell_cfg.is_pucch_f0_and_f2() and d_pri_ded.value() != d_pri)) {
863861
resource_manager.cancel_last_ue_res_reservations(pucch_alloc.slot, rnti, ue_cell_cfg);
864862
continue;
865863
}
@@ -1441,20 +1439,15 @@ pucch_allocator_impl::get_pucch_res_pre_multiplexing(slot_point
14411439
// set 1.
14421440
const pucch_res_set_idx pucch_set_idx =
14431441
new_bits.harq_ack_nof_bits <= 2U ? pucch_res_set_idx::set_0 : pucch_res_set_idx::set_1;
1444-
// NOTE: Not all UEs are capable of transmitting more than 1 PUCCH; this would be the case in which the UE has
1445-
// Format 0 resources, and it needs to transmit HARQ-ACK bits + SR or CSI in the same slot, and the resource symbols
1446-
// for HARQ and SR/CSI do not overlap. In these slots, we force, the UE to use a PUCCH resource for HARQ-ACK that is
1447-
// guaranteed to overlap (in symbols) with the SR or CSI resource.
1448-
const bool has_format_0 =
1449-
std::find_if(pucch_cfg.pucch_res_list.begin(), pucch_cfg.pucch_res_list.end(), [](const auto& pucch_res) {
1450-
return pucch_res.format == pucch_format::FORMAT_0;
1451-
}) != pucch_cfg.pucch_res_list.end();
1452-
const bool has_format_2 =
1453-
std::find_if(pucch_cfg.pucch_res_list.begin(), pucch_cfg.pucch_res_list.end(), [](const auto& pucch_res) {
1454-
return pucch_res.format == pucch_format::FORMAT_2;
1455-
}) != pucch_cfg.pucch_res_list.end();
1456-
const bool ue_with_f0_sr_csi_allocation =
1457-
has_format_0 and has_format_2 and (new_bits.sr_bits != sr_nof_bits::no_sr or new_bits.csi_part1_nof_bits != 0U);
1442+
1443+
// Not all UEs support transmission of more than 1 PUCCHs per slot. This would be the case if:
1444+
// - UE configured with F0 and F2 resources
1445+
// - UE needs to transmit HARQ-ACK + SR or CSI in the same slot
1446+
// - The resource for HARQ-ACK and the resource for SR/CSI do not overlap in symbols
1447+
// [Implementation-defined] In this case, we force the UE to use a PUCCH resource for HARQ-ACK that is guaranteed
1448+
// to overlap (in symbols) with the SR or CSI resource.
1449+
const bool ue_with_f0_sr_and_f2_csi_alloc =
1450+
cell_cfg.is_pucch_f0_and_f2() and (new_bits.sr_bits != sr_nof_bits::no_sr or new_bits.csi_part1_nof_bits != 0U);
14581451

14591452
candidate_resources.harq_resource.emplace(pucch_grant{.type = pucch_grant_type::harq_ack});
14601453
pucch_grant& harq_candidate_grant = candidate_resources.harq_resource.value();
@@ -1464,11 +1457,11 @@ pucch_allocator_impl::get_pucch_res_pre_multiplexing(slot_point
14641457
// or CSI in the same slot.
14651458
if ((ue_current_grants.pucch_grants.harq_resource.has_value() and
14661459
ue_current_grants.pucch_grants.harq_resource.value().harq_id.pucch_set_idx == pucch_set_idx) or
1467-
ue_with_f0_sr_csi_allocation) {
1460+
ue_with_f0_sr_and_f2_csi_alloc) {
14681461
// NOTE: If the UE has Format 0 resources, and it needs to transmit HARQ-ACK bits + SR or CSI in the same slot,
14691462
// use the HARQ-ACK resource that has highest PUCCH resource indicator; the UE's dedicated PUCCH config has been
14701463
// constructed in such a way that this resource overlaps with the SR or CSI resource.
1471-
const unsigned pucch_res_ind = ue_with_f0_sr_csi_allocation
1464+
const unsigned pucch_res_ind = ue_with_f0_sr_and_f2_csi_alloc
14721465
? get_pucch_resource_ind_f0_sr_csi(new_bits, pucch_cfg)
14731466
: ue_current_grants.pucch_grants.harq_resource.value().harq_id.pucch_res_ind;
14741467

@@ -1478,7 +1471,7 @@ pucch_allocator_impl::get_pucch_res_pre_multiplexing(slot_point
14781471
: resource_manager.reserve_harq_set_1_resource_by_res_indicator(
14791472
sl_tx, ue_current_grants.rnti, pucch_res_ind, pucch_cfg);
14801473
if (pucch_res == nullptr) {
1481-
if (ue_with_f0_sr_csi_allocation) {
1474+
if (ue_with_f0_sr_and_f2_csi_alloc) {
14821475
srsran_assertion_failure("rnti={}: PUCCH HARQ-ACK that should be reserved for this UE is not available",
14831476
ue_current_grants.rnti);
14841477
} else {

lib/scheduler/pucch_scheduling/pucch_resource_manager.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static int get_csi_cell_res_id(const ue_cell_configuration& ue_cell_cfg)
4242
///////////// Public methods /////////////
4343

4444
pucch_resource_manager::pucch_resource_manager(const cell_configuration& cell_cfg_) :
45+
cell_cfg(cell_cfg_),
4546
collision_manager(cell_cfg_),
4647
slots_ctx({static_vector<rnti_t, pucch_constants::MAX_NOF_CELL_PUCCH_RESOURCES>(cell_cfg_.ded_pucch_resources.size(),
4748
rnti_t::INVALID_RNTI)})
@@ -381,13 +382,10 @@ pucch_harq_resource_alloc_record pucch_resource_manager::reserve_next_harq_res_a
381382
// Get the array of resources for the specific UE.
382383
const auto& ue_res_set_id_list = pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(res_set_idx)].pucch_res_id_list;
383384

384-
// [Implementation-defined] Format 0/1 resources are at the beginning of the list, while Format 2/3/4 are at the end.
385-
const bool is_f0_and_f2 = pucch_cfg.pucch_res_list.front().format == pucch_format::FORMAT_0 and
386-
pucch_cfg.pucch_res_list.back().format == pucch_format::FORMAT_2;
387-
388385
// For PUCCH F0 and F2, we don't use the last 2 resources of the PUCCH resource set; these are reserved for CSI and SR
389386
// slots and should only be picked for through the specific PUCCH resource indicator.
390-
const unsigned nof_eligible_resource = is_f0_and_f2 ? ue_res_set_id_list.size() - 2U : ue_res_set_id_list.size();
387+
const unsigned nof_eligible_resource =
388+
cell_cfg.is_pucch_f0_and_f2() ? ue_res_set_id_list.size() - 2U : ue_res_set_id_list.size();
391389
srsran_assert(nof_eligible_resource >= 1U,
392390
"rnti={}: Not enough eligible resources from PUCCH resource set={}",
393391
crnti,
@@ -465,14 +463,10 @@ const pucch_resource* pucch_resource_manager::reserve_harq_resource_by_res_indic
465463
// [Implementation-defined] We assume at most 8 resources per resource set. If this is the case, r_pucch = d_pri.
466464
const auto pucch_res_id = ue_res_id_set_for_harq[d_pri];
467465

468-
// [Implementation-defined] Format 0/1 resources are at the beginning of the list, while Format 2/3/4 are at the end.
469-
const bool is_f0_and_f2 = pucch_cfg.pucch_res_list.front().format == pucch_format::FORMAT_0 and
470-
pucch_cfg.pucch_res_list.back().format == pucch_format::FORMAT_2;
471-
472466
// For Format 0 and Format 2, the resources indexed by PUCCH res. indicators >= ue_res_id_set_for_harq.size() - 2 are
473467
// reserved for CSI and SR slots. In the case, we don't need to reserve these in the PUCCH resource manager, we only
474468
// need to return the resources.
475-
if (is_f0_and_f2 and d_pri >= ue_res_id_set_for_harq.size() - 2U) {
469+
if (cell_cfg.is_pucch_f0_and_f2() and d_pri >= ue_res_id_set_for_harq.size() - 2U) {
476470
const auto* res_cfg = std::find_if(
477471
pucch_cfg.pucch_res_list.begin(), pucch_cfg.pucch_res_list.end(), [pucch_res_id](const pucch_resource& res) {
478472
return res.res_id.ue_res_id == pucch_res_id.ue_res_id;
@@ -533,13 +527,10 @@ bool pucch_resource_manager::release_harq_resource(slot_point slot_harq
533527
// Get the array of resources for the specific UE.
534528
const auto& ue_res_set_id_list = pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(res_set_idx)].pucch_res_id_list;
535529

536-
// [Implementation-defined] Format 0/1 resources are at the beginning of the list, while Format 2/3/4 are at the end.
537-
const bool is_f0_and_f2 = pucch_cfg.pucch_res_list.front().format == pucch_format::FORMAT_0 and
538-
pucch_cfg.pucch_res_list.back().format == pucch_format::FORMAT_2;
539-
540530
// For PUCCH F0 and F2, we don't use the last 2 resources of the PUCCH resource set; these are reserved for CSI and SR
541531
// slots and should only be picked for through the specific PUCCH resource indicator.
542-
const unsigned nof_eligible_resource = is_f0_and_f2 ? ue_res_set_id_list.size() - 2U : ue_res_set_id_list.size();
532+
const unsigned nof_eligible_resource =
533+
cell_cfg.is_pucch_f0_and_f2() ? ue_res_set_id_list.size() - 2U : ue_res_set_id_list.size();
543534
srsran_assert(nof_eligible_resource >= 1U,
544535
"rnti={}: Not enough eligible resources from PUCCH resource set={}",
545536
crnti,

lib/scheduler/pucch_scheduling/pucch_resource_manager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ class pucch_resource_manager
178178
const pucch_config& pucch_cfg,
179179
pucch_res_set_idx res_set_idx);
180180

181-
pucch_collision_manager collision_manager;
181+
const cell_configuration& cell_cfg;
182+
pucch_collision_manager collision_manager;
182183

183184
// Ring buffer of slot contexts to keep track of PUCCH resource usage in recent slots.
184185
circular_array<slot_context, cell_resource_allocator::RING_ALLOCATOR_SIZE> slots_ctx;

0 commit comments

Comments
 (0)