Skip to content

Commit 8edeeac

Browse files
committed
sched: fix pmi selection for the case of 1 layer and 2 ports
1 parent ae56bd8 commit 8edeeac

File tree

3 files changed

+45
-17
lines changed

3 files changed

+45
-17
lines changed

lib/scheduler/ue_scheduling/ue_cell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ue_cell::ue_cell(du_ue_index_t ue_index_,
2929
ue_index(ue_index_),
3030
cell_index(ue_serv_cell.cell_index),
3131
harqs(crnti_val, (unsigned)ue_serv_cell.pdsch_serv_cell_cfg->nof_harq_proc, NOF_UL_HARQS, harq_timeout_notifier),
32-
channel_state(expert_cfg_),
32+
channel_state(ue_serv_cell, expert_cfg_),
3333
crnti_(crnti_val),
3434
expert_cfg(expert_cfg_),
3535
ue_cfg(cell_cfg_common_, ue_serv_cell),

lib/scheduler/ue_scheduling/ue_channel_state_manager.cpp

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,36 @@
1212

1313
using namespace srsran;
1414

15-
static constexpr size_t TWO_LAYER_INDEX = 0;
16-
static constexpr size_t FOUR_LAYER_INDEX = 1;
15+
/// Find the number of DL ports for a given UE serving cell configuration.
16+
static unsigned compute_nof_dl_ports(const serving_cell_config& serv_cell_cfg)
17+
{
18+
if (not serv_cell_cfg.csi_meas_cfg.has_value()) {
19+
return 1;
20+
}
1721

18-
ue_channel_state_manager::ue_channel_state_manager(const scheduler_ue_expert_config& expert_cfg) :
22+
unsigned max_ports = 1;
23+
for (const auto& nzp : serv_cell_cfg.csi_meas_cfg->nzp_csi_rs_res_list) {
24+
if (max_ports < nzp.res_mapping.nof_ports) {
25+
max_ports = nzp.res_mapping.nof_ports;
26+
}
27+
}
28+
return max_ports;
29+
}
30+
31+
ue_channel_state_manager::ue_channel_state_manager(const serving_cell_config& ue_serv_cell,
32+
const scheduler_ue_expert_config& expert_cfg) :
33+
nof_dl_ports(compute_nof_dl_ports(ue_serv_cell)),
34+
pusch_snr_db(expert_cfg.initial_ul_sinr),
1935
wideband_cqi(expert_cfg.initial_cqi)
2036
{
21-
// Set initial UL SINR.
22-
update_pusch_snr(expert_cfg.initial_ul_sinr);
23-
24-
// Set initial precoding when no CSI has yet been received.
25-
recommended_prg_info[TWO_LAYER_INDEX].type = pdsch_precoding_info::prg_info::two_antenna_port{0};
26-
recommended_prg_info[FOUR_LAYER_INDEX].type =
27-
pdsch_precoding_info::prg_info::typeI_single_panel_4ports_mode1{0, 0, nullopt, 0};
37+
// Set initial precoding value when no CSI has yet been received.
38+
if (nof_dl_ports == 2) {
39+
recommended_prg_info.resize(2, pdsch_precoding_info::prg_info{pdsch_precoding_info::prg_info::two_antenna_port{0}});
40+
} else if (nof_dl_ports == 4) {
41+
recommended_prg_info.resize(3,
42+
pdsch_precoding_info::prg_info{
43+
pdsch_precoding_info::prg_info::typeI_single_panel_4ports_mode1{0, 0, nullopt, 0}});
44+
}
2845
}
2946

3047
void ue_channel_state_manager::handle_csi_report(const csi_report_data& csi_report)
@@ -39,10 +56,11 @@ void ue_channel_state_manager::handle_csi_report(const csi_report_data& csi_repo
3956
// Update recommended number of layers based on RI.
4057
if (csi_report.ri.has_value()) {
4158
recommended_dl_layers = csi_report.ri.value().to_uint();
59+
srsran_sanity_check(recommended_dl_layers < nof_dl_ports, "Invalid RI reported");
4260
}
4361

4462
if (csi_report.pmi.has_value()) {
45-
const unsigned table_idx = recommended_dl_layers >> 2U;
63+
const unsigned table_idx = nof_layers_to_index(recommended_dl_layers);
4664
recommended_prg_info[table_idx] = csi_report.pmi.value();
4765
}
4866
}

lib/scheduler/ue_scheduling/ue_channel_state_manager.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "srsran/ran/csi_report/csi_report_wideband_cqi.h"
1414
#include "srsran/scheduler/config/scheduler_expert_config.h"
15+
#include "srsran/scheduler/config/serving_cell_config.h"
1516
#include "srsran/scheduler/scheduler_slot_handler.h"
1617

1718
namespace srsran {
@@ -21,7 +22,7 @@ namespace srsran {
2122
class ue_channel_state_manager
2223
{
2324
public:
24-
ue_channel_state_manager(const scheduler_ue_expert_config& expert_cfg_);
25+
ue_channel_state_manager(const serving_cell_config& ue_serv_cell, const scheduler_ue_expert_config& expert_cfg_);
2526

2627
const optional<csi_report_data>& get_latest_csi_report() const { return latest_csi_report; }
2728

@@ -41,21 +42,30 @@ class ue_channel_state_manager
4142
/// \brief Fetches the precoding codebook to be used in DL based on reported PMI and the chosen nof layers.
4243
optional<pdsch_precoding_info> get_precoding(unsigned chosen_nof_layers, prb_interval pdsch_prbs) const
4344
{
45+
srsran_assert(chosen_nof_layers <= nof_dl_ports, "Invalid number of layers chosen");
4446
optional<pdsch_precoding_info> precoding_info;
45-
if (chosen_nof_layers <= 1) {
47+
if (nof_dl_ports <= 1) {
48+
// In case of 1 DL port, no precoding is used.
4649
return precoding_info;
4750
}
4851
precoding_info.emplace();
4952
precoding_info->nof_rbs_per_prg = pdsch_prbs.length();
50-
precoding_info->prg_infos.emplace_back(recommended_prg_info[chosen_nof_layers >> 2U]);
53+
precoding_info->prg_infos.emplace_back(recommended_prg_info[nof_layers_to_index(chosen_nof_layers)]);
5154
return precoding_info;
5255
}
5356

5457
/// Update UE with the latest CSI report for a given cell.
5558
void handle_csi_report(const csi_report_data& csi_report);
5659

5760
private:
58-
static constexpr size_t NOF_LAYER_CHOICES = 2;
61+
/// \brief Number of indexes -> nof_layers for precoding (Options: 1 layer, 2 layers, 4 layers).
62+
static constexpr size_t NOF_LAYER_CHOICES = 3;
63+
64+
/// Mapping of number of layers to array index.
65+
static size_t nof_layers_to_index(unsigned nof_layers) { return nof_layers >> 1U; }
66+
67+
/// \brief Number of DL ports.
68+
unsigned nof_dl_ports;
5969

6070
/// Estimated PUSCH SNR, in dB.
6171
float pusch_snr_db;
@@ -68,7 +78,7 @@ class ue_channel_state_manager
6878

6979
/// \brief List of Recommended PMIs for different number of active layers. Position 0 is for 1 layer, position 1 is
7080
/// for 2 layers and position 3 for 4 layers.
71-
std::array<pdsch_precoding_info::prg_info, NOF_LAYER_CHOICES> recommended_prg_info;
81+
static_vector<pdsch_precoding_info::prg_info, NOF_LAYER_CHOICES> recommended_prg_info;
7282

7383
/// Latest CSI report received from the UE.
7484
optional<csi_report_data> latest_csi_report;

0 commit comments

Comments
 (0)