Skip to content

Commit c24203a

Browse files
carlo-galcodebot
authored andcommitted
sched: refactor pucch alloc draft
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent be5b8aa commit c24203a

File tree

7 files changed

+1177
-158
lines changed

7 files changed

+1177
-158
lines changed

include/srsran/ran/pucch/pucch_configuration.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,15 @@ struct pucch_config {
201201
/// \c dl-DataToUL-ACK. Values {0..15}.
202202
static_vector<uint8_t, 8> dl_data_to_ul_ack;
203203

204+
/// PUCCH resource max UCI payload, depending on the format. The index defines the format.
205+
/// \remark All the resources of the same format are configured with the same max UCI payload.
206+
/// \remark For Format 0 and 1, only the max number of HARQ-ACK bits are considered.
207+
static_vector<unsigned, 5> format_max_payload{0, 0, 0, 0, 0};
208+
209+
/// Returns the PUCCH resource max UCI payload for the given format.
210+
/// \remark For Format 0 and 1, it returns only the max number of HARQ-ACK bits.
211+
unsigned get_max_payload(pucch_format format) const { return format_max_payload[pucch_format_to_uint(format)]; }
212+
204213
bool operator==(const pucch_config& rhs) const
205214
{
206215
return pucch_res_set == rhs.pucch_res_set && pucch_res_list == rhs.pucch_res_list &&

include/srsran/ran/pucch/pucch_mapping.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ enum class pucch_group_hopping {
2525
};
2626

2727
/// \brief PUCCH Formats as described in TS38.213 Section 9.2.
28-
enum class pucch_format { FORMAT_0, FORMAT_1, FORMAT_2, FORMAT_3, FORMAT_4, NOF_FORMATS };
28+
enum class pucch_format : uint8_t { FORMAT_0, FORMAT_1, FORMAT_2, FORMAT_3, FORMAT_4, NOF_FORMATS };
29+
30+
inline uint8_t pucch_format_to_uint(pucch_format format)
31+
{
32+
return static_cast<uint8_t>(format);
33+
}
2934

3035
/// Defines whether the PUCCH within the current slot belongs to a PUCCH repetition. For more details, refer to
3136
/// TS38.213, Section 9.2.6.

include/srsran/scheduler/scheduler_pucch_format.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ enum class pucch_format_4_sf { sf2, sf4 };
4343
struct pucch_resources {
4444
prb_interval prbs;
4545
ofdm_symbol_range symbols;
46-
prb_interval second_hop_prbs;
46+
prb_interval second_hop_prbs{0U, 0U};
47+
48+
bool operator==(const pucch_resources& rhs) const
49+
{
50+
return prbs != rhs.prbs && symbols == rhs.symbols && second_hop_prbs == rhs.second_hop_prbs;
51+
}
4752
};
4853

4954
/// Scheduler output for PUCCH Format 0.

lib/du_manager/ran_resource_management/du_pucch_resource_manager.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,15 @@ bool du_pucch_resource_manager::alloc_resources(cell_group_config& cell_grp_cfg)
288288
.report_slot_offset = csi_res_offset.value().second;
289289
}
290290

291+
// Update the PUCCH max payload.
292+
cell_grp_cfg.cells[0].serv_cell_cfg.ul_config->init_ul_bwp.pucch_cfg.value().format_max_payload[pucch_format_to_uint(
293+
pucch_format::FORMAT_1)] = 2U;
294+
cell_grp_cfg.cells[0].serv_cell_cfg.ul_config->init_ul_bwp.pucch_cfg.value().format_max_payload[pucch_format_to_uint(
295+
pucch_format::FORMAT_2)] =
296+
get_pucch_format2_max_payload(user_defined_pucch_cfg.f2_params.max_nof_rbs,
297+
user_defined_pucch_cfg.f2_params.nof_symbols.to_uint(),
298+
to_max_code_rate_float(default_pucch_cfg.format_2_common_param.value().max_c_rate));
299+
291300
++cells[0].ue_idx;
292301
return true;
293302
}

lib/scheduler/config/serving_cell_config_factory.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "srsran/ran/pdcch/search_space.h"
1818
#include "srsran/ran/prach/prach_configuration.h"
1919
#include "srsran/ran/prach/prach_helper.h"
20+
#include "srsran/ran/pucch/pucch_info.h"
2021
#include "srsran/ran/resource_allocation/ofdm_symbol_range.h"
2122
#include "srsran/scheduler/config/csi_helper.h"
2223
#include "srsran/srslog/srslog.h"
@@ -645,6 +646,12 @@ uplink_config srsran::config_helpers::make_default_ue_uplink_config(const cell_c
645646
pucch_cfg.dl_data_to_ul_ack = generate_k1_candidates(*params.tdd_ul_dl_cfg_common, params.min_k1);
646647
}
647648

649+
// Compute the max UCI payload per format.
650+
pucch_cfg.format_max_payload[pucch_format_to_uint(pucch_format::FORMAT_1)] = 2U;
651+
const auto& res_f2 = std::get<pucch_format_2_3_cfg>(res_basic_f2.format_params);
652+
pucch_cfg.format_max_payload[pucch_format_to_uint(pucch_format::FORMAT_2)] = get_pucch_format2_max_payload(
653+
res_f2.nof_prbs, res_f2.nof_symbols, to_max_code_rate_float(pucch_cfg.format_2_common_param.value().max_c_rate));
654+
648655
// > PUSCH config.
649656
ul_config.init_ul_bwp.pusch_cfg.emplace(make_default_pusch_config());
650657

0 commit comments

Comments
 (0)