Skip to content

Commit

Permalink
Update main
Browse files Browse the repository at this point in the history
  • Loading branch information
codebot committed Nov 13, 2024
2 parents 6f0f948 + 08bed27 commit 91a0b69
Show file tree
Hide file tree
Showing 35 changed files with 520 additions and 1,078 deletions.
2 changes: 1 addition & 1 deletion .gitlab/ci/e2e/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SRSGNB_REGISTRY_URI=registry.gitlab.com/softwareradiosystems/srsgnb
RETINA_REGISTRY_PREFIX=registry.gitlab.com/softwareradiosystems/ci/retina
RETINA_VERSION=0.54.13
RETINA_VERSION=0.54.16
UBUNTU_VERSION=24.04
AMARISOFT_VERSION=2023-09-08
SRSUE_VERSION=23.11
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ if (ENABLE_FFTW)
endif (ENABLE_FFTW)

# MKL
if (ENABLE_MKL)
if (ENABLE_MKL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
find_package(MKL)
endif (ENABLE_MKL)
endif (ENABLE_MKL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")

# ARMPL
if (ENABLE_ARMPL)
if (ENABLE_ARMPL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
find_package(ARMPL)
endif (ENABLE_ARMPL)
endif (ENABLE_ARMPL AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")

# Google Tests
if (BUILD_TESTS)
Expand Down
33 changes: 19 additions & 14 deletions apps/examples/phy/radio_ssb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,8 @@ static const auto profiles = to_array<configuration_profile>({
});

/// Global instances.
static std::mutex stop_execution_mutex;
static std::atomic<bool> stop = {false};
static std::unique_ptr<upper_phy_ssb_example> upper_phy = nullptr;
static std::unique_ptr<lower_phy> lower_phy_instance = nullptr;
static std::unique_ptr<radio_session> radio = nullptr;
static std::mutex stop_execution_mutex;
static std::atomic<bool> stop = {false};

static void stop_execution()
{
Expand All @@ -286,12 +283,6 @@ static void stop_execution()

// Signal program to stop.
stop = true;

// Stop radio. It stops blocking the radio transmit and receive operations. The timing handler prevents the PHY from
// free running.
if (radio != nullptr) {
radio->stop();
}
}

/// Function to call when the application is interrupted.
Expand Down Expand Up @@ -474,6 +465,7 @@ lower_phy_configuration create_lower_phy_configuration(task_executor*
lower_phy_metrics_notifier* metrics_notifier,
lower_phy_rx_symbol_notifier* rx_symbol_notifier,
lower_phy_timing_notifier* timing_notifier,
baseband_gateway& bb_gateway,
srslog::basic_logger* logger)
{
lower_phy_configuration phy_config;
Expand All @@ -485,7 +477,7 @@ lower_phy_configuration create_lower_phy_configuration(task_executor*
phy_config.ta_offset = n_ta_offset::n0;
phy_config.cp = cp;
phy_config.dft_window_offset = 0.5F;
phy_config.bb_gateway = &radio->get_baseband_gateway(0);
phy_config.bb_gateway = &bb_gateway;
phy_config.rx_symbol_notifier = rx_symbol_notifier;
phy_config.timing_notifier = timing_notifier;
phy_config.error_notifier = error_notifier;
Expand Down Expand Up @@ -618,7 +610,7 @@ int main(int argc, char** argv)
radio_notifier_spy notification_handler(log_level);

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

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

// Create lower physical layer.
std::unique_ptr<lower_phy> lower_phy_instance = nullptr;
{
// Prepare lower physical layer configuration.
lower_phy_configuration phy_config = create_lower_phy_configuration(rx_task_executor.get(),
Expand All @@ -648,6 +641,7 @@ int main(int argc, char** argv)
&metrics_adapter,
&rx_symbol_adapter,
&timing_adapter,
radio->get_baseband_gateway(0),
&logger);
lower_phy_instance = create_lower_phy(phy_config);
srsran_assert(lower_phy_instance, "Failed to create lower physical layer.");
Expand Down Expand Up @@ -706,7 +700,7 @@ int main(int argc, char** argv)
upper_phy_sample_config.enable_ul_processing = enable_ul_processing;
upper_phy_sample_config.enable_prach_processing = enable_prach_processing;
upper_phy_sample_config.data_modulation = data_mod_scheme;
upper_phy = upper_phy_ssb_example::create(upper_phy_sample_config);
std::unique_ptr<upper_phy_ssb_example> upper_phy = upper_phy_ssb_example::create(upper_phy_sample_config);
srsran_assert(upper_phy, "Failed to create upper physical layer.");

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

// Stop radio. It stops blocking the radio transmit and receive operations. The timing handler prevents the PHY from
// free running.
if (radio != nullptr) {
radio->stop();
}

// Stop the timing handler. It stops blocking notifier and allows the PHY to free run.
upper_phy->stop();

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

// Destroy physical layer components in the correct order.
lower_phy_instance.reset();
upper_phy.reset();
radio.reset();

return 0;
}
8 changes: 0 additions & 8 deletions apps/gnb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ target_link_libraries(gnb
if (DPDK_FOUND)
add_definitions(-DDPDK_FOUND)
target_link_libraries(gnb hal_dpdk)
if (ENABLE_PUSCH_HWACC)
add_definitions(-DENABLE_PUSCH_HWACC)
target_link_libraries(gnb srsran_hal_pusch srsran_hal_bbdev)
endif (ENABLE_PUSCH_HWACC)
if (ENABLE_PDSCH_HWACC)
add_definitions(-DENABLE_PDSCH_HWACC)
target_link_libraries(gnb srsran_hal_pdsch srsran_hal_bbdev)
endif (ENABLE_PDSCH_HWACC)
endif (DPDK_FOUND)

add_backward(gnb)
Expand Down
4 changes: 2 additions & 2 deletions apps/units/cu_up/cu_up_unit_pcap_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ struct cu_up_unit_pcap_config {
bool enabled = false;
} e1ap;
struct {
std::string filename;
bool enabled = false;
std::string filename = "/tmp/cu_up_e2ap.pcap";
bool enabled = false;
} e2ap;

/// When using the gNB app, there is no point in instantiating
Expand Down
3 changes: 2 additions & 1 deletion apps/units/flexible_du/o_du_low/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(SOURCES
du_low_config_translator.cpp
du_low_config_validator.cpp
du_low_config_yaml_writer.cpp
du_low_hal_factory.cpp
o_du_low_unit_factory.cpp)

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

# Hardware acceleration for both PUSCH and PDSCH is enabled by default when using DPDK.
if (DPDK_FOUND)
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_DEFINITIONS "DPDK_FOUND; HWACC_PDSCH_ENABLED; HWACC_PUSCH_ENABLED")
set_source_files_properties(du_low_hal_factory.cpp PROPERTIES COMPILE_DEFINITIONS "DPDK_FOUND; HWACC_PDSCH_ENABLED; HWACC_PUSCH_ENABLED")
list(APPEND DU_LOW_UNIT_HELPERS_LIBRARIES srsran_hal_pusch
srsran_hal_pdsch
srsran_hal_bbdev)
Expand Down
113 changes: 113 additions & 0 deletions apps/units/flexible_du/o_du_low/du_low_hal_factory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
*
* Copyright 2021-2024 Software Radio Systems Limited
*
* This file is part of srsRAN.
*
* srsRAN is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsRAN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/

#include "du_low_hal_factory.h"
#include "srsran/ran/sch/sch_constants.h"
#ifdef DPDK_FOUND
#include "srsran/hal/dpdk/bbdev/bbdev_acc_factory.h"
#include "srsran/hal/phy/upper/channel_processors/hw_accelerator_factories.h"
#include "srsran/hal/phy/upper/channel_processors/pusch/ext_harq_buffer_context_repository_factory.h"
#include "srsran/hal/phy/upper/channel_processors/pusch/hw_accelerator_factories.h"
#endif // DPDK_FOUND

using namespace srsran;

#ifdef DPDK_FOUND
std::shared_ptr<dpdk::bbdev_acc>
srsran::init_bbdev_hwacc(const bbdev_appconfig& bbdev_app_cfg, srslog::basic_logger& logger, unsigned nof_hwacc_dus)
{
// Initialize the bbdev-based hardware accelerator, if required.
static std::shared_ptr<dpdk::bbdev_acc> bbdev_accelerator = [bbdev_app_cfg, &logger, nof_hwacc_dus]() {
// Intefacing to the bbdev-based hardware-accelerator.
dpdk::bbdev_acc_configuration bbdev_config;
bbdev_config.id = bbdev_app_cfg.id;
if (bbdev_app_cfg.pdsch_enc && bbdev_app_cfg.pdsch_enc->nof_hwacc > 0) {
bbdev_config.nof_ldpc_enc_lcores = nof_hwacc_dus * bbdev_app_cfg.pdsch_enc->nof_hwacc;
}
if (bbdev_app_cfg.pusch_dec && bbdev_app_cfg.pusch_dec->nof_hwacc > 0) {
bbdev_config.nof_ldpc_dec_lcores = nof_hwacc_dus * bbdev_app_cfg.pusch_dec->nof_hwacc;
}
// If no msg_mbuf size is defined, a worst-case value will be used.
bbdev_config.msg_mbuf_size = bbdev_app_cfg.msg_mbuf_size.value_or(RTE_BBDEV_LDPC_E_MAX_MBUF);
// If no rm_mbuf size is defined, a worst-case value will be used.
bbdev_config.rm_mbuf_size = bbdev_app_cfg.rm_mbuf_size.value_or(RTE_BBDEV_LDPC_E_MAX_MBUF);
// If no number of mbufs is defined, a worst-case value will be used.
bbdev_config.nof_mbuf = bbdev_app_cfg.nof_mbuf.value_or(static_cast<unsigned>(pow2(log2_ceil(MAX_NOF_SEGMENTS))));
std::shared_ptr<dpdk::bbdev_acc> bbdev_acc = create_bbdev_acc(bbdev_config, logger);
report_error_if_not(bbdev_acc, "Unable to open the {} hardware-accelerator.", bbdev_app_cfg.hwacc_type);
return bbdev_acc;
}();

return bbdev_accelerator;
}
#endif // DPDK_FOUND

o_du_low_hal_dependencies srsran::make_du_low_hal_dependencies(const du_low_unit_config& du_low_unit_cfg,
unsigned nof_cells)
{
o_du_low_hal_dependencies hal_dependencies;

// Initialize hardware-accelerator (only once and if needed).
#ifdef DPDK_FOUND
if (du_low_unit_cfg.hal_config && du_low_unit_cfg.hal_config->bbdev_hwacc &&
!du_low_unit_cfg.hal_config->bbdev_hwacc->hwacc_type.empty()) {
const bbdev_appconfig& bbdev_app_cfg = du_low_unit_cfg.hal_config->bbdev_hwacc.value();
srslog::basic_logger& hwacc_logger = srslog::fetch_basic_logger("HWACC", false);
hwacc_logger.set_level(du_low_unit_cfg.loggers.hal_level);

// Create a hardware-accelerated PDSCH encoder factory (only if needed).
if (bbdev_app_cfg.pdsch_enc && bbdev_app_cfg.pdsch_enc->nof_hwacc > 0) {
hal::bbdev_hwacc_pdsch_enc_factory_configuration hwacc_pdsch_enc_cfg;
hwacc_pdsch_enc_cfg.acc_type = bbdev_app_cfg.hwacc_type;
hwacc_pdsch_enc_cfg.bbdev_accelerator = init_bbdev_hwacc(bbdev_app_cfg, hwacc_logger, nof_cells);
hwacc_pdsch_enc_cfg.cb_mode = bbdev_app_cfg.pdsch_enc->cb_mode;
// If no maximum buffer size is defined, a worst-case value will be used.
hwacc_pdsch_enc_cfg.max_tb_size = bbdev_app_cfg.pdsch_enc->max_buffer_size.value_or(RTE_BBDEV_LDPC_E_MAX_MBUF);
hwacc_pdsch_enc_cfg.dedicated_queue = bbdev_app_cfg.pdsch_enc->dedicated_queue;
hal_dependencies.hw_encoder_factory = hal::create_bbdev_pdsch_enc_acc_factory(hwacc_pdsch_enc_cfg);
}

// // Create a hardware-accelerated PUSCH decoder factory (only if needed).
if (bbdev_app_cfg.pusch_dec && bbdev_app_cfg.pusch_dec->nof_hwacc > 0) {
hal::bbdev_hwacc_pusch_dec_factory_configuration hwacc_pusch_dec_cfg;
std::shared_ptr<hal::ext_harq_buffer_context_repository> harq_buffer_context = nullptr;
hwacc_pusch_dec_cfg.acc_type = bbdev_app_cfg.hwacc_type;
hwacc_pusch_dec_cfg.bbdev_accelerator = init_bbdev_hwacc(bbdev_app_cfg, hwacc_logger, nof_cells);
hwacc_pusch_dec_cfg.ext_softbuffer = bbdev_app_cfg.pusch_dec->ext_softbuffer;
if (hwacc_pusch_dec_cfg.ext_softbuffer) {
// Set up an external HARQ buffer context repository.
unsigned nof_cbs = bbdev_app_cfg.pusch_dec->harq_context_size.value_or(MAX_NOF_SEGMENTS);
uint64_t ext_harq_buff_size = hwacc_pusch_dec_cfg.bbdev_accelerator->get_harq_buff_size_bytes();
harq_buffer_context = hal::create_ext_harq_buffer_context_repository(nof_cbs, ext_harq_buff_size, false);
report_error_if_not(harq_buffer_context,
"Unable to create the external HARQ buffer context for the {} hardware-accelerator.",
bbdev_app_cfg.hwacc_type);
hwacc_pusch_dec_cfg.harq_buffer_context = harq_buffer_context;
}
hwacc_pusch_dec_cfg.dedicated_queue = bbdev_app_cfg.pusch_dec->dedicated_queue;
hal_dependencies.hw_decoder_factory = hal::create_bbdev_pusch_dec_acc_factory(hwacc_pusch_dec_cfg);
}
}
#endif // DPDK_FOUND

return hal_dependencies;
}
58 changes: 58 additions & 0 deletions apps/units/flexible_du/o_du_low/du_low_hal_factory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
*
* Copyright 2021-2024 Software Radio Systems Limited
*
* This file is part of srsRAN.
*
* srsRAN is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsRAN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/

#pragma once

#include "du_low_config.h"
#include "srsran/hal/phy/upper/channel_processors/hw_accelerator_pdsch_enc_factory.h"
#include "srsran/hal/phy/upper/channel_processors/pusch/hw_accelerator_pusch_dec_factory.h"
#include "srsran/srslog/srslog.h"

#ifdef DPDK_FOUND
#include "srsran/hal/dpdk/bbdev/bbdev_acc.h"
#endif // DPDK_FOUND

namespace srsran {

/// ORAN DU low unit HAL dependencies.
struct o_du_low_hal_dependencies {
std::shared_ptr<hal::hw_accelerator_pdsch_enc_factory> hw_encoder_factory = nullptr;
std::shared_ptr<hal::hw_accelerator_pusch_dec_factory> hw_decoder_factory = nullptr;
};

#ifdef DPDK_FOUND
/// \brief Creates and initializes a bbdev-based hardware accelerator.
/// \param[in] bbdev_app_cfg Struct containing the DU low HAL configuration.
/// \param[in] logger SRS logger.
/// \param[in] nof_hwacc_dus Number of DU-low instances to be managed by the hardware accelerator.
/// \return A pointer to the bbdev-based accelerator interface on success, nullptr otherwise.
static std::shared_ptr<dpdk::bbdev_acc>
init_bbdev_hwacc(const bbdev_appconfig& bbdev_app_cfg, srslog::basic_logger& logger, unsigned nof_hwacc_dus);
#endif // DPDK_FOUND

/// \brief Initializes the HAL depencies of the DU low unit.
/// \param[out] hal_dependencies Struct containing the DU low unit dependencies.
/// \param[in] du_low_unit_cfg Struct defining the DU low configuration.
/// \param[in] nof_cells Number of cells to be handled by the HAL.
o_du_low_hal_dependencies make_du_low_hal_dependencies(const du_low_unit_config& du_low_unit_cfg, unsigned nof_cells);

} // namespace srsran
Loading

0 comments on commit 91a0b69

Please sign in to comment.