Skip to content

Commit 91a0b69

Browse files
author
codebot
committed
Update main
2 parents 6f0f948 + 08bed27 commit 91a0b69

35 files changed

+520
-1078
lines changed

.gitlab/ci/e2e/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SRSGNB_REGISTRY_URI=registry.gitlab.com/softwareradiosystems/srsgnb
22
RETINA_REGISTRY_PREFIX=registry.gitlab.com/softwareradiosystems/ci/retina
3-
RETINA_VERSION=0.54.13
3+
RETINA_VERSION=0.54.16
44
UBUNTU_VERSION=24.04
55
AMARISOFT_VERSION=2023-09-08
66
SRSUE_VERSION=23.11

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,14 @@ if (ENABLE_FFTW)
276276
endif (ENABLE_FFTW)
277277

278278
# MKL
279-
if (ENABLE_MKL)
279+
if (ENABLE_MKL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
280280
find_package(MKL)
281-
endif (ENABLE_MKL)
281+
endif (ENABLE_MKL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
282282

283283
# ARMPL
284-
if (ENABLE_ARMPL)
284+
if (ENABLE_ARMPL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
285285
find_package(ARMPL)
286-
endif (ENABLE_ARMPL)
286+
endif (ENABLE_ARMPL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
287287

288288
# Google Tests
289289
if (BUILD_TESTS)

apps/examples/phy/radio_ssb.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,8 @@ static const auto profiles = to_array<configuration_profile>({
268268
});
269269

270270
/// Global instances.
271-
static std::mutex stop_execution_mutex;
272-
static std::atomic<bool> stop = {false};
273-
static std::unique_ptr<upper_phy_ssb_example> upper_phy = nullptr;
274-
static std::unique_ptr<lower_phy> lower_phy_instance = nullptr;
275-
static std::unique_ptr<radio_session> radio = nullptr;
271+
static std::mutex stop_execution_mutex;
272+
static std::atomic<bool> stop = {false};
276273

277274
static void stop_execution()
278275
{
@@ -286,12 +283,6 @@ static void stop_execution()
286283

287284
// Signal program to stop.
288285
stop = true;
289-
290-
// Stop radio. It stops blocking the radio transmit and receive operations. The timing handler prevents the PHY from
291-
// free running.
292-
if (radio != nullptr) {
293-
radio->stop();
294-
}
295286
}
296287

297288
/// Function to call when the application is interrupted.
@@ -474,6 +465,7 @@ lower_phy_configuration create_lower_phy_configuration(task_executor*
474465
lower_phy_metrics_notifier* metrics_notifier,
475466
lower_phy_rx_symbol_notifier* rx_symbol_notifier,
476467
lower_phy_timing_notifier* timing_notifier,
468+
baseband_gateway& bb_gateway,
477469
srslog::basic_logger* logger)
478470
{
479471
lower_phy_configuration phy_config;
@@ -485,7 +477,7 @@ lower_phy_configuration create_lower_phy_configuration(task_executor*
485477
phy_config.ta_offset = n_ta_offset::n0;
486478
phy_config.cp = cp;
487479
phy_config.dft_window_offset = 0.5F;
488-
phy_config.bb_gateway = &radio->get_baseband_gateway(0);
480+
phy_config.bb_gateway = &bb_gateway;
489481
phy_config.rx_symbol_notifier = rx_symbol_notifier;
490482
phy_config.timing_notifier = timing_notifier;
491483
phy_config.error_notifier = error_notifier;
@@ -618,7 +610,7 @@ int main(int argc, char** argv)
618610
radio_notifier_spy notification_handler(log_level);
619611

620612
// Create radio.
621-
radio = factory->create(radio_config, *async_task_executor, notification_handler);
613+
std::unique_ptr<radio_session> radio = factory->create(radio_config, *async_task_executor, notification_handler);
622614
srsran_assert(radio, "Failed to create radio.");
623615

624616
// Create symbol handler.
@@ -637,6 +629,7 @@ int main(int argc, char** argv)
637629
phy_rx_symbol_request_adapter phy_rx_symbol_req_adapter;
638630

639631
// Create lower physical layer.
632+
std::unique_ptr<lower_phy> lower_phy_instance = nullptr;
640633
{
641634
// Prepare lower physical layer configuration.
642635
lower_phy_configuration phy_config = create_lower_phy_configuration(rx_task_executor.get(),
@@ -648,6 +641,7 @@ int main(int argc, char** argv)
648641
&metrics_adapter,
649642
&rx_symbol_adapter,
650643
&timing_adapter,
644+
radio->get_baseband_gateway(0),
651645
&logger);
652646
lower_phy_instance = create_lower_phy(phy_config);
653647
srsran_assert(lower_phy_instance, "Failed to create lower physical layer.");
@@ -706,7 +700,7 @@ int main(int argc, char** argv)
706700
upper_phy_sample_config.enable_ul_processing = enable_ul_processing;
707701
upper_phy_sample_config.enable_prach_processing = enable_prach_processing;
708702
upper_phy_sample_config.data_modulation = data_mod_scheme;
709-
upper_phy = upper_phy_ssb_example::create(upper_phy_sample_config);
703+
std::unique_ptr<upper_phy_ssb_example> upper_phy = upper_phy_ssb_example::create(upper_phy_sample_config);
710704
srsran_assert(upper_phy, "Failed to create upper physical layer.");
711705

712706
// Connect adapters.
@@ -733,6 +727,12 @@ int main(int argc, char** argv)
733727
// Stop execution.
734728
stop_execution();
735729

730+
// Stop radio. It stops blocking the radio transmit and receive operations. The timing handler prevents the PHY from
731+
// free running.
732+
if (radio != nullptr) {
733+
radio->stop();
734+
}
735+
736736
// Stop the timing handler. It stops blocking notifier and allows the PHY to free run.
737737
upper_phy->stop();
738738

@@ -749,5 +749,10 @@ int main(int argc, char** argv)
749749
// Prints radio notification summary (number of overflow, underflow and other events).
750750
notification_handler.print();
751751

752+
// Destroy physical layer components in the correct order.
753+
lower_phy_instance.reset();
754+
upper_phy.reset();
755+
radio.reset();
756+
752757
return 0;
753758
}

apps/gnb/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ target_link_libraries(gnb
5252
if (DPDK_FOUND)
5353
add_definitions(-DDPDK_FOUND)
5454
target_link_libraries(gnb hal_dpdk)
55-
if (ENABLE_PUSCH_HWACC)
56-
add_definitions(-DENABLE_PUSCH_HWACC)
57-
target_link_libraries(gnb srsran_hal_pusch srsran_hal_bbdev)
58-
endif (ENABLE_PUSCH_HWACC)
59-
if (ENABLE_PDSCH_HWACC)
60-
add_definitions(-DENABLE_PDSCH_HWACC)
61-
target_link_libraries(gnb srsran_hal_pdsch srsran_hal_bbdev)
62-
endif (ENABLE_PDSCH_HWACC)
6355
endif (DPDK_FOUND)
6456

6557
add_backward(gnb)

apps/units/cu_up/cu_up_unit_pcap_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ struct cu_up_unit_pcap_config {
4141
bool enabled = false;
4242
} e1ap;
4343
struct {
44-
std::string filename;
45-
bool enabled = false;
44+
std::string filename = "/tmp/cu_up_e2ap.pcap";
45+
bool enabled = false;
4646
} e2ap;
4747

4848
/// When using the gNB app, there is no point in instantiating

apps/units/flexible_du/o_du_low/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ set(SOURCES
2323
du_low_config_translator.cpp
2424
du_low_config_validator.cpp
2525
du_low_config_yaml_writer.cpp
26+
du_low_hal_factory.cpp
2627
o_du_low_unit_factory.cpp)
2728

2829
add_library(srsran_o_du_low_unit_helpers STATIC ${SOURCES})
@@ -31,7 +32,7 @@ set(DU_LOW_UNIT_HELPERS_LIBRARIES srsran_upper_phy srsran_cpu_affinities_helper)
3132

3233
# Hardware acceleration for both PUSCH and PDSCH is enabled by default when using DPDK.
3334
if (DPDK_FOUND)
34-
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_DEFINITIONS "DPDK_FOUND; HWACC_PDSCH_ENABLED; HWACC_PUSCH_ENABLED")
35+
set_source_files_properties(du_low_hal_factory.cpp PROPERTIES COMPILE_DEFINITIONS "DPDK_FOUND; HWACC_PDSCH_ENABLED; HWACC_PUSCH_ENABLED")
3536
list(APPEND DU_LOW_UNIT_HELPERS_LIBRARIES srsran_hal_pusch
3637
srsran_hal_pdsch
3738
srsran_hal_bbdev)
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* This file is part of srsRAN.
6+
*
7+
* srsRAN is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Affero General Public License as
9+
* published by the Free Software Foundation, either version 3 of
10+
* the License, or (at your option) any later version.
11+
*
12+
* srsRAN is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* A copy of the GNU Affero General Public License can be found in
18+
* the LICENSE file in the top-level directory of this distribution
19+
* and at http://www.gnu.org/licenses/.
20+
*
21+
*/
22+
23+
#include "du_low_hal_factory.h"
24+
#include "srsran/ran/sch/sch_constants.h"
25+
#ifdef DPDK_FOUND
26+
#include "srsran/hal/dpdk/bbdev/bbdev_acc_factory.h"
27+
#include "srsran/hal/phy/upper/channel_processors/hw_accelerator_factories.h"
28+
#include "srsran/hal/phy/upper/channel_processors/pusch/ext_harq_buffer_context_repository_factory.h"
29+
#include "srsran/hal/phy/upper/channel_processors/pusch/hw_accelerator_factories.h"
30+
#endif // DPDK_FOUND
31+
32+
using namespace srsran;
33+
34+
#ifdef DPDK_FOUND
35+
std::shared_ptr<dpdk::bbdev_acc>
36+
srsran::init_bbdev_hwacc(const bbdev_appconfig& bbdev_app_cfg, srslog::basic_logger& logger, unsigned nof_hwacc_dus)
37+
{
38+
// Initialize the bbdev-based hardware accelerator, if required.
39+
static std::shared_ptr<dpdk::bbdev_acc> bbdev_accelerator = [bbdev_app_cfg, &logger, nof_hwacc_dus]() {
40+
// Intefacing to the bbdev-based hardware-accelerator.
41+
dpdk::bbdev_acc_configuration bbdev_config;
42+
bbdev_config.id = bbdev_app_cfg.id;
43+
if (bbdev_app_cfg.pdsch_enc && bbdev_app_cfg.pdsch_enc->nof_hwacc > 0) {
44+
bbdev_config.nof_ldpc_enc_lcores = nof_hwacc_dus * bbdev_app_cfg.pdsch_enc->nof_hwacc;
45+
}
46+
if (bbdev_app_cfg.pusch_dec && bbdev_app_cfg.pusch_dec->nof_hwacc > 0) {
47+
bbdev_config.nof_ldpc_dec_lcores = nof_hwacc_dus * bbdev_app_cfg.pusch_dec->nof_hwacc;
48+
}
49+
// If no msg_mbuf size is defined, a worst-case value will be used.
50+
bbdev_config.msg_mbuf_size = bbdev_app_cfg.msg_mbuf_size.value_or(RTE_BBDEV_LDPC_E_MAX_MBUF);
51+
// If no rm_mbuf size is defined, a worst-case value will be used.
52+
bbdev_config.rm_mbuf_size = bbdev_app_cfg.rm_mbuf_size.value_or(RTE_BBDEV_LDPC_E_MAX_MBUF);
53+
// If no number of mbufs is defined, a worst-case value will be used.
54+
bbdev_config.nof_mbuf = bbdev_app_cfg.nof_mbuf.value_or(static_cast<unsigned>(pow2(log2_ceil(MAX_NOF_SEGMENTS))));
55+
std::shared_ptr<dpdk::bbdev_acc> bbdev_acc = create_bbdev_acc(bbdev_config, logger);
56+
report_error_if_not(bbdev_acc, "Unable to open the {} hardware-accelerator.", bbdev_app_cfg.hwacc_type);
57+
return bbdev_acc;
58+
}();
59+
60+
return bbdev_accelerator;
61+
}
62+
#endif // DPDK_FOUND
63+
64+
o_du_low_hal_dependencies srsran::make_du_low_hal_dependencies(const du_low_unit_config& du_low_unit_cfg,
65+
unsigned nof_cells)
66+
{
67+
o_du_low_hal_dependencies hal_dependencies;
68+
69+
// Initialize hardware-accelerator (only once and if needed).
70+
#ifdef DPDK_FOUND
71+
if (du_low_unit_cfg.hal_config && du_low_unit_cfg.hal_config->bbdev_hwacc &&
72+
!du_low_unit_cfg.hal_config->bbdev_hwacc->hwacc_type.empty()) {
73+
const bbdev_appconfig& bbdev_app_cfg = du_low_unit_cfg.hal_config->bbdev_hwacc.value();
74+
srslog::basic_logger& hwacc_logger = srslog::fetch_basic_logger("HWACC", false);
75+
hwacc_logger.set_level(du_low_unit_cfg.loggers.hal_level);
76+
77+
// Create a hardware-accelerated PDSCH encoder factory (only if needed).
78+
if (bbdev_app_cfg.pdsch_enc && bbdev_app_cfg.pdsch_enc->nof_hwacc > 0) {
79+
hal::bbdev_hwacc_pdsch_enc_factory_configuration hwacc_pdsch_enc_cfg;
80+
hwacc_pdsch_enc_cfg.acc_type = bbdev_app_cfg.hwacc_type;
81+
hwacc_pdsch_enc_cfg.bbdev_accelerator = init_bbdev_hwacc(bbdev_app_cfg, hwacc_logger, nof_cells);
82+
hwacc_pdsch_enc_cfg.cb_mode = bbdev_app_cfg.pdsch_enc->cb_mode;
83+
// If no maximum buffer size is defined, a worst-case value will be used.
84+
hwacc_pdsch_enc_cfg.max_tb_size = bbdev_app_cfg.pdsch_enc->max_buffer_size.value_or(RTE_BBDEV_LDPC_E_MAX_MBUF);
85+
hwacc_pdsch_enc_cfg.dedicated_queue = bbdev_app_cfg.pdsch_enc->dedicated_queue;
86+
hal_dependencies.hw_encoder_factory = hal::create_bbdev_pdsch_enc_acc_factory(hwacc_pdsch_enc_cfg);
87+
}
88+
89+
// // Create a hardware-accelerated PUSCH decoder factory (only if needed).
90+
if (bbdev_app_cfg.pusch_dec && bbdev_app_cfg.pusch_dec->nof_hwacc > 0) {
91+
hal::bbdev_hwacc_pusch_dec_factory_configuration hwacc_pusch_dec_cfg;
92+
std::shared_ptr<hal::ext_harq_buffer_context_repository> harq_buffer_context = nullptr;
93+
hwacc_pusch_dec_cfg.acc_type = bbdev_app_cfg.hwacc_type;
94+
hwacc_pusch_dec_cfg.bbdev_accelerator = init_bbdev_hwacc(bbdev_app_cfg, hwacc_logger, nof_cells);
95+
hwacc_pusch_dec_cfg.ext_softbuffer = bbdev_app_cfg.pusch_dec->ext_softbuffer;
96+
if (hwacc_pusch_dec_cfg.ext_softbuffer) {
97+
// Set up an external HARQ buffer context repository.
98+
unsigned nof_cbs = bbdev_app_cfg.pusch_dec->harq_context_size.value_or(MAX_NOF_SEGMENTS);
99+
uint64_t ext_harq_buff_size = hwacc_pusch_dec_cfg.bbdev_accelerator->get_harq_buff_size_bytes();
100+
harq_buffer_context = hal::create_ext_harq_buffer_context_repository(nof_cbs, ext_harq_buff_size, false);
101+
report_error_if_not(harq_buffer_context,
102+
"Unable to create the external HARQ buffer context for the {} hardware-accelerator.",
103+
bbdev_app_cfg.hwacc_type);
104+
hwacc_pusch_dec_cfg.harq_buffer_context = harq_buffer_context;
105+
}
106+
hwacc_pusch_dec_cfg.dedicated_queue = bbdev_app_cfg.pusch_dec->dedicated_queue;
107+
hal_dependencies.hw_decoder_factory = hal::create_bbdev_pusch_dec_acc_factory(hwacc_pusch_dec_cfg);
108+
}
109+
}
110+
#endif // DPDK_FOUND
111+
112+
return hal_dependencies;
113+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* This file is part of srsRAN.
6+
*
7+
* srsRAN is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Affero General Public License as
9+
* published by the Free Software Foundation, either version 3 of
10+
* the License, or (at your option) any later version.
11+
*
12+
* srsRAN is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* A copy of the GNU Affero General Public License can be found in
18+
* the LICENSE file in the top-level directory of this distribution
19+
* and at http://www.gnu.org/licenses/.
20+
*
21+
*/
22+
23+
#pragma once
24+
25+
#include "du_low_config.h"
26+
#include "srsran/hal/phy/upper/channel_processors/hw_accelerator_pdsch_enc_factory.h"
27+
#include "srsran/hal/phy/upper/channel_processors/pusch/hw_accelerator_pusch_dec_factory.h"
28+
#include "srsran/srslog/srslog.h"
29+
30+
#ifdef DPDK_FOUND
31+
#include "srsran/hal/dpdk/bbdev/bbdev_acc.h"
32+
#endif // DPDK_FOUND
33+
34+
namespace srsran {
35+
36+
/// ORAN DU low unit HAL dependencies.
37+
struct o_du_low_hal_dependencies {
38+
std::shared_ptr<hal::hw_accelerator_pdsch_enc_factory> hw_encoder_factory = nullptr;
39+
std::shared_ptr<hal::hw_accelerator_pusch_dec_factory> hw_decoder_factory = nullptr;
40+
};
41+
42+
#ifdef DPDK_FOUND
43+
/// \brief Creates and initializes a bbdev-based hardware accelerator.
44+
/// \param[in] bbdev_app_cfg Struct containing the DU low HAL configuration.
45+
/// \param[in] logger SRS logger.
46+
/// \param[in] nof_hwacc_dus Number of DU-low instances to be managed by the hardware accelerator.
47+
/// \return A pointer to the bbdev-based accelerator interface on success, nullptr otherwise.
48+
static std::shared_ptr<dpdk::bbdev_acc>
49+
init_bbdev_hwacc(const bbdev_appconfig& bbdev_app_cfg, srslog::basic_logger& logger, unsigned nof_hwacc_dus);
50+
#endif // DPDK_FOUND
51+
52+
/// \brief Initializes the HAL depencies of the DU low unit.
53+
/// \param[out] hal_dependencies Struct containing the DU low unit dependencies.
54+
/// \param[in] du_low_unit_cfg Struct defining the DU low configuration.
55+
/// \param[in] nof_cells Number of cells to be handled by the HAL.
56+
o_du_low_hal_dependencies make_du_low_hal_dependencies(const du_low_unit_config& du_low_unit_cfg, unsigned nof_cells);
57+
58+
} // namespace srsran

0 commit comments

Comments
 (0)