Skip to content

Commit 6c89743

Browse files
carlo-galcodebot
authored andcommitted
sched: add enum for pucch resource set id
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent 5ece046 commit 6c89743

File tree

10 files changed

+29
-23
lines changed

10 files changed

+29
-23
lines changed

include/srsran/ran/pucch/pucch_configuration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ struct pucch_resource {
168168
/// \ref pucch_config.
169169
struct pucch_resource_set {
170170
/// \c PUCCH-ResourceSetId.
171-
uint8_t pucch_res_set_id;
171+
pucch_res_set_idx pucch_res_set_id;
172172
/// \c resourceList.
173173
static_vector<pucch_res_id_t, MAX_NOF_PUCCH_RESOURCES_PER_PUCCH_RESOURCE_SET> pucch_res_id_list;
174174
/// \c maxPayloadSize.

include/srsran/ran/pucch/pucch_mapping.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ enum class pucch_group_hopping {
2424
DISABLE
2525
};
2626

27+
/// \brief PUCCH resource set index, as per \c PUCCH-ResourceSetId, TS 38.331.
28+
/// At the moment, we only supports PUCCH resource set index 0 and 1.
29+
enum class pucch_res_set_idx : uint8_t { set_0 = 0, set_1 };
30+
31+
inline uint8_t pucch_res_set_idx_to_uint(pucch_res_set_idx format)
32+
{
33+
return static_cast<uint8_t>(format);
34+
}
35+
2736
/// \brief PUCCH Formats as described in TS38.213 Section 9.2.
2837
enum class pucch_format : uint8_t { FORMAT_0, FORMAT_1, FORMAT_2, FORMAT_3, FORMAT_4, NOF_FORMATS };
2938

lib/du_manager/converters/asn1_rrc_config_helpers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ static bool calculate_bwp_dl_dedicated_diff(asn1::rrc_nr::bwp_dl_ded_s& out,
12891289
asn1::rrc_nr::pucch_res_set_s srsran::srs_du::make_asn1_rrc_pucch_resource_set(const pucch_resource_set& cfg)
12901290
{
12911291
pucch_res_set_s pucch_res_set;
1292-
pucch_res_set.pucch_res_set_id = cfg.pucch_res_set_id;
1292+
pucch_res_set.pucch_res_set_id = static_cast<uint8_t>(cfg.pucch_res_set_id);
12931293
for (const auto& it : cfg.pucch_res_id_list) {
12941294
pucch_res_set.res_list.push_back(it.ue_res_id);
12951295
}
@@ -1517,7 +1517,7 @@ calculate_pucch_config_diff(asn1::rrc_nr::pucch_cfg_s& out, const pucch_config&
15171517
src.pucch_res_set,
15181518
dest.pucch_res_set,
15191519
[](const pucch_resource_set& res_set) { return make_asn1_rrc_pucch_resource_set(res_set); },
1520-
[](const pucch_resource_set& res_set) { return res_set.pucch_res_set_id; });
1520+
[](const pucch_resource_set& res_set) { return static_cast<uint8_t>(res_set.pucch_res_set_id); });
15211521

15221522
// PUCCH Resource.
15231523
calculate_addmodremlist_diff(

lib/du_manager/ran_resource_management/pucch_resource_generator.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,22 +573,21 @@ bool srsran::srs_du::ue_pucch_config_builder(serving_cell_config&
573573
return false;
574574
}
575575

576-
const unsigned f1_pucch_res_set_id = 0;
577-
const unsigned f2_pucch_res_set_id = 1;
578-
579576
// PUCCH resource ID corresponding to \c pucch-ResourceId, as part of \c PUCCH-Resource, in \c PUCCH-Config,
580577
// TS 38.331. By default, we index the PUCCH resource ID for ASN1 message from 0 to pucch_res_list.size() - 1.
581578
unsigned ue_pucch_res_id = 0;
582579

583580
pucch_config& pucch_cfg = serv_cell_cfg.ul_config.value().init_ul_bwp.pucch_cfg.value();
584581
// Clears current PUCCH resource list and PUCCH resource list set 0 and 1.
585582
pucch_cfg.pucch_res_list.clear();
586-
pucch_cfg.pucch_res_set[f1_pucch_res_set_id].pucch_res_id_list.clear();
587-
pucch_cfg.pucch_res_set[f2_pucch_res_set_id].pucch_res_id_list.clear();
583+
pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(pucch_res_set_idx::set_0)].pucch_res_id_list.clear();
584+
pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(pucch_res_set_idx::set_1)].pucch_res_id_list.clear();
588585

589586
// Ensure the PUCCH resource sets ID are 0 and 1.
590-
pucch_cfg.pucch_res_set[f1_pucch_res_set_id].pucch_res_set_id = f1_pucch_res_set_id;
591-
pucch_cfg.pucch_res_set[f2_pucch_res_set_id].pucch_res_set_id = f2_pucch_res_set_id;
587+
pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(pucch_res_set_idx::set_0)].pucch_res_set_id =
588+
pucch_res_set_idx::set_0;
589+
pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(pucch_res_set_idx::set_1)].pucch_res_set_id =
590+
pucch_res_set_idx::set_1;
592591

593592
// Add F1 for HARQ.
594593
const unsigned f1_idx_offset = (du_harq_set_idx % nof_harq_pucch_sets) * nof_ue_pucch_f1_res_harq.to_uint();
@@ -603,7 +602,7 @@ bool srsran::srs_du::ue_pucch_config_builder(serving_cell_config&
603602
.format_params = cell_res.format_params});
604603

605604
// Add PUCCH resource index to pucch_res_id_list of PUCCH resource set id=0.
606-
pucch_cfg.pucch_res_set[f1_pucch_res_set_id].pucch_res_id_list.emplace_back(
605+
pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(pucch_res_set_idx::set_0)].pucch_res_id_list.emplace_back(
607606
pucch_res_id_t{cell_res.res_id.cell_res_id, ue_pucch_res_id});
608607

609608
// Increment the PUCCH resource ID for ASN1 message.
@@ -635,7 +634,7 @@ bool srsran::srs_du::ue_pucch_config_builder(serving_cell_config&
635634
.format_params = cell_res.format_params});
636635

637636
// Add PUCCH resource index to pucch_res_id_list of PUCCH resource set id=1.
638-
pucch_cfg.pucch_res_set[f2_pucch_res_set_id].pucch_res_id_list.emplace_back(
637+
pucch_cfg.pucch_res_set[pucch_res_set_idx_to_uint(pucch_res_set_idx::set_1)].pucch_res_id_list.emplace_back(
639638
pucch_res_id_t{cell_res.res_id.cell_res_id, ue_pucch_res_id});
640639
// Increment the PUCCH resource ID for ASN1 message.
641640
++ue_pucch_res_id;

lib/scheduler/config/serving_cell_config_factory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,14 @@ uplink_config srsran::config_helpers::make_default_ue_uplink_config(const cell_c
527527

528528
// PUCCH Resource Set ID 0. This is for PUCCH Format 1 only (Format 0 not yet supported), used for HARQ-ACK only.
529529
auto& pucch_res_set_0 = pucch_cfg.pucch_res_set.emplace_back();
530-
pucch_res_set_0.pucch_res_set_id = 0;
530+
pucch_res_set_0.pucch_res_set_id = pucch_res_set_idx::set_0;
531531
pucch_res_set_0.pucch_res_id_list.emplace_back(pucch_res_id_t{0, 0});
532532
pucch_res_set_0.pucch_res_id_list.emplace_back(pucch_res_id_t{1, 1});
533533
pucch_res_set_0.pucch_res_id_list.emplace_back(pucch_res_id_t{2, 2});
534534

535535
// PUCCH Resource Set ID 1. This is for PUCCH Format 2 only and used for HARQ-ACK + optionally SR and/or CSI.
536536
auto& pucch_res_set_1 = pucch_cfg.pucch_res_set.emplace_back();
537-
pucch_res_set_1.pucch_res_set_id = 1;
537+
pucch_res_set_1.pucch_res_set_id = pucch_res_set_idx::set_1;
538538
pucch_res_set_1.pucch_res_id_list.emplace_back(pucch_res_id_t{3, 3});
539539
pucch_res_set_1.pucch_res_id_list.emplace_back(pucch_res_id_t{4, 4});
540540
pucch_res_set_1.pucch_res_id_list.emplace_back(pucch_res_id_t{5, 5});

lib/scheduler/config/serving_cell_config_validator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ validator_result srsran::config_validators::validate_pucch_cfg(const serving_cel
138138
// Verify that the PUCCH resources IDs of each PUCCH resource set point at a corresponding item in the PUCCH reource
139139
// list.
140140
VERIFY(pucch_cfg.pucch_res_set.size() >= 2, "At least 2 PUCCH resource sets need to be configured in PUCCH-Config");
141-
VERIFY(pucch_cfg.pucch_res_set[0].pucch_res_set_id == 0 and pucch_cfg.pucch_res_set[1].pucch_res_set_id == 1,
141+
VERIFY(pucch_cfg.pucch_res_set[0].pucch_res_set_id == pucch_res_set_idx::set_0 and
142+
pucch_cfg.pucch_res_set[1].pucch_res_set_id == pucch_res_set_idx::set_1,
142143
"PUCCH resouce sets 0 and 1 are expected to have PUCCH-ResourceSetId 0 and 1, respectively");
143144
VERIFY((not pucch_cfg.pucch_res_set[0].pucch_res_id_list.empty()) and
144145
(not pucch_cfg.pucch_res_set[1].pucch_res_id_list.empty()),

lib/scheduler/pucch_scheduling/pucch_allocator_impl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ class pucch_allocator_impl final : public pucch_allocator
8787
unsigned r_pucch;
8888
};
8989

90-
// At the moment, we only supports PUCCH resource set index 0 and 1.
91-
enum class pucch_res_set_idx : uint8_t { set_0 = 0, set_1 };
92-
9390
struct harq_res_id {
9491
pucch_res_set_idx pucch_set_idx = pucch_res_set_idx::set_0;
9592
uint8_t pucch_res_ind = 0;

tests/unittests/du_manager/serving_cell_config_converter_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ TEST(serving_cell_config_converter_test, test_ue_custom_pucch_cfg_conversion)
403403

404404
// >> PUCCH Resource Set 1.
405405
dest_pucch_cfg.pucch_res_set.emplace_back();
406-
dest_pucch_cfg.pucch_res_set.back().pucch_res_set_id = 1;
406+
dest_pucch_cfg.pucch_res_set.back().pucch_res_set_id = srsran::pucch_res_set_idx::set_1;
407407
dest_pucch_cfg.pucch_res_set.back().pucch_res_id_list.emplace_back(pucch_res_id_t{1, 1});
408408
// Remove first element.
409409
dest_pucch_cfg.pucch_res_set.erase(dest_pucch_cfg.pucch_res_set.begin());

tests/unittests/scheduler/test_utils/config_generators.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ inline uplink_config make_test_ue_uplink_config(const config_helpers::cell_confi
134134
auto& pucch_cfg = ul_config.init_ul_bwp.pucch_cfg.value();
135135
// PUCCH Resource Set ID 0.
136136
auto& pucch_res_set_0 = pucch_cfg.pucch_res_set.emplace_back();
137-
pucch_res_set_0.pucch_res_set_id = 0;
137+
pucch_res_set_0.pucch_res_set_id = pucch_res_set_idx::set_0;
138138
pucch_res_set_0.pucch_res_id_list.emplace_back(pucch_res_id_t{0, 0});
139139
pucch_res_set_0.pucch_res_id_list.emplace_back(pucch_res_id_t{1, 1});
140140
pucch_res_set_0.pucch_res_id_list.emplace_back(pucch_res_id_t{2, 2});
141141

142142
auto& pucch_res_set_1 = pucch_cfg.pucch_res_set.emplace_back();
143-
pucch_res_set_1.pucch_res_set_id = 1;
143+
pucch_res_set_1.pucch_res_set_id = pucch_res_set_idx::set_1;
144144
pucch_res_set_1.pucch_res_id_list.emplace_back(pucch_res_id_t{3, 3});
145145
pucch_res_set_1.pucch_res_id_list.emplace_back(pucch_res_id_t{4, 4});
146146
pucch_res_set_1.pucch_res_id_list.emplace_back(pucch_res_id_t{5, 5});

tests/unittests/scheduler/uci_and_pucch/pucch_res_manager_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ class test_pucch_res_manager_multiple_cfg : public test_pucch_resource_manager
425425
default_pucch_cfg.pucch_res_set[1].pucch_res_id_list.clear();
426426

427427
// Ensure the PUCCH resource sets ID are 0 and 1.
428-
default_pucch_cfg.pucch_res_set[0].pucch_res_set_id = 0;
429-
default_pucch_cfg.pucch_res_set[1].pucch_res_set_id = 1;
428+
default_pucch_cfg.pucch_res_set[0].pucch_res_set_id = srsran::pucch_res_set_idx::set_0;
429+
default_pucch_cfg.pucch_res_set[1].pucch_res_set_id = srsran::pucch_res_set_idx::set_1;
430430

431431
const unsigned tot_ue_f1_res = nof_ue_pucch_f1_res_harq + nof_ue_pucch_f1_res_sr;
432432
const unsigned tot_ue_f2_res = nof_ue_pucch_f2_res_harq + nof_ue_pucch_f2_res_csi;

0 commit comments

Comments
 (0)