Skip to content

Commit

Permalink
Update main
Browse files Browse the repository at this point in the history
# Conflicts:
#	apps/cu/cu_worker_manager.cpp
#	apps/cu/cu_worker_manager.h
#	lib/scheduler/support/slot_event_list.h
#	lib/scheduler/support/slot_sync_point.h
  • Loading branch information
codebot committed Oct 7, 2024
2 parents ee1d86c + bf310d5 commit e73b461
Show file tree
Hide file tree
Showing 108 changed files with 2,755 additions and 1,763 deletions.
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ helm:
variables:
CI_DESCRIPTION: Synchronization with srsGNB
NOTIFY_SLACK: "true"
inherit:
variables: false
trigger:
project: softwareradiosystems/ci/srsgnb_k8s
branch: main
Expand All @@ -137,6 +139,8 @@ enterprise:
CI_DESCRIPTION: Nightly
SRSRAN_COMMIT: $CI_COMMIT_SHA
NOTIFY_SLACK: "true"
inherit:
variables: false
trigger:
project: softwareradiosystems/srsran_5g_enterprise
branch: main
Expand Down
4 changes: 4 additions & 0 deletions .gitlab/ci/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ smoke zmq:
GROUP: uesim
TESTBED: zmq_uesim
E2E_LOG_LEVEL: "info"
RETINA_LAUNCHER_ARGS: "--retina-pod-timeout 900"
needs:
- job: "basic relwithdeb"
artifacts: true
Expand Down Expand Up @@ -564,6 +565,7 @@ android b200:
- job: "basic relwithdeb"
artifacts: true
- *retina-needs
allow_failure: true

android IMS:
stage: rf
Expand All @@ -580,6 +582,7 @@ android IMS:
- job: "basic relwithdeb"
artifacts: true
- *retina-needs
allow_failure: true

android x300:
stage: rf
Expand All @@ -595,6 +598,7 @@ android x300:
- job: "basic relwithdeb"
artifacts: true
- *retina-needs
allow_failure: true

################################################################################
# VIAVI
Expand Down
1 change: 0 additions & 1 deletion apps/cu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ add_executable(srscu
cu_appconfig_cli11_schema.cpp
cu_appconfig_validator.cpp
cu_appconfig_yaml_writer.cpp
cu_worker_manager.cpp
)

install(TARGETS srscu
Expand Down
176 changes: 64 additions & 112 deletions apps/cu/cu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*
*/

#include "srsran/cu_up/cu_up.h"
#include "srsran/cu_up/cu_up_factory.h"
#include "srsran/f1ap/gateways/f1c_network_server_factory.h"
#include "srsran/f1u/cu_up/split_connector/f1u_split_connector_factory.h"
#include "srsran/gateways/udp_network_gateway.h"
Expand All @@ -44,40 +42,32 @@
#include "srsran/support/versioning/version.h"

#include "apps/cu/cu_appconfig_cli11_schema.h"
#include "apps/cu/cu_worker_manager.h"
#include "apps/units/cu_cp/cu_cp_builder.h"
#include "apps/units/cu_cp/cu_cp_application_unit.h"
#include "apps/units/cu_cp/cu_cp_config_translators.h"
#include "apps/units/cu_cp/cu_cp_logger_registrator.h"
#include "apps/units/cu_cp/cu_cp_unit_config.h"
#include "apps/units/cu_cp/cu_cp_unit_config_cli11_schema.h"
#include "apps/units/cu_cp/cu_cp_unit_config_validator.h"
#include "apps/units/cu_cp/cu_cp_unit_logger_config.h"
#include "apps/units/cu_cp/pcap_factory.h"
#include "apps/units/cu_up/cu_up_builder.h"
#include "apps/units/cu_up/cu_up_logger_registrator.h"
#include "apps/units/cu_up/cu_up_application_unit.h"
#include "apps/units/cu_up/cu_up_unit_config.h"
#include "apps/units/cu_up/cu_up_unit_config_cli11_schema.h"
#include "apps/units/cu_up/cu_up_unit_config_translators.h"
#include "apps/units/cu_up/cu_up_unit_config_validator.h"
#include "apps/units/cu_up/cu_up_wrapper.h"
#include "apps/units/cu_up/pcap_factory.h"
#include "srsran/cu_up/cu_up.h"

// TODO remove apps/gnb/*.h
#include "apps/gnb/adapters/e2_gateway_remote_connector.h"
#include "apps/gnb/gnb_appconfig_translators.h"
#include "srsran/e1ap/gateways/e1_local_connector_factory.h"
#include "srsran/ngap/gateways/n2_connection_client_factory.h"

#include "apps/services/application_message_banners.h"
#include "apps/services/application_tracer.h"
#include "apps/services/buffer_pool/buffer_pool_manager.h"
#include "apps/services/stdin_command_dispatcher.h"
#include "apps/units/cu_cp/cu_cp_unit_config_yaml_writer.h"
#include "apps/units/cu_up/cu_up_unit_config_yaml_writer.h"
#include "apps/services/worker_manager.h"
#include "apps/services/worker_manager_config.h"
#include "cu_appconfig.h"
#include "cu_appconfig_validator.h"
#include "cu_appconfig_yaml_writer.h"

#include "srsran/e1ap/gateways/e1_local_connector_factory.h"
#include "srsran/ngap/gateways/n2_connection_client_factory.h"

#include <atomic>
#include <thread>

Expand Down Expand Up @@ -135,9 +125,9 @@ static void initialize_log(const std::string& filename)
srslog::init();
}

static void register_app_logs(const logger_appconfig& log_cfg,
const cu_cp_unit_logger_config& cu_cp_loggers,
const cu_up_unit_logger_config& cu_up_loggers)
static void register_app_logs(const logger_appconfig& log_cfg,
cu_cp_application_unit& cu_cp_app_unit,
cu_up_application_unit& cu_up_app_unit)
{
// Set log-level of app and all non-layer specific components to app level.
for (const auto& id : {"ALL", "SCTP-GW", "IO-EPOLL", "UDP-GW", "PCAP"}) {
Expand All @@ -161,20 +151,24 @@ static void register_app_logs(const logger_appconfig& log_cfg,
metrics_logger.set_hex_dump_max_size(log_cfg.hex_max_size);

// Register units logs.
register_cu_cp_loggers(cu_cp_loggers);
register_cu_up_loggers(cu_up_loggers);
cu_cp_app_unit.on_loggers_registration();
cu_up_app_unit.on_loggers_registration();
}

// Temporary helper to create CU-UP.
// TODO remove
std::unique_ptr<srs_cu_up::cu_up_interface> app_build_cu_up(const cu_up_unit_config& unit_cfg,
cu_worker_manager& workers,
const std::string& f1u_bind_addr,
srs_cu_up::e1_connection_client& e1_conn_client,
f1u_cu_up_gateway& f1u_gateway,
dlt_pcap& gtpu_pcap,
timer_manager& timers,
io_broker& io_brk);
static void fill_cu_worker_manager_config(worker_manager_config& config, const cu_appconfig& unit_cfg)
{
config.nof_low_prio_threads = unit_cfg.expert_execution_cfg.threads.non_rt_threads.nof_non_rt_threads;
config.low_prio_sched_config = unit_cfg.expert_execution_cfg.affinities.low_priority_cpu_cfg;
}

static void autoderive_cu_up_parameters_after_parsing(cu_up_unit_config& cu_up_cfg, const cu_cp_unit_config& cu_cp_cfg)
{
// If no UPF is configured, we set the UPF configuration from the CU-CP AMF configuration.
if (cu_up_cfg.upf_cfg.bind_addr == "auto") {
cu_up_cfg.upf_cfg.bind_addr = cu_cp_cfg.amf_config.amf.bind_addr;
}
cu_up_cfg.upf_cfg.no_core = cu_cp_cfg.amf_config.no_core;
}

int main(int argc, char** argv)
{
Expand Down Expand Up @@ -202,41 +196,41 @@ int main(int argc, char** argv)
cu_appconfig cu_cfg;
configure_cli11_with_cu_appconfig_schema(app, cu_cfg);

cu_cp_unit_config cu_cp_config;
cu_cp_config.pcap_cfg.set_default_filename("/tmp/cu");
configure_cli11_with_cu_cp_unit_config_schema(app, cu_cp_config);
auto cu_cp_app_unit = create_cu_cp_application_unit("cu");
cu_cp_app_unit->on_parsing_configuration_registration(app);

cu_up_unit_config cu_up_config;
cu_up_config.pcap_cfg.set_default_filename("/tmp/cu");
configure_cli11_with_cu_up_unit_config_schema(app, cu_up_config);
auto cu_up_app_unit = create_cu_up_application_unit("cu");
cu_up_app_unit->on_parsing_configuration_registration(app);

// Set the callback for the app calling all the autoderivation functions.
app.callback([&app, &cu_cp_config, &cu_up_config]() {
autoderive_cu_cp_parameters_after_parsing(app, cu_cp_config);
autoderive_cu_up_parameters_after_parsing(
cu_cp_config.amf_config.amf.bind_addr, cu_cp_config.amf_config.no_core, cu_up_config);
app.callback([&app, &cu_cp_app_unit, &cu_up_app_unit]() {
cu_cp_app_unit->on_configuration_parameters_autoderivation(app);

autoderive_cu_up_parameters_after_parsing(cu_up_app_unit->get_cu_up_unit_config(),
cu_cp_app_unit->get_cu_cp_unit_config());
});

// Parse arguments.
CLI11_PARSE(app, argc, argv);

// Check the modified configuration.
if (!validate_cu_appconfig(cu_cfg) || !validate_cu_cp_unit_config(cu_cp_config) ||
!validate_cu_up_unit_config(cu_up_config)) {
if (!validate_cu_appconfig(cu_cfg) ||
!cu_cp_app_unit->on_configuration_validation(os_sched_affinity_bitmask::available_cpus()) ||
!cu_up_app_unit->on_configuration_validation(os_sched_affinity_bitmask::available_cpus())) {
report_error("Invalid configuration detected.\n");
}

// Set up logging.
initialize_log(cu_cfg.log_cfg.filename);
register_app_logs(cu_cfg.log_cfg, cu_cp_config.loggers, cu_up_config.loggers);
register_app_logs(cu_cfg.log_cfg, *cu_cp_app_unit, *cu_up_app_unit);

// Log input configuration.
srslog::basic_logger& config_logger = srslog::fetch_basic_logger("CONFIG");
if (config_logger.debug.enabled()) {
YAML::Node node;
fill_cu_appconfig_in_yaml_schema(node, cu_cfg);
fill_cu_up_config_in_yaml_schema(node, cu_up_config);
fill_cu_cp_config_in_yaml_schema(node, cu_cp_config);
cu_cp_app_unit->dump_config(node);
cu_up_app_unit->dump_config(node);
config_logger.debug("Input configuration (all values): \n{}", YAML::Dump(node));
} else {
config_logger.info("Input configuration (only non-default values): \n{}", app.config_to_str(false, false));
Expand Down Expand Up @@ -273,11 +267,17 @@ int main(int argc, char** argv)
check_drm_kms_polling(cu_logger);

// Create worker manager.
cu_worker_manager workers{cu_cfg, cu_cp_config.pcap_cfg, cu_up_config.pcap_cfg, cu_up_config.gtpu_queue_size};
worker_manager_config worker_manager_cfg;
fill_cu_worker_manager_config(worker_manager_cfg, cu_cfg);
cu_cp_app_unit->fill_worker_manager_config(worker_manager_cfg);
cu_up_app_unit->fill_worker_manager_config(worker_manager_cfg);
worker_manager workers{worker_manager_cfg};

// Create layer specific PCAPs.
cu_cp_dlt_pcaps cu_cp_dlt_pcaps = create_cu_cp_dlt_pcap(cu_cp_config.pcap_cfg, *workers.get_executor_getter());
cu_up_dlt_pcaps cu_up_dlt_pcaps = create_cu_up_dlt_pcaps(cu_up_config.pcap_cfg, *workers.get_executor_getter());
cu_cp_dlt_pcaps cu_cp_dlt_pcaps =
create_cu_cp_dlt_pcap(cu_cp_app_unit->get_cu_cp_unit_config().pcap_cfg, *workers.get_executor_getter());
cu_up_dlt_pcaps cu_up_dlt_pcaps =
create_cu_up_dlt_pcaps(cu_up_app_unit->get_cu_up_unit_config().pcap_cfg, *workers.get_executor_getter());

// Create IO broker.
const auto& low_prio_cpu_mask = cu_cfg.expert_execution_cfg.affinities.low_priority_cpu_cfg.mask;
Expand Down Expand Up @@ -306,7 +306,7 @@ int main(int argc, char** argv)
std::unique_ptr<srs_cu_up::ngu_gateway> cu_f1u_gw =
srs_cu_up::create_udp_ngu_gateway(cu_f1u_gw_config, *epoll_broker, *workers.cu_up_io_ul_exec);
std::unique_ptr<f1u_cu_up_udp_gateway> cu_f1u_conn =
srs_cu_up::create_split_f1u_gw({cu_f1u_gw.get(), cu_f1u_gtpu_demux.get(), *cu_up_dlt_pcaps.f1u, GTPU_PORT});
srs_cu_up::create_split_f1u_gw({*cu_f1u_gw, *cu_f1u_gtpu_demux, *cu_up_dlt_pcaps.f1u, GTPU_PORT});

// Create E1AP local connector
std::unique_ptr<e1_local_connector> e1_gw =
Expand All @@ -325,18 +325,11 @@ int main(int argc, char** argv)
cu_cp_dependencies.cu_cp_executor = workers.cu_cp_exec;
cu_cp_dependencies.cu_cp_e2_exec = workers.cu_cp_e2_exec;
cu_cp_dependencies.timers = cu_timers;

// Create N2 Client Gateways.
cu_cp_dependencies.n2_clients.push_back(srs_cu_cp::create_n2_connection_client(generate_n2_client_config(
cu_cp_config.amf_config.no_core, cu_cp_config.amf_config.amf, *cu_cp_dlt_pcaps.ngap, *epoll_broker)));

for (const auto& amf : cu_cp_config.extra_amfs) {
cu_cp_dependencies.n2_clients.push_back(srs_cu_cp::create_n2_connection_client(
generate_n2_client_config(cu_cp_config.amf_config.no_core, amf, *cu_cp_dlt_pcaps.ngap, *epoll_broker)));
}
cu_cp_dependencies.ngap_pcap = cu_cp_dlt_pcaps.ngap.get();
cu_cp_dependencies.broker = epoll_broker.get();

// create CU-CP.
auto cu_cp_obj_and_cmds = build_cu_cp(cu_cp_config, cu_cp_dependencies);
auto cu_cp_obj_and_cmds = cu_cp_app_unit->create_cu_cp(cu_cp_dependencies);
srs_cu_cp::cu_cp& cu_cp_obj = *cu_cp_obj_and_cmds.unit;

// Create console helper object for commands and metrics printing.
Expand All @@ -359,14 +352,15 @@ int main(int argc, char** argv)
cu_f1c_gw->attach_cu_cp(cu_cp_obj.get_f1c_handler());

// Create and start CU-UP
std::unique_ptr<srs_cu_up::cu_up_interface> cu_up_obj = app_build_cu_up(cu_up_config,
workers,
cu_cfg.nru_cfg.bind_addr,
*e1_gw,
*cu_f1u_conn,
*cu_up_dlt_pcaps.n3,
*cu_timers,
*epoll_broker);
cu_up_unit_dependencies cu_up_unit_deps;
cu_up_unit_deps.workers = &workers;
cu_up_unit_deps.e1ap_conn_client = e1_gw.get();
cu_up_unit_deps.f1u_gateway = cu_f1u_conn.get();
cu_up_unit_deps.gtpu_pcap = cu_up_dlt_pcaps.n3.get();
cu_up_unit_deps.timers = cu_timers;
cu_up_unit_deps.io_brk = epoll_broker.get();

std::unique_ptr<srs_cu_up::cu_up_interface> cu_up_obj = cu_up_app_unit->create_cu_up_unit(cu_up_unit_deps);
cu_up_obj->start();

{
Expand Down Expand Up @@ -398,45 +392,3 @@ int main(int argc, char** argv)

return 0;
}

// Temporary helper to create CU-UP.
// TODO remove
std::unique_ptr<srs_cu_up::cu_up_interface> app_build_cu_up(const cu_up_unit_config& unit_cfg,
cu_worker_manager& workers,
const std::string& f1u_bind_address,
srs_cu_up::e1_connection_client& e1_conn_client,
f1u_cu_up_gateway& f1u_gateway,
dlt_pcap& gtpu_pcap,
timer_manager& timers,
io_broker& io_brk)
{
srs_cu_up::cu_up_configuration config = generate_cu_up_config(unit_cfg);
config.ctrl_executor = workers.cu_up_ctrl_exec;
config.cu_up_e2_exec = workers.cu_up_e2_exec;
config.ue_exec_pool = workers.cu_up_exec_mapper.get();
config.io_ul_executor = workers.cu_up_io_ul_exec; // Optionally select separate exec for UL IO
config.e1ap.e1_conn_client = &e1_conn_client;
config.f1u_gateway = &f1u_gateway;
config.gtpu_pcap = &gtpu_pcap;
config.timers = &timers;
config.qos = generate_cu_up_qos_config(unit_cfg);

config.net_cfg.f1u_bind_addr = f1u_bind_address; // TODO remove this parameter and make sure that the CU-UP gets the
// bind address directly from the gateway.

// Create NG-U gateway.
std::unique_ptr<srs_cu_up::ngu_gateway> ngu_gw;
if (not unit_cfg.upf_cfg.no_core) {
udp_network_gateway_config ngu_gw_config = {};
ngu_gw_config.bind_address = config.net_cfg.n3_bind_addr;
ngu_gw_config.bind_port = config.net_cfg.n3_bind_port;
ngu_gw_config.bind_interface = config.net_cfg.n3_bind_interface;
ngu_gw_config.rx_max_mmsg = config.net_cfg.n3_rx_max_mmsg;
ngu_gw = srs_cu_up::create_udp_ngu_gateway(ngu_gw_config, io_brk, *workers.cu_up_io_ul_exec);
} else {
ngu_gw = srs_cu_up::create_no_core_ngu_gateway();
}
config.ngu_gw = ngu_gw.get();

return std::make_unique<cu_up_wrapper>(std::move(ngu_gw), create_cu_up(config));
}
Loading

0 comments on commit e73b461

Please sign in to comment.