Skip to content

Commit 9f57464

Browse files
ofontbachcodebot
authored andcommitted
hal: fixes external harq size request function, initializes private vector sizes
1 parent a6c471d commit 9f57464

File tree

11 files changed

+19
-13
lines changed

11 files changed

+19
-13
lines changed

include/srsran/hal/dpdk/bbdev/bbdev_acc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class bbdev_acc
7878
unsigned get_nof_fft_cores() const { return nof_fft_lcores; }
7979

8080
/// Returns the size of the (external) HARQ buffer size embedded in the hardware-accelerator.
81-
/// \return HARQ buffer size (in bytes).
82-
units::bytes get_harq_buff_size() const { return units::bytes(1024 * info.drv.harq_buffer_size); }
81+
/// \return HARQ buffer size in bytes. Note that 64 bits are used to enable sizes >= 4GB.
82+
uint64_t get_harq_buff_size_bytes() const { return static_cast<uint64_t>(info.drv.harq_buffer_size) * 1024; }
8383

8484
/// Returns the size of each mbuf used to exchange unencoded and unrate-matched messages with the accelerator.
8585
/// \return Unencoded and unrate-matched mbuf size (in bytes).

include/srsran/hal/phy/upper/channel_processors/pusch/ext_harq_buffer_context_repository.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
#pragma once
1515

1616
#include "srsran/support/srsran_assert.h"
17+
#include "srsran/support/units.h"
1718
#include <vector>
1819

1920
namespace srsran {
2021
namespace hal {
2122

2223
/// Fixed CB-offset increment used in the accelerator's HARQ memory.
2324
/// Note that it is assumed that the HARQ memory is organized in N slots of HARQ_INCR bytes.
24-
static constexpr unsigned HARQ_INCR = 32768;
25+
static constexpr units::bytes HARQ_INCR{32768};
2526

2627
/// External HARQ buffer context.
2728
struct ext_harq_buffer_context_entry {
@@ -39,10 +40,10 @@ class ext_harq_buffer_context_repository
3940
/// \param[in] nof_codeblocks_ Indicates the number of codeblocks to store in the repository.
4041
/// \param[in] ext_harq_buff_size Size of the external HARQ buffer (in bytes).
4142
/// \param[in] debug_mode_ Requests to implement the debug mode (meant for unittesting).
42-
explicit ext_harq_buffer_context_repository(unsigned nof_codeblocks_, unsigned ext_harq_buff_size, bool debug_mode_) :
43+
explicit ext_harq_buffer_context_repository(unsigned nof_codeblocks_, uint64_t ext_harq_buff_size, bool debug_mode_) :
4344
nof_codeblocks(nof_codeblocks_)
4445
{
45-
unsigned requested_size = nof_codeblocks_ * HARQ_INCR;
46+
uint64_t requested_size = static_cast<uint64_t>(nof_codeblocks_) * static_cast<uint64_t>(HARQ_INCR.value());
4647
srsran_assert(requested_size <= ext_harq_buff_size,
4748
"Requested size ({} bytes) for {} codeblocks exceeds external HARQ buffer capacity ({} bytes).",
4849
requested_size,

include/srsran/hal/phy/upper/channel_processors/pusch/ext_harq_buffer_context_repository_factory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace hal {
1818
/// Returns a ext_harq_buffer_context_repository instance on success, otherwise returns nullptr.
1919
std::shared_ptr<ext_harq_buffer_context_repository>
2020
create_ext_harq_buffer_context_repository(unsigned nof_codeblocks,
21-
unsigned ext_harq_buff_size,
21+
uint64_t ext_harq_buff_size,
2222
bool debug_mode = false);
2323

2424
} // namespace hal

lib/hal/dpdk/bbdev/ldpc/bbdev_ldpc_decoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool dpdk::set_ldpc_dec_bbdev_data(::rte_bbdev_dec_op& dec_op,
131131
dec_op.ldpc_dec.input.length += cw_len;
132132

133133
// Harq offset for the current CB (based on its unique absolute ID).
134-
unsigned harq_offset = srsran::hal::HARQ_INCR * absolute_cb_id;
134+
unsigned harq_offset = srsran::hal::HARQ_INCR.value() * absolute_cb_id;
135135

136136
// Input HARQ combining data is only needed in case of a retransmission.
137137
if (!new_data) {

lib/hal/phy/upper/channel_processors/pusch/ext_harq_buffer_context_repository_factory.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ using namespace srsran;
1414
using namespace hal;
1515

1616
std::shared_ptr<ext_harq_buffer_context_repository>
17-
srsran::hal::create_ext_harq_buffer_context_repository(unsigned nof_rnti, unsigned nof_harq_id, bool debug_mode)
17+
srsran::hal::create_ext_harq_buffer_context_repository(unsigned nof_codeblocks,
18+
uint64_t ext_harq_buff_size,
19+
bool debug_mode)
1820
{
19-
return std::make_shared<ext_harq_buffer_context_repository>(nof_rnti, nof_harq_id, debug_mode);
21+
return std::make_shared<ext_harq_buffer_context_repository>(nof_codeblocks, ext_harq_buff_size, debug_mode);
2022
}

lib/phy/upper/channel_processors/pdsch_encoder_hw_impl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ void pdsch_encoder_hw_impl::encode(span<uint8_t> codeword,
120120
srsran_assert(offset + rm_length <= codeword.size(), "Wrong codeword length.");
121121

122122
codeblock = span<uint8_t>(codeword).subspan(offset, rm_length);
123+
codeblock_packed.resize(rm_length);
123124
} else {
124125
codeblock = codeword;
126+
codeblock_packed.resize(codeword.size());
125127
}
126128

127129
// Make sure at least one operation is dequeued.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class pusch_decoder_hw_impl : public pusch_decoder, private pusch_decoder_buffer
7373
srsran_assert(crc_set.crc24B->get_generator_poly() == crc_generator_poly::CRC24B,
7474
"Not a CRC generator of type CRC24B.");
7575
srsran_assert(decoder, "Invalid hardware-accelerated PUSCH decoder.");
76+
absolute_cb_ids.resize(MAX_NOF_SEGMENTS);
7677
}
7778

7879
// See interface for the documentation.

tests/benchmarks/phy/upper/channel_processors/pusch/pusch_decoder_hwacc_benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static std::shared_ptr<hal::hw_accelerator_pusch_dec_factory> create_hw_accelera
206206

207207
// Interfacing to a shared external HARQ buffer context repository.
208208
unsigned nof_cbs = MAX_NOF_SEGMENTS;
209-
unsigned acc100_ext_harq_buff_size = bbdev_accelerator->get_harq_buff_size().value();
209+
uint64_t acc100_ext_harq_buff_size = bbdev_accelerator->get_harq_buff_size_bytes();
210210
std::shared_ptr<ext_harq_buffer_context_repository> harq_buffer_context =
211211
create_ext_harq_buffer_context_repository(nof_cbs, acc100_ext_harq_buff_size, test_harq);
212212
TESTASSERT(harq_buffer_context);

tests/benchmarks/phy/upper/channel_processors/pusch/pusch_processor_benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static std::shared_ptr<hal::hw_accelerator_pusch_dec_factory> create_hw_accelera
489489

490490
// Interfacing to a shared external HARQ buffer context repository.
491491
unsigned nof_cbs = MAX_NOF_SEGMENTS;
492-
unsigned acc100_ext_harq_buff_size = bbdev_accelerator->get_harq_buff_size().value();
492+
uint64_t acc100_ext_harq_buff_size = bbdev_accelerator->get_harq_buff_size_bytes();
493493
std::shared_ptr<ext_harq_buffer_context_repository> harq_buffer_context =
494494
create_ext_harq_buffer_context_repository(nof_cbs, acc100_ext_harq_buff_size, false);
495495
TESTASSERT(harq_buffer_context);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static std::shared_ptr<hal::hw_accelerator_pusch_dec_factory> create_hw_accelera
187187

188188
// Interfacing to a shared external HARQ buffer context repository.
189189
unsigned nof_cbs = MAX_NOF_SEGMENTS;
190-
unsigned acc100_ext_harq_buff_size = bbdev_accelerator->get_harq_buff_size().value();
190+
uint64_t acc100_ext_harq_buff_size = bbdev_accelerator->get_harq_buff_size_bytes();
191191
std::shared_ptr<ext_harq_buffer_context_repository> harq_buffer_context =
192192
create_ext_harq_buffer_context_repository(nof_cbs, acc100_ext_harq_buff_size, test_harq);
193193
TESTASSERT(harq_buffer_context);

0 commit comments

Comments
 (0)