Skip to content

Commit b55cb0e

Browse files
committed
phy: refactor push validator (review changes)
1 parent c4e91b0 commit b55cb0e

File tree

8 files changed

+40
-24
lines changed

8 files changed

+40
-24
lines changed

include/srsran/phy/upper/channel_processors/pusch/pusch_processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class pusch_pdu_validator
184184
virtual ~pusch_pdu_validator() = default;
185185

186186
/// \brief Validates PUSCH processor configuration parameters.
187-
/// \return True if the parameters contained in \c pdu are supported, false otherwise.
187+
/// \return A success if the parameters contained in \c pdu are supported, an error message otherwise.
188188
virtual error_type<std::string> is_valid(const pusch_processor::pdu_t& pdu) const = 0;
189189
};
190190

include/srsran/phy/upper/uplink_processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class uplink_pdu_validator
161161
virtual error_type<std::string> is_valid(const pucch_processor::format4_configuration& config) const = 0;
162162

163163
/// \brief Validates PUSCH configuration parameters.
164-
/// \return True if the parameters contained in \c config are supported, false otherwise.
164+
/// \return A success if the parameters contained in \c pdu are supported, an error message otherwise.
165165
virtual error_type<std::string> is_valid(const pusch_processor::pdu_t& config) const = 0;
166166

167167
/// \brief Validates Sounding Reference Signals channel estimator configuration.

lib/phy/upper/channel_processors/pusch/factories.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class pusch_processor_factory_generic : public pusch_processor_factory
238238
config.dec_nof_iterations = dec_nof_iterations;
239239
config.dec_enable_early_stop = dec_enable_early_stop;
240240
config.csi_sinr_calc_method = csi_sinr_calc_method;
241-
return std::make_unique<pusch_processor_impl>(create_validator(), config);
241+
return std::make_unique<pusch_processor_impl>(config);
242242
}
243243

244244
std::unique_ptr<pusch_pdu_validator> create_validator() override

lib/phy/upper/channel_processors/pusch/pusch_processor_impl.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "pusch_processor_impl.h"
1212
#include "pusch_decoder_buffer_dummy.h"
1313
#include "pusch_processor_notifier_adaptor.h"
14+
#include "pusch_processor_validator_impl.h"
15+
1416
#include "srsran/phy/upper/channel_processors/pusch/formatters.h"
1517
#include "srsran/phy/upper/channel_processors/pusch/pusch_codeword_buffer.h"
1618
#include "srsran/phy/upper/channel_processors/pusch/pusch_decoder_buffer.h"
@@ -101,8 +103,7 @@ class pusch_processor_csi_part1_feedback_impl : public pusch_processor_csi_part1
101103
// Dummy PUSCH decoder buffer. Used for PUSCH transmissions without SCH data.
102104
static pusch_decoder_buffer_dummy decoder_buffer_dummy;
103105

104-
pusch_processor_impl::pusch_processor_impl(std::unique_ptr<pusch_pdu_validator> pdu_validator_, configuration& config) :
105-
pdu_validator(std::move(pdu_validator_)),
106+
pusch_processor_impl::pusch_processor_impl(configuration& config) :
106107
thread_local_dependencies_pool(std::move(config.thread_local_dependencies_pool)),
107108
decoder(std::move(config.decoder)),
108109
dec_nof_iterations(config.dec_nof_iterations),
@@ -130,7 +131,8 @@ void pusch_processor_impl::process(span<uint8_t> data,
130131

131132
// Assert PDU.
132133
[[maybe_unused]] std::string msg;
133-
srsran_assert(handle_validation(msg, pdu_validator->is_valid(pdu)), "{}", msg);
134+
srsran_assert(
135+
handle_validation(msg, pusch_processor_validator_impl(ch_estimate.capacity()).is_valid(pdu)), "{}", msg);
134136

135137
// Number of RB used by this transmission.
136138
unsigned nof_rb = pdu.freq_alloc.get_nof_rb();

lib/phy/upper/channel_processors/pusch/pusch_processor_impl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class pusch_processor_impl : public pusch_processor
107107
};
108108

109109
/// \brief Constructs a generic software PUSCH processor.
110-
/// \param[in] config PUSCH processor dependencies and configuration parameters.
111-
pusch_processor_impl(std::unique_ptr<pusch_pdu_validator> pdu_validator_, configuration& config);
110+
/// \param[in] config PUSCH processor dependencies and configuration parameters.
111+
pusch_processor_impl(configuration& config);
112112

113113
// See interface for documentation.
114114
void process(span<uint8_t> data,
@@ -118,8 +118,6 @@ class pusch_processor_impl : public pusch_processor
118118
const pdu_t& pdu) override;
119119

120120
private:
121-
/// PUSCH PDU validator.
122-
std::unique_ptr<pusch_pdu_validator> pdu_validator;
123121
/// Thread local dependencies pool.
124122
std::shared_ptr<concurrent_dependencies_pool_type> thread_local_dependencies_pool;
125123
/// UL-SCH transport block decoder.

lib/phy/upper/channel_processors/pusch/pusch_processor_validator_impl.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ error_type<std::string> pusch_processor_validator_impl::is_valid(const pusch_pro
6363

6464
// The frequency allocation is not compatible with the BWP parameters.
6565
if (!pdu.freq_alloc.is_bwp_valid(pdu.bwp_start_rb, pdu.bwp_size_rb)) {
66-
return make_unexpected(fmt::format("Invalid BWP configuration {}:{}.", pdu.bwp_start_rb, pdu.bwp_size_rb));
66+
return make_unexpected(
67+
fmt::format("Invalid BWP configuration, i.e., [{}, {}) for the given RB allocation, i.e., {}.",
68+
pdu.bwp_start_rb,
69+
pdu.bwp_start_rb + pdu.bwp_size_rb,
70+
pdu.freq_alloc));
6771
}
6872

6973
// Currently, none of the UCI field sizes can exceed 11 bit.
@@ -90,15 +94,15 @@ error_type<std::string> pusch_processor_validator_impl::is_valid(const pusch_pro
9094

9195
// The number of OFDM symbols in the DM-RS mask must be equal to the number of OFDM symbols in a slot.
9296
if (pdu.dmrs_symbol_mask.size() != nof_symbols_slot) {
93-
return make_unexpected(fmt::format("The DM-RS symbol mask size (i.e., {}) must be the same as the number of "
94-
"symbols allocated to the transmission within the slot (i.e., {}).",
95-
pdu.dmrs_symbol_mask.size(),
96-
nof_symbols_slot));
97+
return make_unexpected(
98+
fmt::format("The DM-RS symbol mask size (i.e., {}) must be equal to the slot size (i.e., {}).",
99+
pdu.dmrs_symbol_mask.size(),
100+
nof_symbols_slot));
97101
}
98102

99103
// The number of symbols carrying DM-RS must be greater than zero.
100104
if (pdu.dmrs_symbol_mask.none()) {
101-
return make_unexpected("The number of OFDM symbols carrying DM-RS RE must be greater than zero.");
105+
return make_unexpected("The number of OFDM symbols carrying DM-RS must be greater than zero.");
102106
}
103107

104108
// The index of the first OFDM symbol carrying DM-RS shall be equal to or greater than the first symbol allocated to
@@ -123,7 +127,8 @@ error_type<std::string> pusch_processor_validator_impl::is_valid(const pusch_pro
123127

124128
// None of the occupied symbols must exceed the slot size.
125129
if (nof_symbols_slot < (pdu.start_symbol_index + pdu.nof_symbols)) {
126-
return make_unexpected(fmt::format("The occupied symbols (i.e., {}) exceed the slot size (i.e., {}).",
130+
return make_unexpected(fmt::format("The symbol allocation (i.e., [{}, {})) exceeds the slot size (i.e., {}).",
131+
pdu.start_symbol_index,
127132
pdu.start_symbol_index + pdu.nof_symbols,
128133
nof_symbols_slot));
129134
}

tests/integrationtests/phy/upper/channel_processors/pxsch_bler_test_factories.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ std::shared_ptr<pusch_processor_factory> srsran::create_sw_pusch_processor_facto
275275
pusch_proc_factory_config.decoder_factory = pusch_dec_factory;
276276
pusch_proc_factory_config.uci_dec_factory = uci_dec_factory;
277277
pusch_proc_factory_config.ch_estimate_dimensions = {
278-
MAX_NOF_PRBS, MAX_NSYMB_PER_SLOT, pusch_constants::MAX_NOF_RX_PORTS, pusch_constants::MAX_NOF_LAYERS};
278+
MAX_NOF_PRBS, MAX_NSYMB_PER_SLOT, pusch_constants::MAX_NOF_RX_PORTS, 1};
279279
pusch_proc_factory_config.dec_nof_iterations = nof_ldpc_iterations;
280280
pusch_proc_factory_config.dec_enable_early_stop = dec_enable_early_stop;
281281
pusch_proc_factory_config.max_nof_concurrent_threads = max_nof_threads;

tests/unittests/phy/upper/channel_processors/pusch/pusch_processor_validator_test.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ const std::vector<test_case_t> pusch_processor_validator_test_data = {
8585
pdu.bwp_size_rb = 1;
8686
return pdu;
8787
},
88-
// TODO: since vrb_mask was private I took out the part that said "for a VRB mask of size 16"
89-
R"(Invalid BWP configuration 0:1\.)"},
88+
R"(Invalid BWP configuration, i\.e\., \[0, 1\) for the given RB allocation, i\.e\., \[15, 16\)\.)"},
9089
{[] {
9190
pusch_processor::pdu_t pdu = base_pdu;
9291
pdu.uci.nof_csi_part1 = 0;
@@ -99,13 +98,14 @@ const std::vector<test_case_t> pusch_processor_validator_test_data = {
9998
pdu.dmrs_symbol_mask = {true};
10099
return pdu;
101100
},
102-
R"(The DM-RS symbol mask size \(i\.e\., 1\) must be the same as the number of symbols allocated to the transmission within the slot \(i\.e\., 14\)\.)"},
101+
R"(The DM-RS symbol mask size \(i\.e\., 1\) must be equal to the slot size \(i\.e\., 14\)\.)"},
102+
103103
{[] {
104104
pusch_processor::pdu_t pdu = base_pdu;
105105
pdu.dmrs_symbol_mask = symbol_slot_mask(get_nsymb_per_slot(pdu.cp));
106106
return pdu;
107107
},
108-
R"(The number of OFDM symbols carrying DM-RS RE must be greater than zero\.)"},
108+
R"(The number of OFDM symbols carrying DM-RS must be greater than zero\.)"},
109109
{[] {
110110
pusch_processor::pdu_t pdu = base_pdu;
111111
pdu.dmrs_symbol_mask = symbol_slot_mask(get_nsymb_per_slot(pdu.cp));
@@ -131,7 +131,7 @@ const std::vector<test_case_t> pusch_processor_validator_test_data = {
131131
pdu.nof_symbols = 15;
132132
return pdu;
133133
},
134-
R"(The occupied symbols \(i\.e\., 15\) exceed the slot size \(i\.e\., 14\)\.)"},
134+
R"(The symbol allocation \(i\.e\., \[0, 15\)\) exceeds the slot size \(i\.e\., 14\)\.)"},
135135
{[] {
136136
pusch_processor::pdu_t pdu = base_pdu;
137137
std::get<pusch_processor::dmrs_configuration>(pdu.dmrs).dmrs = dmrs_type::TYPE2;
@@ -178,7 +178,18 @@ const std::vector<test_case_t> pusch_processor_validator_test_data = {
178178
return pdu;
179179
},
180180
R"(Transform precoding is only possible with a valid number of PRB\.)"},
181-
181+
{[] {
182+
pusch_processor::pdu_t pdu = base_pdu;
183+
pdu.uci.nof_harq_ack = 12;
184+
return pdu;
185+
},
186+
R"(UCI field sizes in bits \(12, 1\), exceed the maximum bit size, i\.e\., 11\.)"},
187+
{[] {
188+
pusch_processor::pdu_t pdu = base_pdu;
189+
pdu.uci.nof_csi_part1 = 12;
190+
return pdu;
191+
},
192+
R"(UCI field sizes in bits \(0, 12\), exceed the maximum bit size, i\.e\., 11\.)"},
182193
};
183194

184195
class PuschProcessorFixture : public ::testing::TestWithParam<test_case_t>

0 commit comments

Comments
 (0)