From c7c1e25de14bb4de3c0832a6628263ff9d14ecff Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Wed, 18 Dec 2024 11:46:38 +0100 Subject: [PATCH 01/18] e2: fix subscription failure response encoding --- lib/e2/procedures/e2_subscription_setup_procedure.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/e2/procedures/e2_subscription_setup_procedure.cpp b/lib/e2/procedures/e2_subscription_setup_procedure.cpp index 30749ca45d..3115749bd6 100644 --- a/lib/e2/procedures/e2_subscription_setup_procedure.cpp +++ b/lib/e2/procedures/e2_subscription_setup_procedure.cpp @@ -72,7 +72,9 @@ void e2_subscription_setup_procedure::send_e2_subscription_setup_failure(const e auto& sub_fail = msg.pdu.unsuccessful_outcome().value.ric_sub_fail(); sub_fail->ric_request_id.ric_instance_id = failure.request_id.ric_instance_id; sub_fail->ric_request_id.ric_requestor_id = failure.request_id.ric_requestor_id; - sub_fail->cause = failure.cause; + sub_fail->ran_function_id = failure.ran_function_id; + sub_fail->crit_diagnostics_present = false; + sub_fail->cause.set_misc(); ric_notif.on_new_message(msg); logger.info("E2AP: Sending subscription failure"); } From 2d520575cd45f4302db773dba37db2013c36f605 Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Wed, 18 Dec 2024 11:47:06 +0100 Subject: [PATCH 02/18] test,e2e,ric: lower iperf bitrate --- tests/e2e/tests/iperf.py | 2 +- tests/e2e/tests/steps/stub.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/tests/iperf.py b/tests/e2e/tests/iperf.py index 23a106dcba..ebc8d0cb81 100644 --- a/tests/e2e/tests/iperf.py +++ b/tests/e2e/tests/iperf.py @@ -261,7 +261,7 @@ def test_ric( sample_rate=11520000, iperf_duration=SHORT_DURATION, protocol=protocol, - bitrate=MEDIUM_BITRATE, + bitrate=LOW_BITRATE, direction=direction, global_timing_advance=-1, time_alignment_calibration=0, diff --git a/tests/e2e/tests/steps/stub.py b/tests/e2e/tests/steps/stub.py index 4aed9406d8..ccb6a19881 100644 --- a/tests/e2e/tests/steps/stub.py +++ b/tests/e2e/tests/steps/stub.py @@ -254,9 +254,9 @@ def start_rc_xapp(ric: NearRtRicStub, control_service_style: int = 2, action_id: xapp_request.parameters[10].name = "SD" xapp_request.parameters[10].value = 1 xapp_request.parameters[11].name = "Min PRB Policy Ratio" - xapp_request.parameters[11].value = 20 + xapp_request.parameters[11].value = 10 xapp_request.parameters[12].name = "Max PRB Policy Ratio" - xapp_request.parameters[12].value = 60 + xapp_request.parameters[12].value = 90 xapp_request.parameters[13].name = "Dedicated PRB Policy Ratio" xapp_request.parameters[13].value = 80 ric.StartRcXapp(xapp_request) From 25269591301df5fb8c1067dd001e97099452d4ce Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Wed, 18 Dec 2024 12:08:17 +0100 Subject: [PATCH 03/18] e2: copy request messages in subscription procedures --- lib/e2/procedures/e2_subscription_delete_procedure.h | 12 ++++++------ lib/e2/procedures/e2_subscription_setup_procedure.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/e2/procedures/e2_subscription_delete_procedure.h b/lib/e2/procedures/e2_subscription_delete_procedure.h index c8e65ee284..7c6b27cdd0 100644 --- a/lib/e2/procedures/e2_subscription_delete_procedure.h +++ b/lib/e2/procedures/e2_subscription_delete_procedure.h @@ -40,12 +40,12 @@ class e2_subscription_delete_procedure void send_e2_subscription_delete_response(const e2_subscribe_delete_response_message& response); void send_e2_subscription_delete_failure(const e2_subscribe_delete_response_message& failure); - const asn1::e2ap::ric_sub_delete_request_s& request; - e2_event_manager& event_manager; - srslog::basic_logger& logger; - e2_message_notifier& ric_notif; - e2_subscription_proc& subscription_mngr; - timer_factory timers; + const asn1::e2ap::ric_sub_delete_request_s request; + e2_event_manager& event_manager; + srslog::basic_logger& logger; + e2_message_notifier& ric_notif; + e2_subscription_proc& subscription_mngr; + timer_factory timers; }; } // namespace srsran diff --git a/lib/e2/procedures/e2_subscription_setup_procedure.h b/lib/e2/procedures/e2_subscription_setup_procedure.h index 63a1eb1702..001998519a 100644 --- a/lib/e2/procedures/e2_subscription_setup_procedure.h +++ b/lib/e2/procedures/e2_subscription_setup_procedure.h @@ -40,12 +40,12 @@ class e2_subscription_setup_procedure void send_e2_subscription_setup_response(const e2_subscribe_reponse_message& response); void send_e2_subscription_setup_failure(const e2_subscribe_reponse_message& failure); - const asn1::e2ap::ric_sub_request_s& request; - e2_event_manager& event_manager; - srslog::basic_logger& logger; - e2_message_notifier& ric_notif; - e2_subscription_proc& subscription_mngr; - timer_factory timers; + const asn1::e2ap::ric_sub_request_s request; + e2_event_manager& event_manager; + srslog::basic_logger& logger; + e2_message_notifier& ric_notif; + e2_subscription_proc& subscription_mngr; + timer_factory timers; }; } // namespace srsran From cac1c0cb49fe998b2b10fb7b55f06bc606b0e257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfredo=20S=C3=A1ez?= Date: Tue, 17 Dec 2024 10:27:06 +0100 Subject: [PATCH 04/18] ci,infra: adjust requirements in retina jobs --- .gitlab/ci-shared/e2e.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab/ci-shared/e2e.yml b/.gitlab/ci-shared/e2e.yml index 57e53d712e..f8e511161b 100644 --- a/.gitlab/ci-shared/e2e.yml +++ b/.gitlab/ci-shared/e2e.yml @@ -70,11 +70,11 @@ variables: ARTIFACT_COMPRESSION_LEVEL: slowest RUNNER_AFTER_SCRIPT_TIMEOUT: 1m KUBERNETES_CPU_REQUEST: 1 - KUBERNETES_CPU_LIMIT: 1 + KUBERNETES_CPU_LIMIT: 2 KUBERNETES_MEMORY_REQUEST: 2Gi KUBERNETES_MEMORY_LIMIT: 2Gi - KUBERNETES_EPHEMERAL_STORAGE_REQUEST: "10G" - KUBERNETES_EPHEMERAL_STORAGE_LIMIT: "10G" + KUBERNETES_EPHEMERAL_STORAGE_REQUEST: "20G" + KUBERNETES_EPHEMERAL_STORAGE_LIMIT: "20G" <<: *setup_kube_variables GROUP: zmq tags: From 02a44dfc4bc6c2c1f42f8f74a486d6fa403eac08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfredo=20S=C3=A1ez?= Date: Wed, 18 Dec 2024 09:36:37 +0100 Subject: [PATCH 05/18] ci,e2e: increase job's timeout --- .gitlab/ci/e2e.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab/ci/e2e.yml b/.gitlab/ci/e2e.yml index ceb171cd0a..0e9f521058 100644 --- a/.gitlab/ci/e2e.yml +++ b/.gitlab/ci/e2e.yml @@ -268,7 +268,7 @@ amari 32UE 2x2 mimo: cudu amari 8UE: extends: .zmq - timeout: 1h + timeout: 2h variables: TESTBED: zmq_cudu MARKERS: "zmq and not smoke" @@ -279,7 +279,7 @@ cudu amari 8UE: cudu amari 32UE: extends: .zmq - timeout: 1h + timeout: 2h variables: TESTBED: zmq_cudu MARKERS: "zmq and not smoke" @@ -290,7 +290,7 @@ cudu amari 32UE: cudu amari 64UE: extends: .zmq - timeout: 2h + timeout: 3h variables: TESTBED: zmq_cudu MARKERS: "zmq and not smoke" From 42ae7928cc4e1f8c4ca10e256cf34c6b60307085 Mon Sep 17 00:00:00 2001 From: qarlosalberto Date: Wed, 18 Dec 2024 11:46:01 +0100 Subject: [PATCH 06/18] fix --- tests/e2e/tests/viavi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/tests/viavi.py b/tests/e2e/tests/viavi.py index 7327baccff..7f88ad849e 100644 --- a/tests/e2e/tests/viavi.py +++ b/tests/e2e/tests/viavi.py @@ -347,6 +347,7 @@ def _test_viavi( "band": 78, "bandwidth": 100, "common_scs": 30, + "inactivity_timer": 7200, "tac": 7, "pci": 1, "prach_config_index": 159, From 2f808e0ab5772c2fdab5957af290de8e328b7ea0 Mon Sep 17 00:00:00 2001 From: qarlosalberto Date: Wed, 18 Dec 2024 16:12:34 +0100 Subject: [PATCH 07/18] ci: update drx test, move b200 node --- .gitlab/ci/e2e/.env | 2 +- .gitlab/ci/e2e/retina_request_rf_b200.yml | 6 +++--- tests/e2e/tests/ping.py | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.gitlab/ci/e2e/.env b/.gitlab/ci/e2e/.env index d08a36cb8f..bb6906acae 100644 --- a/.gitlab/ci/e2e/.env +++ b/.gitlab/ci/e2e/.env @@ -1,6 +1,6 @@ SRSGNB_REGISTRY_URI=registry.gitlab.com/softwareradiosystems/srsgnb RETINA_REGISTRY_PREFIX=registry.gitlab.com/softwareradiosystems/ci/retina -RETINA_VERSION=0.59.0 +RETINA_VERSION=0.59.2 UBUNTU_VERSION=24.04 AMARISOFT_VERSION=2023-09-08 SRSUE_VERSION=23.11 diff --git a/.gitlab/ci/e2e/retina_request_rf_b200.yml b/.gitlab/ci/e2e/retina_request_rf_b200.yml index bd353901c4..8d3adbce40 100644 --- a/.gitlab/ci/e2e/retina_request_rf_b200.yml +++ b/.gitlab/ci/e2e/retina_request_rf_b200.yml @@ -9,7 +9,7 @@ - name: amarisoft-ue type: ue image: ${RETINA_REGISTRY_PREFIX}/amarisoftue:${AMARISOFT_VERSION}_${RETINA_VERSION} - labels: ["kubernetes.io/hostname=hp-oran"] + labels: ["kubernetes.io/hostname=ci-buildmaster"] nof_ports: 4 requirements: arch: amd64 @@ -17,8 +17,8 @@ requests: 12 limits: 12 memory: - requests: "48G" - limits: "48G" + requests: "20G" + limits: "20G" ephemeral-storage: requests: "6G" limits: "6G" diff --git a/tests/e2e/tests/ping.py b/tests/e2e/tests/ping.py index 4f70d432d2..1aefba999f 100644 --- a/tests/e2e/tests/ping.py +++ b/tests/e2e/tests/ping.py @@ -192,10 +192,7 @@ def test_android_hp( ) @mark.parametrize( "band, common_scs, bandwidth", - ( - param(3, 15, 10, id="band:%s-scs:%s-bandwidth:%s"), - param(78, 30, 20, id="band:%s-scs:%s-bandwidth:%s"), - ), + (param(3, 15, 10, id="band:%s-scs:%s-bandwidth:%s"),), ) @mark.android_drx @mark.flaky( From 30df0f06d86abcec0bd9ced74f6442081705ba2d Mon Sep 17 00:00:00 2001 From: Alejandro Leal Date: Fri, 13 Dec 2024 15:30:45 +0100 Subject: [PATCH 08/18] fapi_adaptor: added the fapi_sector_adaptor and fapi_adaptor for the MAC and PHY. Removed unused function. o_du_low: removed method get_all_upper_phys from the interface --- .../flexible_o_du/o_du_high/CMakeLists.txt | 6 +- .../flexible_o_du/o_du_low/CMakeLists.txt | 2 +- .../split_6/split6_o_du_impl.cpp | 12 +- .../split_helpers/flexible_o_du_factory.cpp | 29 ++- .../split_helpers/flexible_o_du_impl.cpp | 14 +- .../split_helpers/flexible_o_du_impl.h | 3 +- include/srsran/du/du_high/o_du_high.h | 18 +- include/srsran/du/du_low/du_low.h | 3 - include/srsran/du/du_low/o_du_low.h | 31 +-- include/srsran/du/o_du_factory.h | 3 - .../fapi_adaptor/mac/mac_fapi_adaptor.h | 47 +---- .../mac/mac_fapi_adaptor_config.h | 34 +++- .../mac/mac_fapi_sector_adaptor.h | 66 +++++++ .../fapi_adaptor/phy/phy_fapi_adaptor.h | 47 +---- .../phy/phy_fapi_adaptor_config.h | 79 ++++++++ .../phy/phy_fapi_adaptor_factory.h | 63 +----- .../phy/phy_fapi_sector_adaptor.h | 66 +++++++ lib/du/du_high/o_du_high_factory.cpp | 186 +++--------------- lib/du/du_high/o_du_high_impl.cpp | 63 ++---- lib/du/du_high/o_du_high_impl.h | 27 ++- lib/du/du_low/du_low_impl.cpp | 4 - lib/du/du_low/du_low_impl.h | 5 +- lib/du/du_low/o_du_low_factory.cpp | 136 ++++--------- lib/du/du_low/o_du_low_impl.cpp | 73 ++----- lib/du/du_low/o_du_low_impl.h | 25 +-- lib/du/o_du_factory.cpp | 25 --- lib/du/o_du_impl.cpp | 10 +- lib/fapi_adaptor/mac/CMakeLists.txt | 2 +- .../mac/mac_fapi_adaptor_factory_impl.cpp | 107 +++++++++- .../mac/mac_fapi_adaptor_impl.cpp | 59 +----- lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.h | 45 +---- .../mac/mac_fapi_sector_adaptor_impl.cpp | 70 +++++++ .../mac/mac_fapi_sector_adaptor_impl.h | 67 +++++++ lib/fapi_adaptor/phy/CMakeLists.txt | 2 +- .../phy/fapi_to_phy_translator.cpp | 4 +- lib/fapi_adaptor/phy/fapi_to_phy_translator.h | 4 +- .../phy/phy_fapi_adaptor_factory_impl.cpp | 111 ++++++++--- .../phy/phy_fapi_adaptor_factory_impl.h | 6 +- .../phy/phy_fapi_adaptor_impl.cpp | 103 +--------- lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.h | 92 +-------- .../phy/phy_fapi_sector_adaptor_impl.cpp | 117 +++++++++++ .../phy/phy_fapi_sector_adaptor_impl.h | 114 +++++++++++ .../phy/fapi_to_phy_translator_test.cpp | 2 +- 43 files changed, 1035 insertions(+), 947 deletions(-) create mode 100644 include/srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h create mode 100644 include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_config.h create mode 100644 include/srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h create mode 100644 lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.cpp create mode 100644 lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.h create mode 100644 lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.cpp create mode 100644 lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.h diff --git a/apps/units/flexible_o_du/o_du_high/CMakeLists.txt b/apps/units/flexible_o_du/o_du_high/CMakeLists.txt index 46ee68950e..5367ef174b 100644 --- a/apps/units/flexible_o_du/o_du_high/CMakeLists.txt +++ b/apps/units/flexible_o_du/o_du_high/CMakeLists.txt @@ -12,4 +12,8 @@ add_subdirectory(fapi) add_library(srsran_o_du_high_unit_helpers STATIC o_du_high_unit_factory.cpp) target_include_directories(srsran_o_du_high_unit_helpers PRIVATE ${CMAKE_SOURCE_DIR}) -target_link_libraries(srsran_o_du_high_unit_helpers PRIVATE srsran_du_high_unit_helpers srsran_fapi_app_unit srsran_o_du_high_app_unit_e2) +target_link_libraries(srsran_o_du_high_unit_helpers PRIVATE + srsran_du_high_unit_helpers + srsran_fapi_app_unit + srsran_o_du_high_app_unit_e2 + srsran_o_du_high) diff --git a/apps/units/flexible_o_du/o_du_low/CMakeLists.txt b/apps/units/flexible_o_du/o_du_low/CMakeLists.txt index 471539130c..d7da19d772 100644 --- a/apps/units/flexible_o_du/o_du_low/CMakeLists.txt +++ b/apps/units/flexible_o_du/o_du_low/CMakeLists.txt @@ -16,7 +16,7 @@ set(SOURCES add_library(srsran_o_du_low_unit_helpers STATIC ${SOURCES}) target_include_directories(srsran_o_du_low_unit_helpers PRIVATE ${CMAKE_SOURCE_DIR}) -set(DU_LOW_UNIT_HELPERS_LIBRARIES srsran_upper_phy srsran_cpu_affinities_helper) +set(DU_LOW_UNIT_HELPERS_LIBRARIES srsran_upper_phy srsran_cpu_affinities_helper srsran_o_du_low) # Hardware acceleration for both PUSCH and PDSCH is enabled by default when using DPDK. if (DPDK_FOUND) diff --git a/apps/units/flexible_o_du/split_6/split6_o_du_impl.cpp b/apps/units/flexible_o_du/split_6/split6_o_du_impl.cpp index 497f98bf12..c0170b1e69 100644 --- a/apps/units/flexible_o_du/split_6/split6_o_du_impl.cpp +++ b/apps/units/flexible_o_du/split_6/split6_o_du_impl.cpp @@ -9,6 +9,8 @@ */ #include "split6_o_du_impl.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_adaptor.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h" #include "srsran/support/srsran_assert.h" using namespace srsran; @@ -20,15 +22,15 @@ split6_o_du_impl::split6_o_du_impl(std::vectorget_mac_fapi_adaptor().get_sector_adaptor(i); + adaptors[i]->get_message_interface_collection().set_slot_data_message_notifier( - odu_hi->get_slot_data_message_notifier(i)); + fapi_sector.get_slot_data_message_notifier()); adaptors[i]->get_message_interface_collection().set_slot_error_message_notifier( - odu_hi->get_slot_error_message_notifier(i)); + fapi_sector.get_slot_error_message_notifier()); adaptors[i]->get_message_interface_collection().set_slot_time_message_notifier( - odu_hi->get_slot_time_message_notifier(i)); + fapi_sector.get_slot_time_message_notifier()); } } diff --git a/apps/units/flexible_o_du/split_helpers/flexible_o_du_factory.cpp b/apps/units/flexible_o_du/split_helpers/flexible_o_du_factory.cpp index 4a5a7586d8..cc45d0ca92 100644 --- a/apps/units/flexible_o_du/split_helpers/flexible_o_du_factory.cpp +++ b/apps/units/flexible_o_du/split_helpers/flexible_o_du_factory.cpp @@ -18,6 +18,10 @@ #include "flexible_o_du_impl.h" #include "srsran/du/o_du_factory.h" #include "srsran/e2/e2_du_metrics_connector.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_adaptor.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h" +#include "srsran/fapi_adaptor/phy/phy_fapi_adaptor.h" +#include "srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h" using namespace srsran; @@ -62,16 +66,29 @@ o_du_unit flexible_o_du_factory::create_flexible_o_du(const o_du_unit_dependenci // Adjust the dependencies. for (unsigned i = 0, e = du_cells.size(); i != e; ++i) { - auto& sector_dependencies = odu_hi_unit_dependencies.o_du_hi_dependencies.sectors.emplace_back(); - sector_dependencies.gateway = &odu_lo_unit.o_du_lo->get_slot_message_gateway(i); - sector_dependencies.last_msg_notifier = &odu_lo_unit.o_du_lo->get_slot_last_message_notifier(i); - sector_dependencies.fapi_executor = config.odu_high_cfg.fapi_cfg.l2_nof_slots_ahead != 0 - ? std::optional(dependencies.workers->fapi_exec[i]) - : std::make_optional(); + auto& sector_dependencies = odu_hi_unit_dependencies.o_du_hi_dependencies.sectors.emplace_back(); + sector_dependencies.gateway = + &odu_lo_unit.o_du_lo->get_phy_fapi_adaptor().get_sector_adaptor(i).get_slot_message_gateway(); + sector_dependencies.last_msg_notifier = + &odu_lo_unit.o_du_lo->get_phy_fapi_adaptor().get_sector_adaptor(i).get_slot_last_message_notifier(); + sector_dependencies.fapi_executor = config.odu_high_cfg.fapi_cfg.l2_nof_slots_ahead != 0 + ? std::optional(dependencies.workers->fapi_exec[i]) + : std::make_optional(); } o_du_high_unit odu_hi_unit = make_o_du_high_unit(config.odu_high_cfg, std::move(odu_hi_unit_dependencies)); + // Connect the adaptors. + for (unsigned i = 0, e = du_cells.size(); i != e; ++i) { + fapi_adaptor::phy_fapi_sector_adaptor& odu_lo = odu_lo_unit.o_du_lo->get_phy_fapi_adaptor().get_sector_adaptor(i); + fapi_adaptor::mac_fapi_sector_adaptor& odu_hi = odu_hi_unit.o_du_hi->get_mac_fapi_adaptor().get_sector_adaptor(i); + + // Connect O-DU low with O-DU high. + odu_lo.set_slot_time_message_notifier(odu_hi.get_slot_time_message_notifier()); + odu_lo.set_slot_error_message_notifier(odu_hi.get_slot_error_message_notifier()); + odu_lo.set_slot_data_message_notifier(odu_hi.get_slot_data_message_notifier()); + } + o_du.metrics = std::move(odu_hi_unit.metrics); o_du.commands = std::move(odu_hi_unit.commands); diff --git a/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.cpp b/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.cpp index 434c927b31..8b201e3ffa 100644 --- a/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.cpp +++ b/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.cpp @@ -18,8 +18,8 @@ using namespace srsran; -flexible_o_du_impl::flexible_o_du_impl(unsigned nof_cells) : - ru_ul_adapt(nof_cells), ru_timing_adapt(nof_cells), ru_error_adapt(nof_cells) +flexible_o_du_impl::flexible_o_du_impl(unsigned nof_cells_) : + nof_cells(nof_cells_), ru_ul_adapt(nof_cells_), ru_timing_adapt(nof_cells_), ru_error_adapt(nof_cells_) { } @@ -51,11 +51,11 @@ void flexible_o_du_impl::add_du(std::unique_ptr active_du) srsran_assert(du, "Cannot set an invalid DU"); // Connect all the sectors of the DU low to the RU adaptors. - span upper_ptrs = du->get_o_du_low().get_du_low().get_all_upper_phys(); - for (auto* upper : upper_ptrs) { + for (unsigned i = 0; i != nof_cells; ++i) { + auto& upper = du->get_o_du_low().get_du_low().get_upper_phy(i); // Make connections between DU and RU. - ru_ul_adapt.map_handler(upper->get_sector_id(), upper->get_rx_symbol_handler()); - ru_timing_adapt.map_handler(upper->get_sector_id(), upper->get_timing_handler()); - ru_error_adapt.map_handler(upper->get_sector_id(), upper->get_error_handler()); + ru_ul_adapt.map_handler(i, upper.get_rx_symbol_handler()); + ru_timing_adapt.map_handler(i, upper.get_timing_handler()); + ru_error_adapt.map_handler(i, upper.get_error_handler()); } } diff --git a/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.h b/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.h index 7564e92d3e..1d18e03e6b 100644 --- a/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.h +++ b/apps/units/flexible_o_du/split_helpers/flexible_o_du_impl.h @@ -26,7 +26,7 @@ class radio_unit; class flexible_o_du_impl : public srs_du::du, public du_power_controller { public: - explicit flexible_o_du_impl(unsigned nof_cells); + explicit flexible_o_du_impl(unsigned nof_cells_); // See interface for documentation. du_power_controller& get_power_controller() override { return *this; } @@ -51,6 +51,7 @@ class flexible_o_du_impl : public srs_du::du, public du_power_controller upper_phy_ru_ul_request_adapter& get_upper_ru_ul_request_adapter() { return ru_ul_request_adapt; } private: + const unsigned nof_cells; upper_phy_ru_ul_adapter ru_ul_adapt; upper_phy_ru_timing_adapter ru_timing_adapt; upper_phy_ru_error_adapter ru_error_adapt; diff --git a/include/srsran/du/du_high/o_du_high.h b/include/srsran/du/du_high/o_du_high.h index 3d50941092..0e3a27aa44 100644 --- a/include/srsran/du/du_high/o_du_high.h +++ b/include/srsran/du/du_high/o_du_high.h @@ -14,11 +14,9 @@ namespace srsran { class du_power_controller; -namespace fapi { -class slot_data_message_notifier; -class slot_error_message_notifier; -class slot_time_message_notifier; -} // namespace fapi +namespace fapi_adaptor { +class mac_fapi_adaptor; +} // namespace fapi_adaptor namespace srs_du { @@ -36,14 +34,8 @@ class o_du_high /// Returns the DU high from this O-RAN DU high. virtual du_high& get_du_high() = 0; - /// Returns the FAPI slot data message notifier for the given cell of this O-RAN DU high. - virtual fapi::slot_data_message_notifier& get_slot_data_message_notifier(unsigned cell_id) = 0; - - /// Returns the FAPI slot error message notifier for the given cell of this O-RAN DU high. - virtual fapi::slot_error_message_notifier& get_slot_error_message_notifier(unsigned cell_id) = 0; - - /// Returns the FAPI slot time message notifier for the given cell of this O-RAN DU high. - virtual fapi::slot_time_message_notifier& get_slot_time_message_notifier(unsigned cell_id) = 0; + /// Returns the MAC-FAPI adaptor of this O-RAN DU high. + virtual fapi_adaptor::mac_fapi_adaptor& get_mac_fapi_adaptor() = 0; }; } // namespace srs_du diff --git a/include/srsran/du/du_low/du_low.h b/include/srsran/du/du_low/du_low.h index 3720aae7a2..a2c100d5b5 100644 --- a/include/srsran/du/du_low/du_low.h +++ b/include/srsran/du/du_low/du_low.h @@ -31,9 +31,6 @@ class du_low /// Returns the upper PHY for the given cell of this DU low. virtual upper_phy& get_upper_phy(unsigned cell_id) = 0; - - /// Returns a span of the upper PHYs managed by this DU low. - virtual span get_all_upper_phys() = 0; }; } // namespace srs_du diff --git a/include/srsran/du/du_low/o_du_low.h b/include/srsran/du/du_low/o_du_low.h index 135152a676..423c218c05 100644 --- a/include/srsran/du/du_low/o_du_low.h +++ b/include/srsran/du/du_low/o_du_low.h @@ -12,13 +12,9 @@ namespace srsran { -namespace fapi { -class slot_data_message_notifier; -class slot_error_message_notifier; -class slot_last_message_notifier; -class slot_message_gateway; -class slot_time_message_notifier; -} // namespace fapi +namespace fapi_adaptor { +class phy_fapi_adaptor; +} namespace srs_du { @@ -31,26 +27,11 @@ class o_du_low /// Default destructor. virtual ~o_du_low() = default; - /// Returns the upper PHY of this DU low. + /// Returns the upper PHY of this O-DU low. virtual du_low& get_du_low() = 0; - /// Returns a reference to the FAPI slot-based message gateway for the given cell of this O-RAN DU low. - virtual fapi::slot_message_gateway& get_slot_message_gateway(unsigned cell_id) = 0; - - /// Returns a reference to the FAPI slot-based last message notifier for the given cell of this O-RAN DU low. - virtual fapi::slot_last_message_notifier& get_slot_last_message_notifier(unsigned cell_id) = 0; - - /// Configures the FAPI slot-based, time-specific message notifier for the given cell to the given one. - virtual void set_slot_time_message_notifier(unsigned cell_id, - fapi::slot_time_message_notifier& fapi_time_notifier) = 0; - - /// Configures the FAPI slot-based, error-specific message notifier for the given cell to the given one. - virtual void set_slot_error_message_notifier(unsigned cell_id, - fapi::slot_error_message_notifier& fapi_error_notifier) = 0; - - /// Configures the FAPI slot-based, data-specific message notifier for the given cell to the given one. - virtual void set_slot_data_message_notifier(unsigned cell_id, - fapi::slot_data_message_notifier& fapi_data_notifier) = 0; + /// Returns the PHY–FAPI adaptor of this O-DU low. + virtual fapi_adaptor::phy_fapi_adaptor& get_phy_fapi_adaptor() = 0; }; } // namespace srs_du diff --git a/include/srsran/du/o_du_factory.h b/include/srsran/du/o_du_factory.h index 678de36a4b..0947670896 100644 --- a/include/srsran/du/o_du_factory.h +++ b/include/srsran/du/o_du_factory.h @@ -17,9 +17,6 @@ namespace srsran { namespace srs_du { -/// Instantiates an O-RAN Distributed Unit (O-DU) object with the given configuration and dependencies. -std::unique_ptr make_o_du(const o_du_config& du_cfg, o_du_dependencies&& dependencies); - /// Instantiates an O-RAN Distributed Unit (O-DU) object with the given configuration and dependencies. std::unique_ptr make_o_du(std::unique_ptr odu_hi, std::unique_ptr odu_lo); diff --git a/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor.h b/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor.h index f5015b6dfe..de9615dc49 100644 --- a/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor.h +++ b/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor.h @@ -11,55 +11,18 @@ #pragma once namespace srsran { - -namespace fapi { -class slot_data_message_notifier; -class slot_error_message_notifier; -class slot_time_message_notifier; -} // namespace fapi - -class mac_cell_control_information_handler; -class mac_cell_rach_handler; -class mac_cell_result_notifier; -class mac_cell_slot_handler; -class mac_pdu_handler; - namespace fapi_adaptor { -/// \brief MAC–FAPI bidirectional adaptor interface. -/// -/// This adaptor is a collection of interfaces to translate FAPI messages into their MAC layer counterpart and vice -/// versa. -/// -/// \note All implementations of this public interface must hold the ownership of all its internal components. +class mac_fapi_sector_adaptor; + +/// MAC–FAPI bidirectional adaptor interface. class mac_fapi_adaptor { public: virtual ~mac_fapi_adaptor() = default; - /// \brief Returns a reference to the slot time notifier used by the adaptor. - virtual fapi::slot_time_message_notifier& get_slot_time_message_notifier() = 0; - - /// \brief Returns a reference to the slot error notifier used by the adaptor. - virtual fapi::slot_error_message_notifier& get_slot_error_message_notifier() = 0; - - /// \brief Returns a reference to the slot data notifier used by the adaptor. - virtual fapi::slot_data_message_notifier& get_slot_data_message_notifier() = 0; - - /// \brief Returns a reference to the MAC cell results notifier used by the adaptor. - virtual mac_cell_result_notifier& get_cell_result_notifier() = 0; - - /// \brief Configures the MAC cell slot handler to the given one. - virtual void set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) = 0; - - /// \brief Configures the MAC cell RACH handler to the given one. - virtual void set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) = 0; - - /// \brief Configures the MAC cell PDU handler to the given one. - virtual void set_cell_pdu_handler(mac_pdu_handler& handler) = 0; - - /// \brief Configures the MAC cell CRC handler to the given one. - virtual void set_cell_crc_handler(mac_cell_control_information_handler& handler) = 0; + /// Returns the MAC–FAPI sector adaptor for the given cell id. + virtual mac_fapi_sector_adaptor& get_sector_adaptor(unsigned cell_id) = 0; }; } // namespace fapi_adaptor diff --git a/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor_config.h b/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor_config.h index 0d5bdd495f..42c9f85bff 100644 --- a/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor_config.h +++ b/include/srsran/fapi_adaptor/mac/mac_fapi_adaptor_config.h @@ -10,28 +10,38 @@ #pragma once -#include "srsran/fapi/slot_last_message_notifier.h" -#include "srsran/fapi/slot_message_gateway.h" #include "srsran/fapi_adaptor/precoding_matrix_mapper.h" #include "srsran/fapi_adaptor/uci_part2_correspondence_mapper.h" #include "srsran/ran/subcarrier_spacing.h" #include namespace srsran { + +class task_executor; + +namespace fapi { +class slot_message_gateway; +class slot_last_message_notifier; +} // namespace fapi + namespace fapi_adaptor { -/// MAC–FAPI adaptor configuration. -struct mac_fapi_adaptor_config { +/// MAC–FAPI sector adaptor configuration. +struct mac_fapi_sector_adaptor_config { /// Base station sector identifier. unsigned sector_id; /// Cell number of resource blocks. unsigned cell_nof_prbs; /// Subcarrier spacing as per TS38.331 Section 6.2.2. subcarrier_spacing scs; + /// Log level. + srslog::basic_levels log_level; + /// Number of slots the L2 is ahead the L1. + unsigned l2_nof_slots_ahead; }; -/// MAC–FAPI adaptor dependencies. -struct mac_fapi_adaptor_dependencies { +/// MAC–FAPI sector adaptor dependencies. +struct mac_fapi_sector_adaptor_dependencies { /// Slot-specific FAPI message gateway. fapi::slot_message_gateway* gateway; /// Slot-specific last message notifier. @@ -40,6 +50,18 @@ struct mac_fapi_adaptor_dependencies { std::unique_ptr pm_mapper; /// UCI Part2 mapper. std::unique_ptr part2_mapper; + /// FAPI message bufferer task executor. + std::optional bufferer_task_executor; +}; + +/// MAC–FAPI adaptor configuration. +struct mac_fapi_adaptor_config { + std::vector sectors; +}; + +/// MAC–FAPI adaptor dependencies. +struct mac_fapi_adaptor_dependencies { + std::vector sectors; }; } // namespace fapi_adaptor diff --git a/include/srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h b/include/srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h new file mode 100644 index 0000000000..d017cfa0e5 --- /dev/null +++ b/include/srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h @@ -0,0 +1,66 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +namespace srsran { + +namespace fapi { +class slot_data_message_notifier; +class slot_error_message_notifier; +class slot_time_message_notifier; +} // namespace fapi + +class mac_cell_control_information_handler; +class mac_cell_rach_handler; +class mac_cell_result_notifier; +class mac_cell_slot_handler; +class mac_pdu_handler; + +namespace fapi_adaptor { + +/// \brief MAC–FAPI bidirectional adaptor sector interface. +/// +/// This adaptor is a collection of interfaces to translate FAPI messages into their MAC layer counterpart and vice +/// versa. +/// +/// \note All implementations of this public interface must hold the ownership of all its internal components. +class mac_fapi_sector_adaptor +{ +public: + virtual ~mac_fapi_sector_adaptor() = default; + + /// \brief Returns a reference to the slot time notifier used by the adaptor. + virtual fapi::slot_time_message_notifier& get_slot_time_message_notifier() = 0; + + /// \brief Returns a reference to the slot error notifier used by the adaptor. + virtual fapi::slot_error_message_notifier& get_slot_error_message_notifier() = 0; + + /// \brief Returns a reference to the slot data notifier used by the adaptor. + virtual fapi::slot_data_message_notifier& get_slot_data_message_notifier() = 0; + + /// \brief Returns a reference to the MAC cell results notifier used by the adaptor. + virtual mac_cell_result_notifier& get_cell_result_notifier() = 0; + + /// \brief Configures the MAC cell slot handler to the given one. + virtual void set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) = 0; + + /// \brief Configures the MAC cell RACH handler to the given one. + virtual void set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) = 0; + + /// \brief Configures the MAC cell PDU handler to the given one. + virtual void set_cell_pdu_handler(mac_pdu_handler& handler) = 0; + + /// \brief Configures the MAC cell CRC handler to the given one. + virtual void set_cell_crc_handler(mac_cell_control_information_handler& handler) = 0; +}; + +} // namespace fapi_adaptor +} // namespace srsran diff --git a/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor.h b/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor.h index eea77675d2..5e3719c72d 100644 --- a/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor.h +++ b/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor.h @@ -11,55 +11,18 @@ #pragma once namespace srsran { - -namespace fapi { -class slot_data_message_notifier; -class slot_error_message_notifier; -class slot_last_message_notifier; -class slot_message_gateway; -class slot_time_message_notifier; -} // namespace fapi - -class upper_phy_error_notifier; -class upper_phy_timing_notifier; -class upper_phy_rx_results_notifier; - namespace fapi_adaptor { -/// \brief PHY–FAPI bidirectional adaptor interface. -/// -/// This adaptor is a collection of interfaces to translate FAPI messages into their PHY layer counterpart and vice -/// versa. -/// -/// \note All implementations of this public interface must hold the ownership of all its internal components. +class phy_fapi_sector_adaptor; + +/// PHY–FAPI bidirectional adaptor interface. class phy_fapi_adaptor { public: virtual ~phy_fapi_adaptor() = default; - /// Returns a reference to the error notifier used by the adaptor. - virtual upper_phy_error_notifier& get_error_notifier() = 0; - - /// Returns a reference to the timing notifier used by the adaptor. - virtual upper_phy_timing_notifier& get_timing_notifier() = 0; - - /// Returns a reference to the results notifier used by the adaptor. - virtual upper_phy_rx_results_notifier& get_rx_results_notifier() = 0; - - /// Returns a reference to the slot-based message gateway used by the adaptor. - virtual fapi::slot_message_gateway& get_slot_message_gateway() = 0; - - /// Returns a reference to the slot-based last message notifier used by the adaptor. - virtual fapi::slot_last_message_notifier& get_slot_last_message_notifier() = 0; - - /// Configures the slot-based, time-specific message notifier to the given one. - virtual void set_slot_time_message_notifier(fapi::slot_time_message_notifier& fapi_time_notifier) = 0; - - /// Configures the slot-based, error-specific message notifier to the given one. - virtual void set_slot_error_message_notifier(fapi::slot_error_message_notifier& fapi_error_notifier) = 0; - - /// Configures the slot-based, data-specific message notifier to the given one. - virtual void set_slot_data_message_notifier(fapi::slot_data_message_notifier& fapi_data_notifier) = 0; + /// Returns the PHY-FAPI sector adaptor for the given cell id. + virtual phy_fapi_sector_adaptor& get_sector_adaptor(unsigned cell_id) = 0; }; } // namespace fapi_adaptor diff --git a/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_config.h b/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_config.h new file mode 100644 index 0000000000..78cb1f6138 --- /dev/null +++ b/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_config.h @@ -0,0 +1,79 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +#include "srsran/fapi_adaptor/precoding_matrix_repository.h" +#include "srsran/fapi_adaptor/uci_part2_correspondence_repository.h" +#include "srsran/srslog/logger.h" + +namespace srsran { + +class downlink_pdu_validator; +class downlink_processor_pool; +class resource_grid_pool; +class uplink_pdu_validator; +class uplink_request_processor; +class uplink_slot_pdu_repository; + +namespace srs_du { +struct du_cell_config; +} + +namespace fapi_adaptor { + +/// PHY–FAPI sector adaptor configuration. +struct phy_fapi_sector_adaptor_config { + /// Base station sector identifier. + unsigned sector_id; + /// Request headroom size in slots. + unsigned nof_slots_request_headroom; + /// DU cell configuration. + const srs_du::du_cell_config& du_cell; + /// PRACH port list. + std::vector prach_ports; +}; + +/// PHY–FAPI sector adaptor dependencies. +struct phy_fapi_sector_adaptor_dependencies { + /// Logger. + srslog::basic_logger* logger; + /// Downlink processor pool. + downlink_processor_pool* dl_processor_pool; + /// Downlink resource grid pool. + resource_grid_pool* dl_rg_pool; + /// Downlink PDU validator. + const downlink_pdu_validator* dl_pdu_validator; + /// Uplink request processor. + uplink_request_processor* ul_request_processor; + /// Uplink resource grid pool. + resource_grid_pool* ul_rg_pool; + /// Uplink slot PDU repository. + uplink_slot_pdu_repository* ul_pdu_repository; + /// Uplink PDU validator. + const uplink_pdu_validator* ul_pdu_validator; + /// Precoding matrix repository. + std::unique_ptr pm_repo; + /// UCI Part2 correspondence repository. + std::unique_ptr part2_repo; +}; + +/// PHY–FAPI adaptor configuration. +struct phy_fapi_adaptor_config { + std::vector sectors; +}; + +/// PHY–FAPI adaptor dependencies. +struct phy_fapi_adaptor_dependencies { + std::vector sectors; +}; + +} // namespace fapi_adaptor +} // namespace srsran diff --git a/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_factory.h b/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_factory.h index 0b59933a2c..d3cbedaf8a 100644 --- a/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_factory.h +++ b/include/srsran/fapi_adaptor/phy/phy_fapi_adaptor_factory.h @@ -10,68 +10,11 @@ #pragma once -#include "srsran/fapi/messages.h" -#include "srsran/fapi_adaptor/phy/phy_fapi_adaptor.h" -#include "srsran/fapi_adaptor/precoding_matrix_repository.h" -#include "srsran/fapi_adaptor/uci_part2_correspondence_repository.h" -#include "srsran/ran/subcarrier_spacing.h" -#include "srsran/srslog/logger.h" -#include "srsran/support/executors/task_executor.h" -#include +#include "srsran/fapi_adaptor/phy/phy_fapi_adaptor_config.h" namespace srsran { - -class downlink_pdu_validator; -class downlink_processor_pool; -class resource_grid_pool; -class uplink_pdu_validator; -class uplink_request_processor; -class uplink_slot_pdu_repository; - namespace fapi_adaptor { -/// Configuration parameters for the PHY–FAPI adaptor factory. -struct phy_fapi_adaptor_factory_config { - /// Base station sector identifier. - unsigned sector_id; - /// Request headroom size in slots. - unsigned nof_slots_request_headroom; - /// Subcarrier spacing as per TS38.211 Section 4.2. - subcarrier_spacing scs; - /// Common subcarrier spacing as per TS38.331 Section 6.2.2. - subcarrier_spacing scs_common; - /// PRACH configuration as per SCF-222 v4.0 Section 3.3.2.4 TLV 0x1031. - const fapi::prach_config* prach_cfg; - /// Carrier configuration per SCF-222 v4.0 Section 3.3.2.4 TLV 0x102d. - const fapi::carrier_config* carrier_cfg; - /// PRACH port list. - std::vector prach_ports; -}; - -/// Dependencies for the PHY–FAPI adaptor factory. -struct phy_fapi_adaptor_factory_dependencies { - /// Logger. - srslog::basic_logger* logger; - /// Downlink processor pool. - downlink_processor_pool* dl_processor_pool; - /// Downlink resource grid pool. - resource_grid_pool* dl_rg_pool; - /// Downlink PDU validator. - const downlink_pdu_validator* dl_pdu_validator; - /// Uplink request processor. - uplink_request_processor* ul_request_processor; - /// Uplink resource grid pool. - resource_grid_pool* ul_rg_pool; - /// Uplink slot PDU repository. - uplink_slot_pdu_repository* ul_pdu_repository; - /// Uplink PDU validator. - const uplink_pdu_validator* ul_pdu_validator; - /// Precoding matrix repository. - std::unique_ptr pm_repo; - /// UCI Part2 correspondence repository. - std::unique_ptr part2_repo; -}; - /// Factory to create \c phy_fapi_adaptor objects. class phy_fapi_adaptor_factory { @@ -79,8 +22,8 @@ class phy_fapi_adaptor_factory virtual ~phy_fapi_adaptor_factory() = default; /// Creates a \c phy_fapi_adaptor object using the given configuration and dependencies. - virtual std::unique_ptr create(const phy_fapi_adaptor_factory_config& config, - phy_fapi_adaptor_factory_dependencies&& dependencies) = 0; + virtual std::unique_ptr create(const phy_fapi_adaptor_config& config, + phy_fapi_adaptor_dependencies&& dependencies) = 0; }; /// Creates a \c phy_fapi_adaptor_factory object. diff --git a/include/srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h b/include/srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h new file mode 100644 index 0000000000..4bfce6ba5f --- /dev/null +++ b/include/srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h @@ -0,0 +1,66 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +namespace srsran { + +namespace fapi { +class slot_data_message_notifier; +class slot_error_message_notifier; +class slot_last_message_notifier; +class slot_message_gateway; +class slot_time_message_notifier; +} // namespace fapi + +class upper_phy_error_notifier; +class upper_phy_timing_notifier; +class upper_phy_rx_results_notifier; + +namespace fapi_adaptor { + +/// \brief PHY–FAPI bidirectional sector adaptor interface. +/// +/// This adaptor is a collection of interfaces to translate FAPI messages into their PHY layer counterpart and vice +/// versa. +/// +/// \note All implementations of this public interface must hold the ownership of all its internal components. +class phy_fapi_sector_adaptor +{ +public: + virtual ~phy_fapi_sector_adaptor() = default; + + /// Returns a reference to the error notifier used by the adaptor. + virtual upper_phy_error_notifier& get_error_notifier() = 0; + + /// Returns a reference to the timing notifier used by the adaptor. + virtual upper_phy_timing_notifier& get_timing_notifier() = 0; + + /// Returns a reference to the results notifier used by the adaptor. + virtual upper_phy_rx_results_notifier& get_rx_results_notifier() = 0; + + /// Returns a reference to the slot-based message gateway used by the adaptor. + virtual fapi::slot_message_gateway& get_slot_message_gateway() = 0; + + /// Returns a reference to the slot-based last message notifier used by the adaptor. + virtual fapi::slot_last_message_notifier& get_slot_last_message_notifier() = 0; + + /// Configures the slot-based, time-specific message notifier to the given one. + virtual void set_slot_time_message_notifier(fapi::slot_time_message_notifier& fapi_time_notifier) = 0; + + /// Configures the slot-based, error-specific message notifier to the given one. + virtual void set_slot_error_message_notifier(fapi::slot_error_message_notifier& fapi_error_notifier) = 0; + + /// Configures the slot-based, data-specific message notifier to the given one. + virtual void set_slot_data_message_notifier(fapi::slot_data_message_notifier& fapi_data_notifier) = 0; +}; + +} // namespace fapi_adaptor +} // namespace srsran diff --git a/lib/du/du_high/o_du_high_factory.cpp b/lib/du/du_high/o_du_high_factory.cpp index f0665aa886..2c733135e9 100644 --- a/lib/du/du_high/o_du_high_factory.cpp +++ b/lib/du/du_high/o_du_high_factory.cpp @@ -21,181 +21,53 @@ using namespace srsran; using namespace srs_du; -static std::unique_ptr -build_mac_fapi_adaptor(unsigned sector_id, - subcarrier_spacing scs, - fapi::slot_message_gateway& gateway, - fapi::slot_last_message_notifier& last_msg_notifier, - std::unique_ptr pm_mapper, - std::unique_ptr part2_mapper, - unsigned cell_nof_prbs) +static fapi_adaptor::mac_fapi_adaptor_config generate_fapi_adaptor_config(const o_du_high_config& config) { - std::unique_ptr adaptor_factory = - fapi_adaptor::create_mac_fapi_adaptor_factory(); - report_error_if_not(adaptor_factory, "Invalid MAC adaptor factory."); - - fapi_adaptor::mac_fapi_adaptor_config mac_fapi_config; - mac_fapi_config.sector_id = sector_id; - mac_fapi_config.cell_nof_prbs = cell_nof_prbs; - mac_fapi_config.scs = scs; - - fapi_adaptor::mac_fapi_adaptor_dependencies mac_fapi_deps; - mac_fapi_deps.gateway = &gateway; - mac_fapi_deps.last_msg_notifier = &last_msg_notifier; - mac_fapi_deps.pm_mapper = std::move(pm_mapper); - mac_fapi_deps.part2_mapper = std::move(part2_mapper); - - return adaptor_factory->create(mac_fapi_config, std::move(mac_fapi_deps)); -} - -static std::unique_ptr -build_fapi_adaptor(const du_cell_config& du_cell, const o_du_high_sector_dependencies& dependencies, unsigned sector) -{ - srsran_assert(dependencies.gateway, "Invalid gateway"); - srsran_assert(dependencies.last_msg_notifier, "Invalid last message notifier"); - - const subcarrier_spacing scs = du_cell.scs_common; - auto pm_tools = fapi_adaptor::generate_precoding_matrix_tables(du_cell.dl_carrier.nof_ant); - auto uci_part2_tools = fapi_adaptor::generate_uci_part2_correspondence(1); - - return build_mac_fapi_adaptor( - sector, - scs, - *dependencies.gateway, - *dependencies.last_msg_notifier, - std::move(std::get>(pm_tools)), - std::move(std::get>(uci_part2_tools)), - get_max_Nprb(du_cell.dl_carrier.carrier_bw_mhz, scs, frequency_range::FR1)); -} + fapi_adaptor::mac_fapi_adaptor_config out_config; -namespace { - -/// MAC-FAPI adaptor wrapper that wraps an adaptor and a FAPI decorator. -class mac_fapi_adaptor_wrapper : public fapi_adaptor::mac_fapi_adaptor -{ -public: - mac_fapi_adaptor_wrapper(const du_cell_config& du_cell, - const o_du_high_sector_dependencies& dependencies, - unsigned sector, - std::unique_ptr decorator_) : - decorator(std::move(decorator_)), - adaptor([](const du_cell_config& du_cell_adapt, - unsigned sector_id, - fapi::slot_message_gateway& gateway, - fapi::slot_last_message_notifier& last_msg_notifier) { - o_du_high_sector_dependencies adaptor_dependencies; - adaptor_dependencies.last_msg_notifier = &last_msg_notifier; - adaptor_dependencies.gateway = &gateway; - return build_fapi_adaptor(du_cell_adapt, adaptor_dependencies, sector_id); - }(du_cell, - sector, - decorator ? decorator->get_slot_message_gateway() : *dependencies.gateway, - decorator ? decorator->get_slot_last_message_notifier() : *dependencies.last_msg_notifier)) - { - if (decorator) { - decorator->set_slot_data_message_notifier(adaptor->get_slot_data_message_notifier()); - decorator->set_slot_error_message_notifier(adaptor->get_slot_error_message_notifier()); - decorator->set_slot_time_message_notifier(adaptor->get_slot_time_message_notifier()); - } + for (unsigned i = 0, e = config.du_hi.ran.cells.size(); i != e; ++i) { + const auto& du_cell = config.du_hi.ran.cells[i]; + unsigned nof_prb = get_max_Nprb(du_cell.dl_carrier.carrier_bw_mhz, du_cell.scs_common, frequency_range::FR1); + out_config.sectors.push_back( + {i, nof_prb, du_cell.scs_common, config.fapi.log_level, config.fapi.l2_nof_slots_ahead}); } - // See interface for documentation. - fapi::slot_time_message_notifier& get_slot_time_message_notifier() override - { - return decorator ? decorator->get_slot_time_message_notifier() : adaptor->get_slot_time_message_notifier(); - } - - // See interface for documentation. - fapi::slot_error_message_notifier& get_slot_error_message_notifier() override - { - return decorator ? decorator->get_slot_error_message_notifier() : adaptor->get_slot_error_message_notifier(); - } - - // See interface for documentation. - fapi::slot_data_message_notifier& get_slot_data_message_notifier() override - { - return decorator ? decorator->get_slot_data_message_notifier() : adaptor->get_slot_data_message_notifier(); - } - - // See interface for documentation. - mac_cell_result_notifier& get_cell_result_notifier() override { return adaptor->get_cell_result_notifier(); } - - // See interface for documentation. - void set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) override - { - adaptor->set_cell_slot_handler(mac_slot_handler); - } - - // See interface for documentation. - void set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) override - { - adaptor->set_cell_rach_handler(mac_rach_handler); - } - - // See interface for documentation. - void set_cell_pdu_handler(mac_pdu_handler& handler) override { adaptor->set_cell_pdu_handler(handler); } - - // See interface for documentation. - void set_cell_crc_handler(mac_cell_control_information_handler& handler) override - { - adaptor->set_cell_crc_handler(handler); - } - -private: - std::unique_ptr decorator; - std::unique_ptr adaptor; -}; - -} // namespace + return out_config; +} -static o_du_high_impl_dependencies -resolve_o_du_high_impl_dependencies(const o_du_high_config& config, - span odu_dependencies) +static fapi_adaptor::mac_fapi_adaptor_dependencies +generate_fapi_adaptor_dependencies(const o_du_high_config& config, o_du_high_dependencies& odu_dependencies) { - srsran_assert(config.du_hi.ran.cells.size() == odu_dependencies.size(), - "DU high number of cells '{}' does not match number sectors '{}' in O-DU dependencies", - config.du_hi.ran.cells.size(), - odu_dependencies.size()); - - o_du_high_impl_dependencies dependencies; - dependencies.logger = &srslog::fetch_basic_logger("DU"); - - for (unsigned i = 0, e = odu_dependencies.size(); i != e; ++i) { - fapi::decorator_config decorator_cfg; - - if (config.fapi.log_level == srslog::basic_levels::debug) { - decorator_cfg.logging_cfg.emplace(fapi::logging_decorator_config{srslog::fetch_basic_logger("FAPI", true), - *odu_dependencies[i].gateway, - *odu_dependencies[i].last_msg_notifier}); - } - - if (config.fapi.l2_nof_slots_ahead != 0) { - srsran_assert(odu_dependencies[i].fapi_executor, "Invalid executor for the FAPI message bufferer decorator"); - decorator_cfg.bufferer_cfg.emplace( - fapi::message_bufferer_decorator_config{config.fapi.l2_nof_slots_ahead, - config.du_hi.ran.cells[i].scs_common, - *odu_dependencies[i].fapi_executor.value(), - *odu_dependencies[i].gateway, - *odu_dependencies[i].last_msg_notifier}); - } - - dependencies.du_high_adaptor.push_back(std::make_unique( - config.du_hi.ran.cells[i], odu_dependencies[i], i, fapi::create_decorators(decorator_cfg))); + fapi_adaptor::mac_fapi_adaptor_dependencies out_dependencies; + + for (unsigned i = 0, e = config.du_hi.ran.cells.size(); i != e; ++i) { + auto& sector_dependencies = odu_dependencies.sectors[i]; + out_dependencies.sectors.push_back( + {sector_dependencies.gateway, + sector_dependencies.last_msg_notifier, + std::move(std::get>( + fapi_adaptor::generate_precoding_matrix_tables(config.du_hi.ran.cells[i].dl_carrier.nof_ant))), + std::move(std::get>( + fapi_adaptor::generate_uci_part2_correspondence(1))), + sector_dependencies.fapi_executor}); } - return dependencies; + return out_dependencies; } std::unique_ptr srsran::srs_du::make_o_du_high(const o_du_high_config& config, o_du_high_dependencies&& odu_dependencies) { - o_du_high_impl_dependencies dependencies = resolve_o_du_high_impl_dependencies(config, odu_dependencies.sectors); + o_du_high_impl_dependencies dependencies; + dependencies.logger = &srslog::fetch_basic_logger("DU"); + dependencies.du_high_adaptor = fapi_adaptor::create_mac_fapi_adaptor_factory()->create( + generate_fapi_adaptor_config(config), generate_fapi_adaptor_dependencies(config, odu_dependencies)); dependencies.logger->debug("FAPI adaptors created successfully"); srs_du::du_high_configuration du_hi_cfg = config.du_hi; - auto odu = std::make_unique(std::move(dependencies)); + auto odu = std::make_unique(config.du_hi.ran.cells.size(), std::move(dependencies)); // Instantiate DU-high. odu_dependencies.du_hi.phy_adapter = &odu->get_mac_result_notifier(); diff --git a/lib/du/du_high/o_du_high_impl.cpp b/lib/du/du_high/o_du_high_impl.cpp index 3af508901b..b97e5df873 100644 --- a/lib/du/du_high/o_du_high_impl.cpp +++ b/lib/du/du_high/o_du_high_impl.cpp @@ -9,6 +9,8 @@ */ #include "o_du_high_impl.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_adaptor.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h" using namespace srsran; using namespace srs_du; @@ -30,19 +32,20 @@ class phy_dummy : public mac_result_notifier } // namespace -o_du_high_impl::o_du_high_impl(o_du_high_impl_dependencies&& du_dependencies) : +o_du_high_impl::o_du_high_impl(unsigned nof_cells_, o_du_high_impl_dependencies&& du_dependencies) : + nof_cells(nof_cells_), logger(*du_dependencies.logger), du_high_adaptor(std::move(du_dependencies.du_high_adaptor)), - du_high_result_notifier([](span> fapi_adaptors) { + du_high_result_notifier([](fapi_adaptor::mac_fapi_adaptor& fapi_adaptor, unsigned num_cells) { std::vector> cells; - for (unsigned i = 0, e = fapi_adaptors.size(); i != e; ++i) { - cells.push_back(std::ref(fapi_adaptors[i]->get_cell_result_notifier())); + for (unsigned i = 0; i != num_cells; ++i) { + cells.push_back(std::ref(fapi_adaptor.get_sector_adaptor(i).get_cell_result_notifier())); } return std::make_unique(std::move(cells)); - }(du_high_adaptor)) + }(*du_high_adaptor, nof_cells)) { - srsran_assert(!du_high_adaptor.empty(), "Invalid FAPI MAC adaptor"); + srsran_assert(du_high_adaptor, "Invalid FAPI MAC adaptor"); } void o_du_high_impl::start() @@ -57,12 +60,13 @@ void o_du_high_impl::start() } // Configure the FAPI -> DU interface. - for (unsigned i = 0, e = du_high_adaptor.size(); i != e; ++i) { - du_cell_index_t cell_id = to_du_cell_index(i); - du_high_adaptor[i]->set_cell_slot_handler(du_hi->get_slot_handler(cell_id)); - du_high_adaptor[i]->set_cell_rach_handler(du_hi->get_rach_handler(cell_id)); - du_high_adaptor[i]->set_cell_pdu_handler(du_hi->get_pdu_handler()); - du_high_adaptor[i]->set_cell_crc_handler(du_hi->get_control_info_handler(cell_id)); + for (unsigned i = 0; i != nof_cells; ++i) { + du_cell_index_t cell_id = to_du_cell_index(i); + fapi_adaptor::mac_fapi_sector_adaptor& sector_adaptor = du_high_adaptor->get_sector_adaptor(i); + sector_adaptor.set_cell_slot_handler(du_hi->get_slot_handler(cell_id)); + sector_adaptor.set_cell_rach_handler(du_hi->get_rach_handler(cell_id)); + sector_adaptor.set_cell_pdu_handler(du_hi->get_pdu_handler()); + sector_adaptor.set_cell_crc_handler(du_hi->get_control_info_handler(cell_id)); } logger.info("DU started successfully"); @@ -81,6 +85,11 @@ void o_du_high_impl::stop() logger.info("DU stopped successfully"); } +fapi_adaptor::mac_fapi_adaptor& o_du_high_impl::get_mac_fapi_adaptor() +{ + return *du_high_adaptor; +} + du_high& o_du_high_impl::get_du_high() { return *du_hi; @@ -97,33 +106,3 @@ void o_du_high_impl::set_e2_agent(std::unique_ptr agent) e2agent = std::move(agent); srsran_assert(e2agent, "Invalid E2 agent"); } - -fapi::slot_data_message_notifier& o_du_high_impl::get_slot_data_message_notifier(unsigned cell_id) -{ - srsran_assert(cell_id < du_high_adaptor.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - du_high_adaptor.size()); - - return du_high_adaptor[cell_id]->get_slot_data_message_notifier(); -} - -fapi::slot_error_message_notifier& o_du_high_impl::get_slot_error_message_notifier(unsigned cell_id) -{ - srsran_assert(cell_id < du_high_adaptor.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - du_high_adaptor.size()); - - return du_high_adaptor[cell_id]->get_slot_error_message_notifier(); -} - -fapi::slot_time_message_notifier& o_du_high_impl::get_slot_time_message_notifier(unsigned cell_id) -{ - srsran_assert(cell_id < du_high_adaptor.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - du_high_adaptor.size()); - - return du_high_adaptor[cell_id]->get_slot_time_message_notifier(); -} diff --git a/lib/du/du_high/o_du_high_impl.h b/lib/du/du_high/o_du_high_impl.h index 821959924b..ee089a3a31 100644 --- a/lib/du/du_high/o_du_high_impl.h +++ b/lib/du/du_high/o_du_high_impl.h @@ -15,22 +15,22 @@ #include "srsran/du/du_power_controller.h" #include "srsran/du/o_du_config.h" #include "srsran/e2/e2.h" -#include "srsran/fapi_adaptor/mac/mac_fapi_adaptor.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h" namespace srsran { namespace srs_du { /// O-RAN DU high implementation dependencies. struct o_du_high_impl_dependencies { - srslog::basic_logger* logger; - std::vector> du_high_adaptor; + srslog::basic_logger* logger; + std::unique_ptr du_high_adaptor; }; /// O-RAN DU high implementation. class o_du_high_impl : public o_du_high, public du_power_controller { public: - explicit o_du_high_impl(o_du_high_impl_dependencies&& du_dependencies); + o_du_high_impl(unsigned nof_cells_, o_du_high_impl_dependencies&& du_dependencies); // See interface for documentation. du_power_controller& get_power_controller() override { return *this; } @@ -42,13 +42,7 @@ class o_du_high_impl : public o_du_high, public du_power_controller void stop() override; // See interface for documentation. - fapi::slot_data_message_notifier& get_slot_data_message_notifier(unsigned cell_id) override; - - // See interface for documentation. - fapi::slot_error_message_notifier& get_slot_error_message_notifier(unsigned cell_id) override; - - // See interface for documentation. - fapi::slot_time_message_notifier& get_slot_time_message_notifier(unsigned cell_id) override; + fapi_adaptor::mac_fapi_adaptor& get_mac_fapi_adaptor() override; // See interface for documentation. du_high& get_du_high() override; @@ -63,11 +57,12 @@ class o_du_high_impl : public o_du_high, public du_power_controller mac_result_notifier& get_mac_result_notifier() { return *du_high_result_notifier; } private: - srslog::basic_logger& logger; - std::vector> du_high_adaptor; - std::unique_ptr du_high_result_notifier; - std::unique_ptr du_hi; - std::unique_ptr e2agent; + const unsigned nof_cells; + srslog::basic_logger& logger; + std::unique_ptr du_high_adaptor; + std::unique_ptr du_high_result_notifier; + std::unique_ptr du_hi; + std::unique_ptr e2agent; }; } // namespace srs_du diff --git a/lib/du/du_low/du_low_impl.cpp b/lib/du/du_low/du_low_impl.cpp index ea9e5c0335..527b2c9515 100644 --- a/lib/du/du_low/du_low_impl.cpp +++ b/lib/du/du_low/du_low_impl.cpp @@ -34,7 +34,3 @@ void du_low_impl::stop() cell->stop(); } } -span du_low_impl::get_all_upper_phys() -{ - return upper_ptrs; -} diff --git a/lib/du/du_low/du_low_impl.h b/lib/du/du_low/du_low_impl.h index 802e6eef5f..aedb92499a 100644 --- a/lib/du/du_low/du_low_impl.h +++ b/lib/du/du_low/du_low_impl.h @@ -30,14 +30,11 @@ class du_low_impl final : public du_low, public du_power_controller du_power_controller& get_power_controller() override { return *this; } // See interface for documentation. - void start() override{}; + void start() override {} // See interface for documentation. void stop() override; - // See interface for documentation. - span get_all_upper_phys() override; - private: std::vector> upper; std::vector upper_ptrs; diff --git a/lib/du/du_low/o_du_low_factory.cpp b/lib/du/du_low/o_du_low_factory.cpp index bf0f086f70..898af2efe1 100644 --- a/lib/du/du_low/o_du_low_factory.cpp +++ b/lib/du/du_low/o_du_low_factory.cpp @@ -21,98 +21,48 @@ using namespace srsran; using namespace srs_du; -static fapi::prach_config generate_prach_config_tlv(const du_cell_config& cell_cfg) +static fapi_adaptor::phy_fapi_adaptor_config generate_fapi_adaptor_config(const o_du_low_config& odu_low_cfg, + span du_cell) { - fapi::prach_config config = {}; - config.prach_res_config_index = 0; - config.prach_sequence_length = fapi::prach_sequence_length_type::long_sequence; - config.prach_scs = prach_subcarrier_spacing::kHz1_25; - config.prach_ul_bwp_pusch_scs = cell_cfg.scs_common; - config.restricted_set = restricted_set_config::UNRESTRICTED; - config.num_prach_fd_occasions = cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.msg1_fdm; - config.prach_config_index = - cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.prach_config_index; - config.prach_format = prach_format_type::zero; - config.num_prach_td_occasions = 1; - config.num_preambles = 1; - config.start_preamble_index = 0; - - // Add FD occasion info. - fapi::prach_fd_occasion_config& fd_occasion = config.fd_occasions.emplace_back(); - fd_occasion.prach_root_sequence_index = - cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().prach_root_seq_index; - fd_occasion.prach_freq_offset = - cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.msg1_frequency_start; - fd_occasion.prach_zero_corr_conf = - cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.zero_correlation_zone_config; - - return config; -} - -static fapi::carrier_config generate_carrier_config_tlv(const du_cell_config& du_cell) -{ - // Deduce common numerology and grid size for DL and UL. - unsigned numerology = to_numerology_value(du_cell.scs_common); - unsigned grid_size_bw_prb = - band_helper::get_n_rbs_from_bw(MHz_to_bs_channel_bandwidth(du_cell.dl_carrier.carrier_bw_mhz), - du_cell.scs_common, - band_helper::get_freq_range(du_cell.dl_carrier.band)); - - fapi::carrier_config fapi_config = {}; - - // NOTE; for now we only need to fill the nof_prb_ul_grid and nof_prb_dl_grid for the common SCS. - fapi_config.dl_grid_size = {}; - fapi_config.dl_grid_size[numerology] = grid_size_bw_prb; - fapi_config.ul_grid_size = {}; - fapi_config.ul_grid_size[numerology] = grid_size_bw_prb; - - // Number of transmit and receive antenna ports. - fapi_config.num_tx_ant = du_cell.dl_carrier.nof_ant; - fapi_config.num_rx_ant = du_cell.ul_carrier.nof_ant; + fapi_adaptor::phy_fapi_adaptor_config out_config; + + for (unsigned i = 0, e = du_cell.size(); i != e; ++i) { + const upper_phy_config& upper_cfg = odu_low_cfg.du_low_cfg.cells[i].upper_phy_cfg; + const du_cell_config& cell_cfg = du_cell[i]; + out_config.sectors.push_back( + {upper_cfg.sector_id, + upper_cfg.nof_slots_request_headroom, + cell_cfg, + std::vector(odu_low_cfg.prach_ports[i].begin(), odu_low_cfg.prach_ports[i].end())}); + } - return fapi_config; + return out_config; } -static std::unique_ptr create_phy_fapi_adaptor(upper_phy& upper, - const upper_phy_config& upper_cfg, - const du_cell_config& du_cell, - span prach_ports) +static fapi_adaptor::phy_fapi_adaptor_dependencies +generate_fapi_adaptor_dependencies(du_low& du_low, span du_cell) { - const subcarrier_spacing scs = du_cell.scs_common; - auto pm_tools = fapi_adaptor::generate_precoding_matrix_tables(du_cell.dl_carrier.nof_ant); - auto uci_part2_tools = fapi_adaptor::generate_uci_part2_correspondence(1); - - std::unique_ptr adaptor_factory = - fapi_adaptor::create_phy_fapi_adaptor_factory(); - report_error_if_not(adaptor_factory, "Invalid PHY adaptor factory."); - - auto prach_tlv = generate_prach_config_tlv(du_cell); - auto carrier_tlv = generate_carrier_config_tlv(du_cell); - - fapi_adaptor::phy_fapi_adaptor_factory_config phy_fapi_config; - phy_fapi_config.sector_id = upper_cfg.sector_id; - phy_fapi_config.nof_slots_request_headroom = upper_cfg.nof_slots_request_headroom; - phy_fapi_config.scs = scs; - phy_fapi_config.scs_common = scs; - phy_fapi_config.prach_cfg = &prach_tlv; - phy_fapi_config.carrier_cfg = &carrier_tlv; - phy_fapi_config.prach_ports = std::vector(prach_ports.begin(), prach_ports.end()); - - fapi_adaptor::phy_fapi_adaptor_factory_dependencies phy_fapi_dependencies; - phy_fapi_dependencies.logger = &srslog::fetch_basic_logger("FAPI"); - phy_fapi_dependencies.dl_processor_pool = &upper.get_downlink_processor_pool(); - phy_fapi_dependencies.dl_rg_pool = &upper.get_downlink_resource_grid_pool(); - phy_fapi_dependencies.dl_pdu_validator = &upper.get_downlink_pdu_validator(); - phy_fapi_dependencies.ul_request_processor = &upper.get_uplink_request_processor(); - phy_fapi_dependencies.ul_rg_pool = &upper.get_uplink_resource_grid_pool(); - phy_fapi_dependencies.ul_pdu_repository = &upper.get_uplink_slot_pdu_repository(); - phy_fapi_dependencies.ul_pdu_validator = &upper.get_uplink_pdu_validator(); - phy_fapi_dependencies.pm_repo = - std::move(std::get>(pm_tools)); - phy_fapi_dependencies.part2_repo = - std::move(std::get>(uci_part2_tools)); + fapi_adaptor::phy_fapi_adaptor_dependencies out_dependencies; + + for (unsigned i = 0, e = du_cell.size(); i != e; ++i) { + auto& dependencies = out_dependencies.sectors.emplace_back(); + upper_phy& upper = du_low.get_upper_phy(i); + + dependencies.logger = &srslog::fetch_basic_logger("FAPI"); + dependencies.dl_processor_pool = &upper.get_downlink_processor_pool(); + dependencies.dl_rg_pool = &upper.get_downlink_resource_grid_pool(); + dependencies.dl_pdu_validator = &upper.get_downlink_pdu_validator(); + dependencies.ul_request_processor = &upper.get_uplink_request_processor(); + dependencies.ul_rg_pool = &upper.get_uplink_resource_grid_pool(); + dependencies.ul_pdu_repository = &upper.get_uplink_slot_pdu_repository(); + dependencies.ul_pdu_validator = &upper.get_uplink_pdu_validator(); + dependencies.pm_repo = std::move(std::get>( + fapi_adaptor::generate_precoding_matrix_tables(du_cell[i].dl_carrier.nof_ant))); + dependencies.part2_repo = std::move(std::get>( + fapi_adaptor::generate_uci_part2_correspondence(1))); + } - return adaptor_factory->create(phy_fapi_config, std::move(phy_fapi_dependencies)); + return out_dependencies; } std::unique_ptr srsran::srs_du::make_o_du_low(const o_du_low_config& config, @@ -133,16 +83,8 @@ std::unique_ptr srsran::srs_du::make_o_du_low(const o_du_low_config& report_error_if_not(du_lo != nullptr, "Unable to create DU low."); logger.debug("DU low created successfully"); - // Instantiate adaptor of FAPI to DU-low. - std::vector> fapi_adaptors(config.du_low_cfg.cells.size()); - for (unsigned i = 0, e = config.du_low_cfg.cells.size(); i != e; ++i) { - fapi_adaptors[i] = create_phy_fapi_adaptor( - du_lo->get_upper_phy(i), config.du_low_cfg.cells[i].upper_phy_cfg, du_cells[i], config.prach_ports[i]); - - report_error_if_not(fapi_adaptors[i], "Unable to create PHY adaptor for cell '{}'", i); - } - - logger.debug("O-DU low created successfully"); + auto fapi_adaptor = fapi_adaptor::create_phy_fapi_adaptor_factory()->create( + generate_fapi_adaptor_config(config, du_cells), generate_fapi_adaptor_dependencies(*du_lo, du_cells)); - return std::make_unique(std::move(du_lo), std::move(fapi_adaptors)); + return std::make_unique(std::move(du_lo), std::move(fapi_adaptor), du_cells.size()); } diff --git a/lib/du/du_low/o_du_low_impl.cpp b/lib/du/du_low/o_du_low_impl.cpp index c6c7e0b008..3c052e78fb 100644 --- a/lib/du/du_low/o_du_low_impl.cpp +++ b/lib/du/du_low/o_du_low_impl.cpp @@ -9,23 +9,28 @@ */ #include "o_du_low_impl.h" +#include "srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h" #include "srsran/phy/upper/upper_phy.h" #include "srsran/support/srsran_assert.h" using namespace srsran; using namespace srs_du; -o_du_low_impl::o_du_low_impl(std::unique_ptr du_lo_, - std::vector> fapi_adaptors_) : - du_lo(std::move(du_lo_)), fapi_adaptors(std::move(fapi_adaptors_)) +o_du_low_impl::o_du_low_impl(std::unique_ptr du_lo_, + std::unique_ptr fapi_adaptor_, + unsigned nof_cells) : + du_lo(std::move(du_lo_)), fapi_adaptor(std::move(fapi_adaptor_)) { srsran_assert(du_lo, "Invalid upper PHY"); - srsran_assert(!fapi_adaptors.empty(), "Invalid FAPI adaptor"); + srsran_assert(fapi_adaptor, "Invalid FAPI adaptor"); - for (unsigned i = 0, e = fapi_adaptors.size(); i != e; ++i) { - du_lo->get_upper_phy(i).set_rx_results_notifier(fapi_adaptors[i]->get_rx_results_notifier()); - du_lo->get_upper_phy(i).set_timing_notifier(fapi_adaptors[i]->get_timing_notifier()); - du_lo->get_upper_phy(i).set_error_notifier(fapi_adaptors[i]->get_error_notifier()); + for (unsigned i = 0; i != nof_cells; ++i) { + upper_phy& upper = du_lo->get_upper_phy(i); + fapi_adaptor::phy_fapi_sector_adaptor& sector_adaptor = fapi_adaptor->get_sector_adaptor(i); + + upper.set_rx_results_notifier(sector_adaptor.get_rx_results_notifier()); + upper.set_timing_notifier(sector_adaptor.get_timing_notifier()); + upper.set_error_notifier(sector_adaptor.get_error_notifier()); } } @@ -34,55 +39,7 @@ du_low& o_du_low_impl::get_du_low() return *du_lo; } -fapi::slot_message_gateway& o_du_low_impl::get_slot_message_gateway(unsigned cell_id) -{ - srsran_assert(cell_id < fapi_adaptors.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - fapi_adaptors.size()); - - return fapi_adaptors[cell_id]->get_slot_message_gateway(); -} - -fapi::slot_last_message_notifier& o_du_low_impl::get_slot_last_message_notifier(unsigned cell_id) -{ - srsran_assert(cell_id < fapi_adaptors.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - fapi_adaptors.size()); - - return fapi_adaptors[cell_id]->get_slot_last_message_notifier(); -} - -void o_du_low_impl::set_slot_time_message_notifier(unsigned cell_id, - fapi::slot_time_message_notifier& fapi_time_notifier) +fapi_adaptor::phy_fapi_adaptor& o_du_low_impl::get_phy_fapi_adaptor() { - srsran_assert(cell_id < fapi_adaptors.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - fapi_adaptors.size()); - - fapi_adaptors[cell_id]->set_slot_time_message_notifier(fapi_time_notifier); -} - -void o_du_low_impl::set_slot_error_message_notifier(unsigned cell_id, - fapi::slot_error_message_notifier& fapi_error_notifier) -{ - srsran_assert(cell_id < fapi_adaptors.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - fapi_adaptors.size()); - - fapi_adaptors[cell_id]->set_slot_error_message_notifier(fapi_error_notifier); -} - -void o_du_low_impl::set_slot_data_message_notifier(unsigned cell_id, - fapi::slot_data_message_notifier& fapi_data_notifier) -{ - srsran_assert(cell_id < fapi_adaptors.size(), - "Invalid cell index '{}'. Valid cell indexes [0-{})", - cell_id, - fapi_adaptors.size()); - - fapi_adaptors[cell_id]->set_slot_data_message_notifier(fapi_data_notifier); + return *fapi_adaptor; } diff --git a/lib/du/du_low/o_du_low_impl.h b/lib/du/du_low/o_du_low_impl.h index 4adcf94f15..4beb57905d 100644 --- a/lib/du/du_low/o_du_low_impl.h +++ b/lib/du/du_low/o_du_low_impl.h @@ -14,7 +14,6 @@ #include "srsran/du/du_low/o_du_low.h" #include "srsran/fapi_adaptor/phy/phy_fapi_adaptor.h" #include -#include namespace srsran { namespace srs_du { @@ -22,31 +21,19 @@ namespace srs_du { class o_du_low_impl final : public o_du_low { public: - o_du_low_impl(std::unique_ptr du_lo_, - std::vector> fapi_adaptors_); + o_du_low_impl(std::unique_ptr du_lo_, + std::unique_ptr fapi_adaptor_, + unsigned nof_cells); // See interface for documentation. du_low& get_du_low() override; // See interface for documentation. - fapi::slot_message_gateway& get_slot_message_gateway(unsigned cell_id) override; - - // See interface for documentation. - fapi::slot_last_message_notifier& get_slot_last_message_notifier(unsigned cell_id) override; - - // See interface for documentation. - void set_slot_time_message_notifier(unsigned cell_id, fapi::slot_time_message_notifier& fapi_time_notifier) override; - - // See interface for documentation. - void set_slot_error_message_notifier(unsigned cell_id, - fapi::slot_error_message_notifier& fapi_error_notifier) override; - - // See interface for documentation. - void set_slot_data_message_notifier(unsigned cell_id, fapi::slot_data_message_notifier& fapi_data_notifier) override; + fapi_adaptor::phy_fapi_adaptor& get_phy_fapi_adaptor() override; private: - std::unique_ptr du_lo; - std::vector> fapi_adaptors; + std::unique_ptr du_lo; + std::unique_ptr fapi_adaptor; }; } // namespace srs_du diff --git a/lib/du/o_du_factory.cpp b/lib/du/o_du_factory.cpp index 7f4588ab6b..d708735035 100644 --- a/lib/du/o_du_factory.cpp +++ b/lib/du/o_du_factory.cpp @@ -16,31 +16,6 @@ using namespace srsran; using namespace srs_du; -std::unique_ptr srsran::srs_du::make_o_du(const o_du_config& du_cfg, o_du_dependencies&& dependencies) -{ - o_du_impl_dependencies o_du_deps; - - // Create DU low. - o_du_deps.du_lo = make_o_du_low(du_cfg.du_low_cfg, du_cfg.du_high_cfg.du_hi.ran.cells); - - // Fill O-DU high dependencies. - srsran_assert(du_cfg.du_low_cfg.du_low_cfg.cells.size() == dependencies.du_high_deps.sectors.size(), - "DU low number of cells '{}' does not match the number of cells of the DU high dependencies '{}'", - du_cfg.du_low_cfg.du_low_cfg.cells.size(), - dependencies.du_high_deps.sectors.size()); - for (unsigned i = 0, e = du_cfg.du_low_cfg.du_low_cfg.cells.size(); i != e; ++i) { - o_du_high_sector_dependencies& deps = dependencies.du_high_deps.sectors[i]; - deps.gateway = &o_du_deps.du_lo->get_slot_message_gateway(i); - deps.last_msg_notifier = &o_du_deps.du_lo->get_slot_last_message_notifier(i); - } - - o_du_deps.du_hi = make_o_du_high(du_cfg.du_high_cfg, std::move(dependencies.du_high_deps)); - - srslog::fetch_basic_logger("DU").info("O-DU created successfully"); - - return std::make_unique(std::move(o_du_deps)); -} - std::unique_ptr srs_du::make_o_du(std::unique_ptr odu_hi, std::unique_ptr odu_lo) { srsran_assert(odu_hi, "Invalid O-DU high"); diff --git a/lib/du/o_du_impl.cpp b/lib/du/o_du_impl.cpp index ed17399faf..da634b5b88 100644 --- a/lib/du/o_du_impl.cpp +++ b/lib/du/o_du_impl.cpp @@ -11,6 +11,9 @@ #include "o_du_impl.h" #include "srsran/du/du_high/o_du_high.h" #include "srsran/du/du_low/du_low.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h" +#include "srsran/fapi_adaptor/phy/phy_fapi_adaptor.h" +#include "srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h" #include "srsran/support/srsran_assert.h" using namespace srsran; @@ -21,13 +24,6 @@ o_du_impl::o_du_impl(o_du_impl_dependencies&& dependencies) : { srsran_assert(du_lo, "Invalid DU low"); srsran_assert(du_hi, "Invalid DU high"); - - // Connect O-DU low with O-DU high. - for (unsigned i = 0, e = du_lo->get_du_low().get_all_upper_phys().size(); i != e; ++i) { - du_lo->set_slot_time_message_notifier(i, du_hi->get_slot_time_message_notifier(i)); - du_lo->set_slot_error_message_notifier(i, du_hi->get_slot_error_message_notifier(i)); - du_lo->set_slot_data_message_notifier(i, du_hi->get_slot_data_message_notifier(i)); - } } void o_du_impl::start() diff --git a/lib/fapi_adaptor/mac/CMakeLists.txt b/lib/fapi_adaptor/mac/CMakeLists.txt index 839bf5a3f7..852c5eac28 100644 --- a/lib/fapi_adaptor/mac/CMakeLists.txt +++ b/lib/fapi_adaptor/mac/CMakeLists.txt @@ -20,5 +20,5 @@ set(SOURCES add_library(srsran_fapi_to_mac_translator STATIC ${SOURCES}) target_link_libraries(srsran_fapi_to_mac_translator srsvec srsran_support) -add_library(srsran_mac_fapi_adaptor STATIC mac_fapi_adaptor_impl.cpp mac_fapi_adaptor_factory_impl.cpp) +add_library(srsran_mac_fapi_adaptor STATIC mac_fapi_sector_adaptor_impl.cpp mac_fapi_adaptor_impl.cpp mac_fapi_adaptor_factory_impl.cpp) target_link_libraries(srsran_mac_fapi_adaptor srsran_mac_to_fapi_translator srsran_fapi_to_mac_translator) diff --git a/lib/fapi_adaptor/mac/mac_fapi_adaptor_factory_impl.cpp b/lib/fapi_adaptor/mac/mac_fapi_adaptor_factory_impl.cpp index ac1d082830..24e308b109 100644 --- a/lib/fapi_adaptor/mac/mac_fapi_adaptor_factory_impl.cpp +++ b/lib/fapi_adaptor/mac/mac_fapi_adaptor_factory_impl.cpp @@ -10,17 +10,118 @@ #include "mac_fapi_adaptor_factory_impl.h" #include "mac_fapi_adaptor_impl.h" +#include "mac_fapi_sector_adaptor_impl.h" +#include "srsran/fapi/decorator.h" +#include "srsran/fapi/decorator_factory.h" +#include "srsran/srslog/srslog.h" using namespace srsran; using namespace fapi_adaptor; +namespace { + +/// MAC-FAPI adaptor wrapper that wraps an adaptor and a FAPI decorator. +class mac_fapi_adaptor_wrapper : public mac_fapi_sector_adaptor +{ +public: + mac_fapi_adaptor_wrapper(std::unique_ptr adaptor_, + std::unique_ptr decorator_) : + decorator(std::move(decorator_)), adaptor(std::move(adaptor_)) + { + srsran_assert(adaptor, "Invalid MAC-FAPI sector adaptor"); + + if (decorator) { + decorator->set_slot_data_message_notifier(adaptor->get_slot_data_message_notifier()); + decorator->set_slot_error_message_notifier(adaptor->get_slot_error_message_notifier()); + decorator->set_slot_time_message_notifier(adaptor->get_slot_time_message_notifier()); + } + } + + // See interface for documentation. + fapi::slot_time_message_notifier& get_slot_time_message_notifier() override + { + return decorator ? decorator->get_slot_time_message_notifier() : adaptor->get_slot_time_message_notifier(); + } + + // See interface for documentation. + fapi::slot_error_message_notifier& get_slot_error_message_notifier() override + { + return decorator ? decorator->get_slot_error_message_notifier() : adaptor->get_slot_error_message_notifier(); + } + + // See interface for documentation. + fapi::slot_data_message_notifier& get_slot_data_message_notifier() override + { + return decorator ? decorator->get_slot_data_message_notifier() : adaptor->get_slot_data_message_notifier(); + } + + // See interface for documentation. + mac_cell_result_notifier& get_cell_result_notifier() override { return adaptor->get_cell_result_notifier(); } + + // See interface for documentation. + void set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) override + { + adaptor->set_cell_slot_handler(mac_slot_handler); + } + + // See interface for documentation. + void set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) override + { + adaptor->set_cell_rach_handler(mac_rach_handler); + } + + // See interface for documentation. + void set_cell_pdu_handler(mac_pdu_handler& handler) override { adaptor->set_cell_pdu_handler(handler); } + + // See interface for documentation. + void set_cell_crc_handler(mac_cell_control_information_handler& handler) override + { + adaptor->set_cell_crc_handler(handler); + } + +private: + std::unique_ptr decorator; + std::unique_ptr adaptor; +}; + +} // namespace + std::unique_ptr mac_fapi_adaptor_factory_impl::create(const mac_fapi_adaptor_config& config, mac_fapi_adaptor_dependencies&& dependencies) { - srsran_assert(dependencies.gateway, "Invalid FAPI slot message gateway"); - srsran_assert(dependencies.last_msg_notifier, "Invalid FAPI last message notifier"); + std::vector> sectors; + for (unsigned i = 0, e = config.sectors.size(); i != e; ++i) { + const auto& sector_cfg = config.sectors[i]; + auto& sector_dependencies = dependencies.sectors[i]; + + srsran_assert(sector_dependencies.gateway, "Invalid FAPI slot message gateway"); + srsran_assert(sector_dependencies.last_msg_notifier, "Invalid FAPI last message notifier"); + + // Create FAPI decorators configuration. + fapi::decorator_config decorator_cfg; + if (sector_cfg.log_level == srslog::basic_levels::debug) { + decorator_cfg.logging_cfg.emplace(fapi::logging_decorator_config{srslog::fetch_basic_logger("FAPI", true), + *sector_dependencies.gateway, + *sector_dependencies.last_msg_notifier}); + } + if (sector_cfg.l2_nof_slots_ahead != 0) { + srsran_assert(sector_dependencies.bufferer_task_executor, + "Invalid executor for the FAPI message bufferer decorator"); + decorator_cfg.bufferer_cfg.emplace( + fapi::message_bufferer_decorator_config{sector_cfg.l2_nof_slots_ahead, + sector_cfg.scs, + *sector_dependencies.bufferer_task_executor.value(), + *sector_dependencies.gateway, + *sector_dependencies.last_msg_notifier}); + } + auto decorators = fapi::create_decorators(decorator_cfg); + + auto sector_adaptor = std::make_unique(sector_cfg, std::move(sector_dependencies)); + + sectors.push_back(std::make_unique(std::move(sector_adaptor), std::move(decorators))); + } - return std::make_unique(config, std::move(dependencies)); + return std::make_unique(std::move(sectors)); } std::unique_ptr srsran::fapi_adaptor::create_mac_fapi_adaptor_factory() diff --git a/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.cpp b/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.cpp index a8d493636c..a4c531f03b 100644 --- a/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.cpp +++ b/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.cpp @@ -9,62 +9,23 @@ */ #include "mac_fapi_adaptor_impl.h" -#include "srsran/srslog/srslog.h" +#include "srsran/support/srsran_assert.h" using namespace srsran; using namespace fapi_adaptor; -mac_fapi_adaptor_impl::mac_fapi_adaptor_impl(const mac_fapi_adaptor_config& config, - mac_fapi_adaptor_dependencies&& dependencies) : - mac_translator(srslog::fetch_basic_logger("FAPI"), - *dependencies.gateway, - *dependencies.last_msg_notifier, - std::move(dependencies.pm_mapper), - std::move(dependencies.part2_mapper), - config.cell_nof_prbs), - fapi_data_translator(config.scs, config.sector_id), - fapi_time_translator(config.scs), - fapi_error_translator(config.scs) +mac_fapi_adaptor_impl::mac_fapi_adaptor_impl(std::vector> sector_adaptors_) : + sector_adaptors(std::move(sector_adaptors_)) { + srsran_assert(!sector_adaptors.empty(), "Cannot create a MAC FAPI adaptor with zero cells"); } -fapi::slot_time_message_notifier& mac_fapi_adaptor_impl::get_slot_time_message_notifier() +mac_fapi_sector_adaptor& mac_fapi_adaptor_impl::get_sector_adaptor(unsigned cell_id) { - return fapi_time_translator; -} - -fapi::slot_error_message_notifier& mac_fapi_adaptor_impl::get_slot_error_message_notifier() -{ - return fapi_error_translator; -} - -fapi::slot_data_message_notifier& mac_fapi_adaptor_impl::get_slot_data_message_notifier() -{ - return fapi_data_translator; -} - -mac_cell_result_notifier& mac_fapi_adaptor_impl::get_cell_result_notifier() -{ - return mac_translator; -} + srsran_assert(cell_id < sector_adaptors.size(), + "Invalid cell identifier '{}'. Valid cell id range '[0-{})'", + cell_id, + sector_adaptors.size()); -void mac_fapi_adaptor_impl::set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) -{ - fapi_time_translator.set_cell_slot_handler(mac_slot_handler); - fapi_error_translator.set_cell_slot_handler(mac_slot_handler); -} - -void mac_fapi_adaptor_impl::set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) -{ - fapi_data_translator.set_cell_rach_handler(mac_rach_handler); -} - -void mac_fapi_adaptor_impl::set_cell_pdu_handler(mac_pdu_handler& handler) -{ - fapi_data_translator.set_cell_pdu_handler(handler); -} - -void mac_fapi_adaptor_impl::set_cell_crc_handler(mac_cell_control_information_handler& handler) -{ - fapi_data_translator.set_cell_crc_handler(handler); + return *sector_adaptors[cell_id]; } diff --git a/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.h b/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.h index 6d130fd04e..272c59e2f1 100644 --- a/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.h +++ b/lib/fapi_adaptor/mac/mac_fapi_adaptor_impl.h @@ -10,56 +10,25 @@ #pragma once -#include "fapi_to_mac_data_msg_translator.h" -#include "fapi_to_mac_error_msg_translator.h" -#include "fapi_to_mac_time_msg_translator.h" -#include "mac_to_fapi_translator.h" #include "srsran/fapi_adaptor/mac/mac_fapi_adaptor.h" -#include "srsran/fapi_adaptor/mac/mac_fapi_adaptor_config.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h" +#include +#include namespace srsran { namespace fapi_adaptor { -/// \brief MAC–FAPI bidirectional adaptor implementation. +/// MAC/FAPI adaptor implementation. class mac_fapi_adaptor_impl : public mac_fapi_adaptor { public: - /// Constructor for the MAC–FAPI bidirectional adaptor. - mac_fapi_adaptor_impl(const mac_fapi_adaptor_config& config, mac_fapi_adaptor_dependencies&& dependencies); + explicit mac_fapi_adaptor_impl(std::vector> sector_adaptors_); // See interface for documentation. - fapi::slot_time_message_notifier& get_slot_time_message_notifier() override; - - // See interface for documentation. - fapi::slot_error_message_notifier& get_slot_error_message_notifier() override; - - // See interface for documentation. - fapi::slot_data_message_notifier& get_slot_data_message_notifier() override; - - // See interface for documentation. - mac_cell_result_notifier& get_cell_result_notifier() override; - - // See interface for documentation. - void set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) override; - - // See interface for documentation. - void set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) override; - - // See interface for documentation. - void set_cell_pdu_handler(mac_pdu_handler& handler) override; - - // See interface for documentation. - void set_cell_crc_handler(mac_cell_control_information_handler& handler) override; + mac_fapi_sector_adaptor& get_sector_adaptor(unsigned cell_id) override; private: - /// MAC-to-FAPI data translator. - mac_to_fapi_translator mac_translator; - /// FAPI-to-MAC data-specific message translator. - fapi_to_mac_data_msg_translator fapi_data_translator; - /// FAPI-to-MAC time-specific message translator. - fapi_to_mac_time_msg_translator fapi_time_translator; - /// FAPI-to-MAC error-specific message translator. - fapi_to_mac_error_msg_translator fapi_error_translator; + std::vector> sector_adaptors; }; } // namespace fapi_adaptor diff --git a/lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.cpp b/lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.cpp new file mode 100644 index 0000000000..63c03fc9f5 --- /dev/null +++ b/lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.cpp @@ -0,0 +1,70 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#include "mac_fapi_sector_adaptor_impl.h" +#include "srsran/srslog/srslog.h" + +using namespace srsran; +using namespace fapi_adaptor; + +mac_fapi_sector_adaptor_impl::mac_fapi_sector_adaptor_impl(const mac_fapi_sector_adaptor_config& config, + mac_fapi_sector_adaptor_dependencies&& dependencies) : + mac_translator(srslog::fetch_basic_logger("FAPI"), + *dependencies.gateway, + *dependencies.last_msg_notifier, + std::move(dependencies.pm_mapper), + std::move(dependencies.part2_mapper), + config.cell_nof_prbs), + fapi_data_translator(config.scs, config.sector_id), + fapi_time_translator(config.scs), + fapi_error_translator(config.scs) +{ +} + +fapi::slot_time_message_notifier& mac_fapi_sector_adaptor_impl::get_slot_time_message_notifier() +{ + return fapi_time_translator; +} + +fapi::slot_error_message_notifier& mac_fapi_sector_adaptor_impl::get_slot_error_message_notifier() +{ + return fapi_error_translator; +} + +fapi::slot_data_message_notifier& mac_fapi_sector_adaptor_impl::get_slot_data_message_notifier() +{ + return fapi_data_translator; +} + +mac_cell_result_notifier& mac_fapi_sector_adaptor_impl::get_cell_result_notifier() +{ + return mac_translator; +} + +void mac_fapi_sector_adaptor_impl::set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) +{ + fapi_time_translator.set_cell_slot_handler(mac_slot_handler); + fapi_error_translator.set_cell_slot_handler(mac_slot_handler); +} + +void mac_fapi_sector_adaptor_impl::set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) +{ + fapi_data_translator.set_cell_rach_handler(mac_rach_handler); +} + +void mac_fapi_sector_adaptor_impl::set_cell_pdu_handler(mac_pdu_handler& handler) +{ + fapi_data_translator.set_cell_pdu_handler(handler); +} + +void mac_fapi_sector_adaptor_impl::set_cell_crc_handler(mac_cell_control_information_handler& handler) +{ + fapi_data_translator.set_cell_crc_handler(handler); +} diff --git a/lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.h b/lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.h new file mode 100644 index 0000000000..4459ebb172 --- /dev/null +++ b/lib/fapi_adaptor/mac/mac_fapi_sector_adaptor_impl.h @@ -0,0 +1,67 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +#include "fapi_to_mac_data_msg_translator.h" +#include "fapi_to_mac_error_msg_translator.h" +#include "fapi_to_mac_time_msg_translator.h" +#include "mac_to_fapi_translator.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_adaptor_config.h" +#include "srsran/fapi_adaptor/mac/mac_fapi_sector_adaptor.h" + +namespace srsran { +namespace fapi_adaptor { + +/// \brief MAC–FAPI bidirectional sector adaptor implementation. +class mac_fapi_sector_adaptor_impl : public mac_fapi_sector_adaptor +{ +public: + /// Constructor for the MAC–FAPI bidirectional sector adaptor. + mac_fapi_sector_adaptor_impl(const mac_fapi_sector_adaptor_config& config, + mac_fapi_sector_adaptor_dependencies&& dependencies); + + // See interface for documentation. + fapi::slot_time_message_notifier& get_slot_time_message_notifier() override; + + // See interface for documentation. + fapi::slot_error_message_notifier& get_slot_error_message_notifier() override; + + // See interface for documentation. + fapi::slot_data_message_notifier& get_slot_data_message_notifier() override; + + // See interface for documentation. + mac_cell_result_notifier& get_cell_result_notifier() override; + + // See interface for documentation. + void set_cell_slot_handler(mac_cell_slot_handler& mac_slot_handler) override; + + // See interface for documentation. + void set_cell_rach_handler(mac_cell_rach_handler& mac_rach_handler) override; + + // See interface for documentation. + void set_cell_pdu_handler(mac_pdu_handler& handler) override; + + // See interface for documentation. + void set_cell_crc_handler(mac_cell_control_information_handler& handler) override; + +private: + /// MAC-to-FAPI data translator. + mac_to_fapi_translator mac_translator; + /// FAPI-to-MAC data-specific message translator. + fapi_to_mac_data_msg_translator fapi_data_translator; + /// FAPI-to-MAC time-specific message translator. + fapi_to_mac_time_msg_translator fapi_time_translator; + /// FAPI-to-MAC error-specific message translator. + fapi_to_mac_error_msg_translator fapi_error_translator; +}; + +} // namespace fapi_adaptor +} // namespace srsran diff --git a/lib/fapi_adaptor/phy/CMakeLists.txt b/lib/fapi_adaptor/phy/CMakeLists.txt index 5f959d9c2f..55c9265803 100644 --- a/lib/fapi_adaptor/phy/CMakeLists.txt +++ b/lib/fapi_adaptor/phy/CMakeLists.txt @@ -22,5 +22,5 @@ set(SOURCES add_library(srsran_phy_to_fapi_translator STATIC ${SOURCES}) target_link_libraries(srsran_phy_to_fapi_translator srslog) -add_library(srsran_phy_fapi_adaptor STATIC phy_fapi_adaptor_impl.cpp phy_fapi_adaptor_factory_impl.cpp) +add_library(srsran_phy_fapi_adaptor STATIC phy_fapi_sector_adaptor_impl.cpp phy_fapi_adaptor_impl.cpp phy_fapi_adaptor_factory_impl.cpp) target_link_libraries(srsran_phy_fapi_adaptor srsran_fapi_to_phy_translator srsran_phy_to_fapi_translator) diff --git a/lib/fapi_adaptor/phy/fapi_to_phy_translator.cpp b/lib/fapi_adaptor/phy/fapi_to_phy_translator.cpp index 6483181d52..cb79232ebb 100644 --- a/lib/fapi_adaptor/phy/fapi_to_phy_translator.cpp +++ b/lib/fapi_adaptor/phy/fapi_to_phy_translator.cpp @@ -95,8 +95,8 @@ fapi_to_phy_translator::fapi_to_phy_translator(const fapi_to_phy_translator_conf error_notifier(dummy_error_notifier), scs(config.scs), scs_common(config.scs_common), - prach_cfg(*config.prach_cfg), - carrier_cfg(*config.carrier_cfg), + prach_cfg(config.prach_cfg), + carrier_cfg(config.carrier_cfg), prach_ports(config.prach_ports.begin(), config.prach_ports.end()) { srsran_assert(pm_repo, "Invalid precoding matrix repository"); diff --git a/lib/fapi_adaptor/phy/fapi_to_phy_translator.h b/lib/fapi_adaptor/phy/fapi_to_phy_translator.h index 72c85433c4..5b1ff88072 100644 --- a/lib/fapi_adaptor/phy/fapi_to_phy_translator.h +++ b/lib/fapi_adaptor/phy/fapi_to_phy_translator.h @@ -43,9 +43,9 @@ struct fapi_to_phy_translator_config { /// Common subcarrier spacing as per TS38.331 Section 6.2.2. subcarrier_spacing scs_common; /// FAPI PRACH configuration TLV as per SCF-222 v4.0 section 3.3.2.4. - const fapi::prach_config* prach_cfg; + fapi::prach_config prach_cfg; /// FAPI carrier configuration TLV as per SCF-222 v4.0 section 3.3.2.4. - const fapi::carrier_config* carrier_cfg; + fapi::carrier_config carrier_cfg; /// PRACH port list. std::vector prach_ports; }; diff --git a/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.cpp b/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.cpp index 04a1c2529e..4803169ba6 100644 --- a/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.cpp +++ b/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.cpp @@ -10,36 +10,97 @@ #include "phy_fapi_adaptor_factory_impl.h" #include "phy_fapi_adaptor_impl.h" +#include "phy_fapi_sector_adaptor_impl.h" +#include "srsran/du/du_cell_config.h" using namespace srsran; using namespace fapi_adaptor; -std::unique_ptr -phy_fapi_adaptor_factory_impl::create(const phy_fapi_adaptor_factory_config& config, - phy_fapi_adaptor_factory_dependencies&& dependencies) +static fapi::prach_config generate_prach_config_tlv(const srs_du::du_cell_config& cell_cfg) { - phy_fapi_adaptor_impl_config adaptor_config; - adaptor_config.sector_id = config.sector_id; - adaptor_config.nof_slots_request_headroom = config.nof_slots_request_headroom; - adaptor_config.scs = config.scs; - adaptor_config.scs_common = config.scs_common; - adaptor_config.prach_cfg = config.prach_cfg; - adaptor_config.carrier_cfg = config.carrier_cfg; - adaptor_config.prach_ports = config.prach_ports; - - phy_fapi_adaptor_impl_dependencies adaptor_dependencies; - adaptor_dependencies.logger = dependencies.logger; - adaptor_dependencies.dl_processor_pool = dependencies.dl_processor_pool; - adaptor_dependencies.dl_rg_pool = dependencies.dl_rg_pool; - adaptor_dependencies.dl_pdu_validator = dependencies.dl_pdu_validator; - adaptor_dependencies.ul_request_processor = dependencies.ul_request_processor; - adaptor_dependencies.ul_rg_pool = dependencies.ul_rg_pool; - adaptor_dependencies.ul_pdu_repository = dependencies.ul_pdu_repository; - adaptor_dependencies.ul_pdu_validator = dependencies.ul_pdu_validator; - adaptor_dependencies.pm_repo = std::move(dependencies.pm_repo); - adaptor_dependencies.part2_repo = std::move(dependencies.part2_repo); - - return std::make_unique(adaptor_config, std::move(adaptor_dependencies)); + fapi::prach_config config = {}; + config.prach_res_config_index = 0; + config.prach_sequence_length = fapi::prach_sequence_length_type::long_sequence; + config.prach_scs = prach_subcarrier_spacing::kHz1_25; + config.prach_ul_bwp_pusch_scs = cell_cfg.scs_common; + config.restricted_set = restricted_set_config::UNRESTRICTED; + config.num_prach_fd_occasions = cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.msg1_fdm; + config.prach_config_index = + cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.prach_config_index; + config.prach_format = prach_format_type::zero; + config.num_prach_td_occasions = 1; + config.num_preambles = 1; + config.start_preamble_index = 0; + + // Add FD occasion info. + fapi::prach_fd_occasion_config& fd_occasion = config.fd_occasions.emplace_back(); + fd_occasion.prach_root_sequence_index = + cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().prach_root_seq_index; + fd_occasion.prach_freq_offset = + cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.msg1_frequency_start; + fd_occasion.prach_zero_corr_conf = + cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common.value().rach_cfg_generic.zero_correlation_zone_config; + + return config; +} + +static fapi::carrier_config generate_carrier_config_tlv(const srs_du::du_cell_config& du_cell) +{ + // Deduce common numerology and grid size for DL and UL. + unsigned numerology = to_numerology_value(du_cell.scs_common); + unsigned grid_size_bw_prb = + band_helper::get_n_rbs_from_bw(MHz_to_bs_channel_bandwidth(du_cell.dl_carrier.carrier_bw_mhz), + du_cell.scs_common, + band_helper::get_freq_range(du_cell.dl_carrier.band)); + + fapi::carrier_config fapi_config = {}; + + // NOTE; for now we only need to fill the nof_prb_ul_grid and nof_prb_dl_grid for the common SCS. + fapi_config.dl_grid_size = {}; + fapi_config.dl_grid_size[numerology] = grid_size_bw_prb; + fapi_config.ul_grid_size = {}; + fapi_config.ul_grid_size[numerology] = grid_size_bw_prb; + + // Number of transmit and receive antenna ports. + fapi_config.num_tx_ant = du_cell.dl_carrier.nof_ant; + fapi_config.num_rx_ant = du_cell.ul_carrier.nof_ant; + + return fapi_config; +} + +std::unique_ptr phy_fapi_adaptor_factory_impl::create(const phy_fapi_adaptor_config& config, + phy_fapi_adaptor_dependencies&& dependencies) +{ + std::vector> sectors; + for (unsigned i = 0, e = config.sectors.size(); i != e; ++i) { + const auto& sector_cfg = config.sectors[i]; + auto& sector_dependencies = dependencies.sectors[i]; + + phy_fapi_sector_adaptor_impl_config adaptor_config; + adaptor_config.sector_id = sector_cfg.sector_id; + adaptor_config.nof_slots_request_headroom = sector_cfg.nof_slots_request_headroom; + adaptor_config.scs = sector_cfg.du_cell.scs_common; + adaptor_config.scs_common = sector_cfg.du_cell.scs_common; + adaptor_config.prach_cfg = generate_prach_config_tlv(sector_cfg.du_cell); + adaptor_config.carrier_cfg = generate_carrier_config_tlv(sector_cfg.du_cell); + adaptor_config.prach_ports = sector_cfg.prach_ports; + + phy_fapi_sector_adaptor_impl_dependencies adaptor_dependencies; + adaptor_dependencies.logger = sector_dependencies.logger; + adaptor_dependencies.dl_processor_pool = sector_dependencies.dl_processor_pool; + adaptor_dependencies.dl_rg_pool = sector_dependencies.dl_rg_pool; + adaptor_dependencies.dl_pdu_validator = sector_dependencies.dl_pdu_validator; + adaptor_dependencies.ul_request_processor = sector_dependencies.ul_request_processor; + adaptor_dependencies.ul_rg_pool = sector_dependencies.ul_rg_pool; + adaptor_dependencies.ul_pdu_repository = sector_dependencies.ul_pdu_repository; + adaptor_dependencies.ul_pdu_validator = sector_dependencies.ul_pdu_validator; + adaptor_dependencies.pm_repo = std::move(sector_dependencies.pm_repo); + adaptor_dependencies.part2_repo = std::move(sector_dependencies.part2_repo); + + sectors.push_back(std::make_unique(adaptor_config, std::move(adaptor_dependencies))); + } + + return std::make_unique(std::move(sectors)); } std::unique_ptr srsran::fapi_adaptor::create_phy_fapi_adaptor_factory() diff --git a/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.h b/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.h index 4b80ede5dd..2ae859381a 100644 --- a/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.h +++ b/lib/fapi_adaptor/phy/phy_fapi_adaptor_factory_impl.h @@ -10,7 +10,9 @@ #pragma once +#include "srsran/fapi_adaptor/phy/phy_fapi_adaptor.h" #include "srsran/fapi_adaptor/phy/phy_fapi_adaptor_factory.h" +#include namespace srsran { @@ -21,8 +23,8 @@ class phy_fapi_adaptor_factory_impl : public phy_fapi_adaptor_factory { public: // See interface for documentation. - std::unique_ptr create(const phy_fapi_adaptor_factory_config& config, - phy_fapi_adaptor_factory_dependencies&& dependencies) override; + std::unique_ptr create(const phy_fapi_adaptor_config& config, + phy_fapi_adaptor_dependencies&& dependencies) override; }; } // namespace fapi_adaptor diff --git a/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.cpp b/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.cpp index 49ee45369a..7bdf24c8da 100644 --- a/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.cpp +++ b/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.cpp @@ -9,106 +9,23 @@ */ #include "phy_fapi_adaptor_impl.h" -#include "srsran/fapi/slot_last_message_notifier.h" +#include "srsran/support/srsran_assert.h" using namespace srsran; using namespace fapi_adaptor; -namespace { - -/// Slot last message notifier dummy implementation. -class slot_last_message_notifier_dummy : public fapi::slot_last_message_notifier -{ -public: - void on_last_message(slot_point slot) override {} -}; - -} // namespace - -static slot_last_message_notifier_dummy dummy_notifier; - -/// Generates and returns a FAPI-to-PHY translator configuration from the given PHY adaptor configuration. -static fapi_to_phy_translator_config generate_fapi_to_phy_translator_config(const phy_fapi_adaptor_impl_config& config) -{ - fapi_to_phy_translator_config fapi_config; - - fapi_config.sector_id = config.sector_id; - fapi_config.nof_slots_request_headroom = config.nof_slots_request_headroom; - fapi_config.scs = config.scs; - fapi_config.scs_common = config.scs_common; - fapi_config.prach_cfg = config.prach_cfg; - fapi_config.carrier_cfg = config.carrier_cfg; - fapi_config.prach_ports = config.prach_ports; - - return fapi_config; -} - -/// Generates and returns a FAPI-to-PHY translator dependencies from the given PHY adaptor dependencies. -static fapi_to_phy_translator_dependencies -generate_fapi_to_phy_translator_dependencies(phy_fapi_adaptor_impl_dependencies&& dependencies) +phy_fapi_adaptor_impl::phy_fapi_adaptor_impl(std::vector> sector_adaptors_) : + sector_adaptors(std::move(sector_adaptors_)) { - fapi_to_phy_translator_dependencies fapi_dependencies; - - fapi_dependencies.logger = dependencies.logger; - fapi_dependencies.dl_processor_pool = dependencies.dl_processor_pool; - fapi_dependencies.dl_rg_pool = dependencies.dl_rg_pool; - fapi_dependencies.dl_pdu_validator = dependencies.dl_pdu_validator; - fapi_dependencies.ul_request_processor = dependencies.ul_request_processor; - fapi_dependencies.ul_rg_pool = dependencies.ul_rg_pool; - fapi_dependencies.ul_pdu_repository = dependencies.ul_pdu_repository; - fapi_dependencies.ul_pdu_validator = dependencies.ul_pdu_validator; - fapi_dependencies.pm_repo = std::move(dependencies.pm_repo); - fapi_dependencies.part2_repo = std::move(dependencies.part2_repo); - - return fapi_dependencies; + srsran_assert(!sector_adaptors.empty(), "Cannot create a PHY-FAPI adaptor with zero cells"); } -phy_fapi_adaptor_impl::phy_fapi_adaptor_impl(const phy_fapi_adaptor_impl_config& config, - phy_fapi_adaptor_impl_dependencies&& dependencies) : - results_translator(*dependencies.logger), - fapi_translator(generate_fapi_to_phy_translator_config(config), - generate_fapi_to_phy_translator_dependencies(std::move(dependencies))), - time_translator(fapi_translator) +phy_fapi_sector_adaptor& phy_fapi_adaptor_impl::get_sector_adaptor(unsigned cell_id) { -} + srsran_assert(cell_id < sector_adaptors.size(), + "Invalid cell identifier '{}'. Valid cell id range '[0-{})'", + cell_id, + sector_adaptors.size()); -upper_phy_timing_notifier& phy_fapi_adaptor_impl::get_timing_notifier() -{ - return time_translator; -} - -void phy_fapi_adaptor_impl::set_slot_time_message_notifier(fapi::slot_time_message_notifier& fapi_time_slot_notifier) -{ - time_translator.set_slot_time_message_notifier(fapi_time_slot_notifier); -} - -void phy_fapi_adaptor_impl::set_slot_error_message_notifier(fapi::slot_error_message_notifier& fapi_error_notifier) -{ - fapi_translator.set_slot_error_message_notifier(fapi_error_notifier); - error_translator.set_slot_error_message_notifier(fapi_error_notifier); -} - -void phy_fapi_adaptor_impl::set_slot_data_message_notifier(fapi::slot_data_message_notifier& fapi_data_notifier) -{ - results_translator.set_slot_data_message_notifier(fapi_data_notifier); -} - -fapi::slot_last_message_notifier& phy_fapi_adaptor_impl::get_slot_last_message_notifier() -{ - return dummy_notifier; -} - -fapi::slot_message_gateway& phy_fapi_adaptor_impl::get_slot_message_gateway() -{ - return fapi_translator; -} - -upper_phy_rx_results_notifier& phy_fapi_adaptor_impl::get_rx_results_notifier() -{ - return results_translator; -} - -upper_phy_error_notifier& phy_fapi_adaptor_impl::get_error_notifier() -{ - return error_translator; + return *sector_adaptors[cell_id]; } diff --git a/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.h b/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.h index 5813ca613b..0db932bc19 100644 --- a/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.h +++ b/lib/fapi_adaptor/phy/phy_fapi_adaptor_impl.h @@ -10,103 +10,23 @@ #pragma once -#include "fapi_to_phy_translator.h" -#include "phy_to_fapi_error_event_translator.h" -#include "phy_to_fapi_results_event_translator.h" -#include "phy_to_fapi_time_event_translator.h" #include "srsran/fapi_adaptor/phy/phy_fapi_adaptor.h" +#include "srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h" +#include +#include namespace srsran { -class uplink_request_processor; - -namespace fapi { -struct carrier_config; -struct prach_config; -} // namespace fapi - namespace fapi_adaptor { -/// PHY/FAPI adaptor implementation configuration. -struct phy_fapi_adaptor_impl_config { - /// Base station sector identifier. - unsigned sector_id; - /// Request headroom size in slots. - unsigned nof_slots_request_headroom; - /// Subcarrier spacing as per TS38.211 Section 4.2. - subcarrier_spacing scs; - /// Common subcarrier spacing, as per TS38.331 Section 6.2.2. - subcarrier_spacing scs_common; - /// FAPI PRACH configuration TLV as per SCF-222 v4.0 section 3.3.2.4. - const fapi::prach_config* prach_cfg; - /// FAPI carrier configuration TLV as per SCF-222 v4.0 section 3.3.2.4. - const fapi::carrier_config* carrier_cfg; - /// PRACH port list. - std::vector prach_ports; -}; - -/// PHY/FAPI adaptor implementation dependencies. -struct phy_fapi_adaptor_impl_dependencies { - /// Logger. - srslog::basic_logger* logger; - /// Downlink processor pool. - downlink_processor_pool* dl_processor_pool; - /// Downlink resource grid pool. - resource_grid_pool* dl_rg_pool; - /// Downlink PDU validator. - const downlink_pdu_validator* dl_pdu_validator; - /// Uplink request processor. - uplink_request_processor* ul_request_processor; - /// Uplink resource grid pool. - resource_grid_pool* ul_rg_pool; - /// Uplink slot PDU repository. - uplink_slot_pdu_repository* ul_pdu_repository; - /// Uplink PDU validator. - const uplink_pdu_validator* ul_pdu_validator; - /// Precoding matrix repository. - std::unique_ptr pm_repo; - /// UCI Part2 correspondence repository. - std::unique_ptr part2_repo; -}; - -/// \brief PHY–FAPI bidirectional adaptor implementation. class phy_fapi_adaptor_impl : public phy_fapi_adaptor { public: - /// Constructor for the PHY–FAPI bidirectional adaptor. - phy_fapi_adaptor_impl(const phy_fapi_adaptor_impl_config& config, phy_fapi_adaptor_impl_dependencies&& dependencies); - - upper_phy_error_notifier& get_error_notifier() override; - - // See interface for documentation. - upper_phy_timing_notifier& get_timing_notifier() override; - - // See interface for documentation. - fapi::slot_message_gateway& get_slot_message_gateway() override; - - // See interface for documentation. - upper_phy_rx_results_notifier& get_rx_results_notifier() override; - - // See interface for documentation. - void set_slot_time_message_notifier(fapi::slot_time_message_notifier& fapi_time_notifier) override; - - // See interface for documentation. - void set_slot_error_message_notifier(fapi::slot_error_message_notifier& fapi_error_notifier) override; - - // See interface for documentation. - void set_slot_data_message_notifier(fapi::slot_data_message_notifier& fapi_data_notifier) override; + explicit phy_fapi_adaptor_impl(std::vector> sector_adaptors_); - // See interface for documentation. - fapi::slot_last_message_notifier& get_slot_last_message_notifier() override; + phy_fapi_sector_adaptor& get_sector_adaptor(unsigned cell_id) override; private: - /// PHY-to-FAPI uplink results events translator. - phy_to_fapi_results_event_translator results_translator; - /// FAPI-to-PHY message translator. - fapi_to_phy_translator fapi_translator; - /// PHY-to-FAPI time events translator. - phy_to_fapi_time_event_translator time_translator; - /// PHY-to-FAPI error events translator. - phy_to_fapi_error_event_translator error_translator; + std::vector> sector_adaptors; }; } // namespace fapi_adaptor diff --git a/lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.cpp b/lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.cpp new file mode 100644 index 0000000000..df092b545c --- /dev/null +++ b/lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.cpp @@ -0,0 +1,117 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#include "phy_fapi_sector_adaptor_impl.h" +#include "srsran/fapi/slot_last_message_notifier.h" + +using namespace srsran; +using namespace fapi_adaptor; + +namespace { + +/// Slot last message notifier dummy implementation. +class slot_last_message_notifier_dummy : public fapi::slot_last_message_notifier +{ +public: + void on_last_message(slot_point slot) override {} +}; + +} // namespace + +static slot_last_message_notifier_dummy dummy_notifier; + +/// Generates and returns a FAPI-to-PHY translator configuration from the given PHY adaptor configuration. +static fapi_to_phy_translator_config +generate_fapi_to_phy_translator_config(const phy_fapi_sector_adaptor_impl_config& config) +{ + fapi_to_phy_translator_config fapi_config; + + fapi_config.sector_id = config.sector_id; + fapi_config.nof_slots_request_headroom = config.nof_slots_request_headroom; + fapi_config.scs = config.scs; + fapi_config.scs_common = config.scs_common; + fapi_config.prach_cfg = config.prach_cfg; + fapi_config.carrier_cfg = config.carrier_cfg; + fapi_config.prach_ports = config.prach_ports; + + return fapi_config; +} + +/// Generates and returns a FAPI-to-PHY translator dependencies from the given PHY adaptor dependencies. +static fapi_to_phy_translator_dependencies +generate_fapi_to_phy_translator_dependencies(phy_fapi_sector_adaptor_impl_dependencies&& dependencies) +{ + fapi_to_phy_translator_dependencies fapi_dependencies; + + fapi_dependencies.logger = dependencies.logger; + fapi_dependencies.dl_processor_pool = dependencies.dl_processor_pool; + fapi_dependencies.dl_rg_pool = dependencies.dl_rg_pool; + fapi_dependencies.dl_pdu_validator = dependencies.dl_pdu_validator; + fapi_dependencies.ul_request_processor = dependencies.ul_request_processor; + fapi_dependencies.ul_rg_pool = dependencies.ul_rg_pool; + fapi_dependencies.ul_pdu_repository = dependencies.ul_pdu_repository; + fapi_dependencies.ul_pdu_validator = dependencies.ul_pdu_validator; + fapi_dependencies.pm_repo = std::move(dependencies.pm_repo); + fapi_dependencies.part2_repo = std::move(dependencies.part2_repo); + + return fapi_dependencies; +} + +phy_fapi_sector_adaptor_impl::phy_fapi_sector_adaptor_impl(const phy_fapi_sector_adaptor_impl_config& config, + phy_fapi_sector_adaptor_impl_dependencies&& dependencies) : + results_translator(*dependencies.logger), + fapi_translator(generate_fapi_to_phy_translator_config(config), + generate_fapi_to_phy_translator_dependencies(std::move(dependencies))), + time_translator(fapi_translator) +{ +} + +upper_phy_timing_notifier& phy_fapi_sector_adaptor_impl::get_timing_notifier() +{ + return time_translator; +} + +void phy_fapi_sector_adaptor_impl::set_slot_time_message_notifier( + fapi::slot_time_message_notifier& fapi_time_slot_notifier) +{ + time_translator.set_slot_time_message_notifier(fapi_time_slot_notifier); +} + +void phy_fapi_sector_adaptor_impl::set_slot_error_message_notifier( + fapi::slot_error_message_notifier& fapi_error_notifier) +{ + fapi_translator.set_slot_error_message_notifier(fapi_error_notifier); + error_translator.set_slot_error_message_notifier(fapi_error_notifier); +} + +void phy_fapi_sector_adaptor_impl::set_slot_data_message_notifier(fapi::slot_data_message_notifier& fapi_data_notifier) +{ + results_translator.set_slot_data_message_notifier(fapi_data_notifier); +} + +fapi::slot_last_message_notifier& phy_fapi_sector_adaptor_impl::get_slot_last_message_notifier() +{ + return dummy_notifier; +} + +fapi::slot_message_gateway& phy_fapi_sector_adaptor_impl::get_slot_message_gateway() +{ + return fapi_translator; +} + +upper_phy_rx_results_notifier& phy_fapi_sector_adaptor_impl::get_rx_results_notifier() +{ + return results_translator; +} + +upper_phy_error_notifier& phy_fapi_sector_adaptor_impl::get_error_notifier() +{ + return error_translator; +} diff --git a/lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.h b/lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.h new file mode 100644 index 0000000000..100cef1b6f --- /dev/null +++ b/lib/fapi_adaptor/phy/phy_fapi_sector_adaptor_impl.h @@ -0,0 +1,114 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +#include "fapi_to_phy_translator.h" +#include "phy_to_fapi_error_event_translator.h" +#include "phy_to_fapi_results_event_translator.h" +#include "phy_to_fapi_time_event_translator.h" +#include "srsran/fapi_adaptor/phy/phy_fapi_sector_adaptor.h" + +namespace srsran { +class uplink_request_processor; + +namespace fapi { +struct carrier_config; +struct prach_config; +} // namespace fapi + +namespace fapi_adaptor { + +/// PHY/FAPI sector adaptor implementation configuration. +struct phy_fapi_sector_adaptor_impl_config { + /// Base station sector identifier. + unsigned sector_id; + /// Request headroom size in slots. + unsigned nof_slots_request_headroom; + /// Subcarrier spacing as per TS38.211 Section 4.2. + subcarrier_spacing scs; + /// Common subcarrier spacing, as per TS38.331 Section 6.2.2. + subcarrier_spacing scs_common; + /// FAPI PRACH configuration TLV as per SCF-222 v4.0 section 3.3.2.4. + fapi::prach_config prach_cfg; + /// FAPI carrier configuration TLV as per SCF-222 v4.0 section 3.3.2.4. + fapi::carrier_config carrier_cfg; + /// PRACH port list. + std::vector prach_ports; +}; + +/// PHY/FAPI sector adaptor implementation dependencies. +struct phy_fapi_sector_adaptor_impl_dependencies { + /// Logger. + srslog::basic_logger* logger; + /// Downlink processor pool. + downlink_processor_pool* dl_processor_pool; + /// Downlink resource grid pool. + resource_grid_pool* dl_rg_pool; + /// Downlink PDU validator. + const downlink_pdu_validator* dl_pdu_validator; + /// Uplink request processor. + uplink_request_processor* ul_request_processor; + /// Uplink resource grid pool. + resource_grid_pool* ul_rg_pool; + /// Uplink slot PDU repository. + uplink_slot_pdu_repository* ul_pdu_repository; + /// Uplink PDU validator. + const uplink_pdu_validator* ul_pdu_validator; + /// Precoding matrix repository. + std::unique_ptr pm_repo; + /// UCI Part2 correspondence repository. + std::unique_ptr part2_repo; +}; + +/// \brief PHY–FAPI bidirectional adaptor sector implementation. +class phy_fapi_sector_adaptor_impl : public phy_fapi_sector_adaptor +{ +public: + /// Constructor for the PHY–FAPI bidirectional sector adaptor. + phy_fapi_sector_adaptor_impl(const phy_fapi_sector_adaptor_impl_config& config, + phy_fapi_sector_adaptor_impl_dependencies&& dependencies); + + upper_phy_error_notifier& get_error_notifier() override; + + // See interface for documentation. + upper_phy_timing_notifier& get_timing_notifier() override; + + // See interface for documentation. + fapi::slot_message_gateway& get_slot_message_gateway() override; + + // See interface for documentation. + upper_phy_rx_results_notifier& get_rx_results_notifier() override; + + // See interface for documentation. + void set_slot_time_message_notifier(fapi::slot_time_message_notifier& fapi_time_notifier) override; + + // See interface for documentation. + void set_slot_error_message_notifier(fapi::slot_error_message_notifier& fapi_error_notifier) override; + + // See interface for documentation. + void set_slot_data_message_notifier(fapi::slot_data_message_notifier& fapi_data_notifier) override; + + // See interface for documentation. + fapi::slot_last_message_notifier& get_slot_last_message_notifier() override; + +private: + /// PHY-to-FAPI uplink results events translator. + phy_to_fapi_results_event_translator results_translator; + /// FAPI-to-PHY message translator. + fapi_to_phy_translator fapi_translator; + /// PHY-to-FAPI time events translator. + phy_to_fapi_time_event_translator time_translator; + /// PHY-to-FAPI error events translator. + phy_to_fapi_error_event_translator error_translator; +}; + +} // namespace fapi_adaptor +} // namespace srsran diff --git a/tests/unittests/fapi_adaptor/phy/fapi_to_phy_translator_test.cpp b/tests/unittests/fapi_adaptor/phy/fapi_to_phy_translator_test.cpp index e391d881db..23b83557f9 100644 --- a/tests/unittests/fapi_adaptor/phy/fapi_to_phy_translator_test.cpp +++ b/tests/unittests/fapi_adaptor/phy/fapi_to_phy_translator_test.cpp @@ -166,7 +166,7 @@ class fapi_to_phy_translator_fixture : public ::testing::Test uplink_pdu_validator_dummy ul_pdu_validator; slot_error_message_notifier_spy error_notifier_spy; manual_task_worker worker; - fapi_to_phy_translator_config config = {sector_id, headroom_in_slots, scs, scs, &prach_cfg, &carrier_cfg, {0}}; + fapi_to_phy_translator_config config = {sector_id, headroom_in_slots, scs, scs, prach_cfg, carrier_cfg, {0}}; fapi_to_phy_translator_dependencies dependencies = { &srslog::fetch_basic_logger("FAPI"), &dl_processor_pool, From ab1c79fbb40b1b7b74529fcad4f5950dc725896e Mon Sep 17 00:00:00 2001 From: faluco Date: Wed, 18 Dec 2024 17:55:28 +0100 Subject: [PATCH 09/18] [SRSLOG] Implement backend throughput benchmark --- tests/unittests/srslog/CMakeLists.txt | 23 +++++++---- .../srslog/benchmarks/backend_throughput.cpp | 40 +++++++++++++++++++ .../srslog/benchmarks/frontend_latency.cpp | 2 +- 3 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 tests/unittests/srslog/benchmarks/backend_throughput.cpp diff --git a/tests/unittests/srslog/CMakeLists.txt b/tests/unittests/srslog/CMakeLists.txt index 9c2fda6034..a2b8038e32 100644 --- a/tests/unittests/srslog/CMakeLists.txt +++ b/tests/unittests/srslog/CMakeLists.txt @@ -6,61 +6,70 @@ # the distribution. # -include_directories(../../..) +add_executable(srslog_backend_throughput benchmarks/backend_throughput.cpp) +target_include_directories(srslog_backend_throughput PRIVATE ${CMAKE_SOURCE_DIR}) +target_link_libraries(srslog_backend_throughput srslog) add_executable(srslog_frontend_latency benchmarks/frontend_latency.cpp) +target_include_directories(srslog_frontend_latency PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(srslog_frontend_latency srslog) add_executable(srslog_test srslog_test.cpp) +target_include_directories(srslog_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(srslog_test srslog) add_test(srslog_test srslog_test) add_executable(log_channel_test log_channel_test.cpp) +target_include_directories(log_channel_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(log_channel_test srslog) add_test(log_channel_test log_channel_test) add_executable(log_backend_test log_backend_test.cpp) -target_include_directories(log_backend_test PUBLIC ../../) +target_include_directories(log_backend_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(log_backend_test srslog) add_test(log_backend_test log_backend_test) add_executable(logger_test logger_test.cpp) +target_include_directories(logger_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(logger_test srslog) add_test(logger_test logger_test) add_executable(any_test any_test.cpp) +target_include_directories(any_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(any_test srslog) add_test(any_test any_test) add_executable(file_sink_test file_sink_test.cpp) -target_include_directories(file_sink_test PUBLIC ../../) +target_include_directories(file_sink_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(file_sink_test srslog) add_test(file_sink_test file_sink_test) add_executable(syslog_sink_test syslog_sink_test.cpp) -target_include_directories(syslog_sink_test PUBLIC ../../) +target_include_directories(syslog_sink_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(syslog_sink_test srslog) add_executable(file_utils_test file_utils_test.cpp) -target_include_directories(file_utils_test PUBLIC ../../) +target_include_directories(file_utils_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(file_utils_test srslog) add_test(file_utils_test file_utils_test) add_executable(tracer_test event_trace_test.cpp) +target_include_directories(tracer_test PRIVATE ${CMAKE_SOURCE_DIR}) add_definitions(-DENABLE_SRSLOG_EVENT_TRACE) target_link_libraries(tracer_test srslog) add_test(tracer_test tracer_test) add_executable(text_formatter_test text_formatter_test.cpp) -target_include_directories(text_formatter_test PUBLIC ../../) +target_include_directories(text_formatter_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(text_formatter_test srslog) add_test(text_formatter_test text_formatter_test) add_executable(json_formatter_test json_formatter_test.cpp) -target_include_directories(json_formatter_test PUBLIC ../../) +target_include_directories(json_formatter_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(json_formatter_test srslog) add_test(json_formatter_test json_formatter_test) add_executable(context_test context_test.cpp) +target_include_directories(context_test PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(context_test srslog) add_test(context_test context_test) diff --git a/tests/unittests/srslog/benchmarks/backend_throughput.cpp b/tests/unittests/srslog/benchmarks/backend_throughput.cpp new file mode 100644 index 0000000000..f2a1ae9801 --- /dev/null +++ b/tests/unittests/srslog/benchmarks/backend_throughput.cpp @@ -0,0 +1,40 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#include "srsran/srslog/srslog.h" + +using namespace srslog; + +static constexpr unsigned num_iterations = 4000000; + +int main() +{ + auto& s = srslog::fetch_file_sink("srslog_latency_benchmark.txt"); + auto& channel = srslog::fetch_log_channel("bench", s, {}); + + srslog::init(srslog::backend_priority::high); + + auto begin = std::chrono::steady_clock::now(); + for (unsigned i = 0; i != num_iterations; ++i) { + double d = i; + channel("SRSLOG backend benchmark: int: {}, double: {}", i, d); + } + srslog::flush(); + auto end = std::chrono::steady_clock::now(); + + fmt::print("SRSLOG Backend throughput Benchmark:\n" + " benchmark run for {} ms and logged {} times\n" + " {:.1f} million logs/sec", + std::chrono::duration_cast(end - begin).count(), + num_iterations, + num_iterations / std::chrono::duration_cast>(end - begin).count() / 1e6); + + return 0; +} diff --git a/tests/unittests/srslog/benchmarks/frontend_latency.cpp b/tests/unittests/srslog/benchmarks/frontend_latency.cpp index 6d0fcabc2f..d6dee40ff5 100644 --- a/tests/unittests/srslog/benchmarks/frontend_latency.cpp +++ b/tests/unittests/srslog/benchmarks/frontend_latency.cpp @@ -67,7 +67,7 @@ static void run_thread(log_channel& c, std::vector& results, std::atom auto begin = std::chrono::steady_clock::now(); for (unsigned entry_num = 0; entry_num != num_entries_per_iter; ++entry_num) { double d = entry_num; - c("SRSLOG latency benchmark: int: {}, double: {}, string: {}", iter, d, "test"); + c("SRSLOG latency benchmark: int: {}, double: {}", iter, d); } auto end = std::chrono::steady_clock::now(); From 44445dbca17a690b47803bd176767db2f01ca542 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 17 Dec 2024 16:44:34 +0100 Subject: [PATCH 10/18] Remove weak function attribute Rename macro --- include/srsran/support/compiler.h | 3 - .../cell_meas_manager_impl.cpp | 9 +- lib/cu_cp/cu_cp_impl.cpp | 21 ++- .../amf_connection_removal_routine.cpp | 8 +- .../routines/amf_connection_setup_routine.cpp | 8 +- .../inter_cu_handover_target_routine.cpp | 8 +- .../ue_capability_manager.cpp | 8 +- lib/hal/dpdk/bbdev/bbdev_acc_factory.cpp | 8 +- .../hw_accelerator_factories.cpp | 6 +- .../pusch/hw_accelerator_factories.cpp | 6 +- lib/ngap/ngap_impl.cpp | 18 ++- .../ngap_handover_preparation_procedure.cpp | 8 +- ...handover_resource_allocation_procedure.cpp | 21 +-- .../pusch_processor_phy_capabilities.cpp | 8 +- .../channel_equalizer_generic_impl.cpp | 139 +++++++++--------- .../port_channel_estimator_average_impl.cpp | 33 +++-- lib/ran/pusch/pusch_antenna_port_mapping.cpp | 26 ++-- lib/scheduler/support/ul_power_controller.cpp | 24 +-- .../ue_context/ue_channel_state_manager.cpp | 8 +- 19 files changed, 216 insertions(+), 154 deletions(-) diff --git a/include/srsran/support/compiler.h b/include/srsran/support/compiler.h index e9a7ca657e..b566020bac 100644 --- a/include/srsran/support/compiler.h +++ b/include/srsran/support/compiler.h @@ -28,6 +28,3 @@ /// Ensures a function is always inlinable. #define SRSRAN_FORCE_INLINE __attribute__((always_inline)) inline - -/// Marks a symbol as weak. -#define SRSRAN_WEAK_SYMB __attribute__((weak)) diff --git a/lib/cu_cp/cell_meas_manager/cell_meas_manager_impl.cpp b/lib/cu_cp/cell_meas_manager/cell_meas_manager_impl.cpp index 1064a85119..a33f639611 100644 --- a/lib/cu_cp/cell_meas_manager/cell_meas_manager_impl.cpp +++ b/lib/cu_cp/cell_meas_manager/cell_meas_manager_impl.cpp @@ -295,7 +295,8 @@ void cell_meas_manager::update_measurement_object(nr_cell_identity ssb_freq_to_meas_object.emplace(ssb_freq, generate_measurement_object(serving_cell_cfg)); } -SRSRAN_WEAK_SYMB void cell_meas_manager::store_measurement_results(ue_index_t ue_index, - const rrc_meas_results& meas_results) -{ -} +#ifndef SRSRAN_HAS_ENTERPRISE + +void cell_meas_manager::store_measurement_results(ue_index_t ue_index, const rrc_meas_results& meas_results) {} + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/cu_cp/cu_cp_impl.cpp b/lib/cu_cp/cu_cp_impl.cpp index e8a721de1a..2eae9c5566 100644 --- a/lib/cu_cp/cu_cp_impl.cpp +++ b/lib/cu_cp/cu_cp_impl.cpp @@ -155,12 +155,16 @@ bool cu_cp_impl::amfs_are_connected() return true; }; -SRSRAN_WEAK_SYMB std::unique_ptr +#ifndef SRSRAN_HAS_ENTERPRISE + +std::unique_ptr cu_cp_impl::create_nrppa_entity(const cu_cp_configuration& cu_cp_cfg, nrppa_cu_cp_notifier& cu_cp_notif) { return create_nrppa(cu_cp_cfg, cu_cp_notif); } +#endif // SRSRAN_HAS_ENTERPRISE + void cu_cp_impl::handle_bearer_context_inactivity_notification(const cu_cp_inactivity_notification& msg) { if (msg.ue_inactive) { @@ -601,12 +605,15 @@ ue_index_t cu_cp_impl::handle_ue_index_allocation_request(const nr_cell_global_i return ue_mng.add_ue(du_index, cgi.plmn_id); } -SRSRAN_WEAK_SYMB void cu_cp_impl::handle_dl_ue_associated_nrppa_transport_pdu(ue_index_t ue_index, - const byte_buffer& nrppa_pdu) +#ifndef SRSRAN_HAS_ENTERPRISE + +void cu_cp_impl::handle_dl_ue_associated_nrppa_transport_pdu(ue_index_t ue_index, const byte_buffer& nrppa_pdu) { logger.info("DL UE associated NRPPa messages are not supported"); } +#endif // SRSRAN_HAS_ENTERPRISE + void cu_cp_impl::handle_dl_non_ue_associated_nrppa_transport_pdu(const byte_buffer& nrppa_pdu) { logger.info("DL non UE associated NRPPa messages are not supported"); @@ -617,16 +624,20 @@ void cu_cp_impl::handle_n2_disconnection() // TODO } -SRSRAN_WEAK_SYMB nrppa_cu_cp_ue_notifier* cu_cp_impl::handle_new_nrppa_ue(ue_index_t ue_index) +#ifndef SRSRAN_HAS_ENTERPRISE + +nrppa_cu_cp_ue_notifier* cu_cp_impl::handle_new_nrppa_ue(ue_index_t ue_index) { return nullptr; } -SRSRAN_WEAK_SYMB void cu_cp_impl::handle_ul_nrppa_pdu(const byte_buffer& nrppa_pdu, std::optional ue_index) +void cu_cp_impl::handle_ul_nrppa_pdu(const byte_buffer& nrppa_pdu, std::optional ue_index) { logger.info("UL NRPPa messages are not supported"); } +#endif // SRSRAN_HAS_ENTERPRISE + std::optional cu_cp_impl::handle_measurement_config_request(ue_index_t ue_index, nr_cell_identity nci, diff --git a/lib/cu_cp/routines/amf_connection_removal_routine.cpp b/lib/cu_cp/routines/amf_connection_removal_routine.cpp index 2715e92868..f78f385b54 100644 --- a/lib/cu_cp/routines/amf_connection_removal_routine.cpp +++ b/lib/cu_cp/routines/amf_connection_removal_routine.cpp @@ -15,14 +15,18 @@ using namespace srsran; using namespace srs_cu_cp; -SRSRAN_WEAK_SYMB async_task - srsran::srs_cu_cp::start_amf_connection_removal(ngap_repository& ngap_db, +#ifndef SRSRAN_HAS_ENTERPRISE + +async_task +srsran::srs_cu_cp::start_amf_connection_removal(ngap_repository& ngap_db, std::unordered_map>& amfs_connected) { return launch_async(ngap_db.get_ngaps().begin()->second, amfs_connected.begin()->second); } +#endif // SRSRAN_HAS_ENTERPRISE + amf_connection_removal_routine::amf_connection_removal_routine(ngap_interface* ngap_, std::atomic& amf_connected_) : ngap(ngap_), amf_connected(amf_connected_), logger(srslog::fetch_basic_logger("CU-CP")) diff --git a/lib/cu_cp/routines/amf_connection_setup_routine.cpp b/lib/cu_cp/routines/amf_connection_setup_routine.cpp index 9658ffd843..975f7ce07d 100644 --- a/lib/cu_cp/routines/amf_connection_setup_routine.cpp +++ b/lib/cu_cp/routines/amf_connection_setup_routine.cpp @@ -16,14 +16,18 @@ using namespace srsran; using namespace srs_cu_cp; -SRSRAN_WEAK_SYMB async_task - srsran::srs_cu_cp::start_amf_connection_setup(ngap_repository& ngap_db, +#ifndef SRSRAN_HAS_ENTERPRISE + +async_task +srsran::srs_cu_cp::start_amf_connection_setup(ngap_repository& ngap_db, std::unordered_map>& amfs_connected) { amfs_connected.emplace(ngap_db.get_ngaps().begin()->first, false); return launch_async(ngap_db, amfs_connected.begin()->second); } +#endif // SRSRAN_HAS_ENTERPRISE + amf_connection_setup_routine::amf_connection_setup_routine(ngap_repository& ngap_db_, std::atomic& amf_connected_) : ngap_db(ngap_db_), diff --git a/lib/cu_cp/routines/mobility/inter_cu_handover_target_routine.cpp b/lib/cu_cp/routines/mobility/inter_cu_handover_target_routine.cpp index 4f6f101e8a..fc0bc784f1 100644 --- a/lib/cu_cp/routines/mobility/inter_cu_handover_target_routine.cpp +++ b/lib/cu_cp/routines/mobility/inter_cu_handover_target_routine.cpp @@ -13,8 +13,10 @@ using namespace srsran; using namespace srs_cu_cp; -SRSRAN_WEAK_SYMB async_task - srsran::srs_cu_cp::start_inter_cu_handover_target_routine(const ngap_handover_request& request, +#ifndef SRSRAN_HAS_ENTERPRISE + +async_task +srsran::srs_cu_cp::start_inter_cu_handover_target_routine(const ngap_handover_request& request, e1ap_bearer_context_manager& e1ap_bearer_ctxt_mng, f1ap_ue_context_manager& f1ap_ue_ctxt_mng, cu_cp_ue_removal_handler& ue_removal_handler, @@ -35,3 +37,5 @@ SRSRAN_WEAK_SYMB async_task }; return launch_async(std::move(err_function)); } + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/du/du_high/du_manager/ran_resource_management/ue_capability_manager.cpp b/lib/du/du_high/du_manager/ran_resource_management/ue_capability_manager.cpp index 4e14a436b1..f2f7494765 100644 --- a/lib/du/du_high/du_manager/ran_resource_management/ue_capability_manager.cpp +++ b/lib/du/du_high/du_manager/ran_resource_management/ue_capability_manager.cpp @@ -50,12 +50,16 @@ srsran::srs_du::decode_ue_nr_cap_container(const byte_buffer& ue_cap_container) return ue_caps; } -SRSRAN_WEAK_SYMB void srsran::srs_du::decode_advanced_ue_nr_caps(ue_capability_summary& ue_capability, - const asn1::rrc_nr::ue_nr_cap_s& ue_caps) +#ifndef SRSRAN_HAS_ENTERPRISE + +void srsran::srs_du::decode_advanced_ue_nr_caps(ue_capability_summary& ue_capability, + const asn1::rrc_nr::ue_nr_cap_s& ue_caps) { // Advanced UE capabilities is not implemented. } +#endif // SRSRAN_HAS_ENTERPRISE + // Configure dedicated UE configuration to set MCS ant CQI tables. static void set_pdsch_mcs_table(serving_cell_config& cell_cfg, pdsch_mcs_table mcs_table) { diff --git a/lib/hal/dpdk/bbdev/bbdev_acc_factory.cpp b/lib/hal/dpdk/bbdev/bbdev_acc_factory.cpp index 29a89c8e0b..6802495535 100644 --- a/lib/hal/dpdk/bbdev/bbdev_acc_factory.cpp +++ b/lib/hal/dpdk/bbdev/bbdev_acc_factory.cpp @@ -13,10 +13,14 @@ using namespace srsran; using namespace dpdk; -SRSRAN_WEAK_SYMB std::shared_ptr srsran::dpdk::create_bbdev_acc(const bbdev_acc_configuration& cfg, - srslog::basic_logger& logger) +#ifndef SRSRAN_HAS_ENTERPRISE + +std::shared_ptr srsran::dpdk::create_bbdev_acc(const bbdev_acc_configuration& cfg, + srslog::basic_logger& logger) { logger.error("[bbdev] bbdev accelerator creation failed. Cause: hardware-acceleration is not supported."); return nullptr; } + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/hal/phy/upper/channel_processors/hw_accelerator_factories.cpp b/lib/hal/phy/upper/channel_processors/hw_accelerator_factories.cpp index 09a5ab23a4..3e6a85e140 100644 --- a/lib/hal/phy/upper/channel_processors/hw_accelerator_factories.cpp +++ b/lib/hal/phy/upper/channel_processors/hw_accelerator_factories.cpp @@ -13,8 +13,12 @@ using namespace srsran; using namespace hal; -SRSRAN_WEAK_SYMB std::shared_ptr +#ifndef SRSRAN_HAS_ENTERPRISE + +std::shared_ptr srsran::hal::create_bbdev_pdsch_enc_acc_factory(const bbdev_hwacc_pdsch_enc_factory_configuration& accelerator_config) { return nullptr; } + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/hal/phy/upper/channel_processors/pusch/hw_accelerator_factories.cpp b/lib/hal/phy/upper/channel_processors/pusch/hw_accelerator_factories.cpp index 228399018b..911ba78d59 100644 --- a/lib/hal/phy/upper/channel_processors/pusch/hw_accelerator_factories.cpp +++ b/lib/hal/phy/upper/channel_processors/pusch/hw_accelerator_factories.cpp @@ -13,8 +13,12 @@ using namespace srsran; using namespace hal; -SRSRAN_WEAK_SYMB std::shared_ptr +#ifndef SRSRAN_HAS_ENTERPRISE + +std::shared_ptr srsran::hal::create_bbdev_pusch_dec_acc_factory(const bbdev_hwacc_pusch_dec_factory_configuration& accelerator_config) { return nullptr; } + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/ngap/ngap_impl.cpp b/lib/ngap/ngap_impl.cpp index 980bfc1d9a..ce4f28e4d6 100644 --- a/lib/ngap/ngap_impl.cpp +++ b/lib/ngap/ngap_impl.cpp @@ -773,18 +773,21 @@ void ngap_impl::handle_handover_request(const asn1::ngap::ho_request_s& msg) } } -SRSRAN_WEAK_SYMB void -ngap_impl::handle_dl_ue_associated_nrppa_transport(const asn1::ngap::dl_ue_associated_nrppa_transport_s& msg) +#ifndef SRSRAN_HAS_ENTERPRISE + +void ngap_impl::handle_dl_ue_associated_nrppa_transport(const asn1::ngap::dl_ue_associated_nrppa_transport_s& msg) { logger.info("DL UE associated NRPPa messages are not supported"); } -SRSRAN_WEAK_SYMB void -ngap_impl::handle_dl_non_ue_associated_nrppa_transport(const asn1::ngap::dl_non_ue_associated_nrppa_transport_s& msg) +void ngap_impl::handle_dl_non_ue_associated_nrppa_transport( + const asn1::ngap::dl_non_ue_associated_nrppa_transport_s& msg) { logger.info("DL non UE associated NRPPa messages are not supported"); } +#endif // SRSRAN_HAS_ENTERPRISE + void ngap_impl::handle_error_indication(const asn1::ngap::error_ind_s& msg) { amf_ue_id_t amf_ue_id = amf_ue_id_t::invalid; @@ -992,12 +995,15 @@ void ngap_impl::handle_inter_cu_ho_rrc_recfg_complete(const ue_index_t tx_pdu_notifier->on_new_message(ngap_msg); } -SRSRAN_WEAK_SYMB void ngap_impl::handle_ul_ue_associated_nrppa_transport(ue_index_t ue_index, - const byte_buffer& nrppa_pdu) +#ifndef SRSRAN_HAS_ENTERPRISE + +void ngap_impl::handle_ul_ue_associated_nrppa_transport(ue_index_t ue_index, const byte_buffer& nrppa_pdu) { logger.info("UL UE associated NRPPa messages are not supported"); } +#endif // SRSRAN_HAS_ENTERPRISE + void ngap_impl::remove_ue_context(ue_index_t ue_index) { if (!ue_ctxt_list.contains(ue_index)) { diff --git a/lib/ngap/procedures/ngap_handover_preparation_procedure.cpp b/lib/ngap/procedures/ngap_handover_preparation_procedure.cpp index 690c2afa0d..3f7aaad963 100644 --- a/lib/ngap/procedures/ngap_handover_preparation_procedure.cpp +++ b/lib/ngap/procedures/ngap_handover_preparation_procedure.cpp @@ -14,8 +14,10 @@ using namespace srsran; using namespace srsran::srs_cu_cp; using namespace asn1::ngap; -SRSRAN_WEAK_SYMB async_task - srsran::srs_cu_cp::start_ngap_handover_preparation(const ngap_handover_preparation_request& req, +#ifndef SRSRAN_HAS_ENTERPRISE + +async_task +srsran::srs_cu_cp::start_ngap_handover_preparation(const ngap_handover_preparation_request& req, const plmn_identity& serving_plmn, const ngap_ue_ids& ue_ids, ngap_message_notifier& amf_notifier, @@ -32,3 +34,5 @@ SRSRAN_WEAK_SYMB async_task }; return launch_async(std::move(err_function)); } + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/ngap/procedures/ngap_handover_resource_allocation_procedure.cpp b/lib/ngap/procedures/ngap_handover_resource_allocation_procedure.cpp index a34dd1be0f..96fa060279 100644 --- a/lib/ngap/procedures/ngap_handover_resource_allocation_procedure.cpp +++ b/lib/ngap/procedures/ngap_handover_resource_allocation_procedure.cpp @@ -13,15 +13,16 @@ using namespace srsran; using namespace srsran::srs_cu_cp; -SRSRAN_WEAK_SYMB async_task - srsran::srs_cu_cp::start_ngap_handover_resource_allocation(const ngap_handover_request& request, - const amf_ue_id_t amf_ue_id, - ngap_ue_context_list& ue_ctxt_list, - ngap_cu_cp_notifier& cu_cp_notifier, - ngap_message_notifier& amf_notifier, - timer_manager& timers, - task_executor& task_exec, - srslog::basic_logger& logger) +#ifndef SRSRAN_HAS_ENTERPRISE + +async_task srsran::srs_cu_cp::start_ngap_handover_resource_allocation(const ngap_handover_request& request, + const amf_ue_id_t amf_ue_id, + ngap_ue_context_list& ue_ctxt_list, + ngap_cu_cp_notifier& cu_cp_notifier, + ngap_message_notifier& amf_notifier, + timer_manager& timers, + task_executor& task_exec, + srslog::basic_logger& logger) { logger.error("NG Handover resource allocation failed. Cause: NG handover not supported"); auto err_function = [](coro_context>& ctx) { @@ -30,3 +31,5 @@ SRSRAN_WEAK_SYMB async_task }; return launch_async(std::move(err_function)); } + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/phy/upper/channel_processors/pusch/pusch_processor_phy_capabilities.cpp b/lib/phy/upper/channel_processors/pusch/pusch_processor_phy_capabilities.cpp index de4f53e650..f23a1b0118 100644 --- a/lib/phy/upper/channel_processors/pusch/pusch_processor_phy_capabilities.cpp +++ b/lib/phy/upper/channel_processors/pusch/pusch_processor_phy_capabilities.cpp @@ -13,7 +13,11 @@ using namespace srsran; -SRSRAN_WEAK_SYMB pusch_processor_phy_capabilities srsran::get_pusch_processor_phy_capabilities() +#ifndef PUSCH_PROCESSOR_MAX_NOF_LAYERS +#define PUSCH_PROCESSOR_MAX_NOF_LAYERS 1 +#endif // PUSCH_PROCESSOR_MAX_NOF_LAYERS + +pusch_processor_phy_capabilities srsran::get_pusch_processor_phy_capabilities() { - return {.max_nof_layers = 1}; + return {.max_nof_layers = PUSCH_PROCESSOR_MAX_NOF_LAYERS}; } \ No newline at end of file diff --git a/lib/phy/upper/equalization/channel_equalizer_generic_impl.cpp b/lib/phy/upper/equalization/channel_equalizer_generic_impl.cpp index f1fbb118e5..e48000129f 100644 --- a/lib/phy/upper/equalization/channel_equalizer_generic_impl.cpp +++ b/lib/phy/upper/equalization/channel_equalizer_generic_impl.cpp @@ -209,72 +209,98 @@ void equalize_mmse_single_tx_layer<1>(unsigned /**/, equalize_mmse_1xn<1>(eq_symbols, eq_noise_vars, ch_symbols, ch_estimates, noise_var, tx_scaling); } -SRSRAN_WEAK_SYMB void -channel_equalizer_generic_impl::equalize_zf_3x4(span /* eq_symbols */, - span /* noise_vars */, - const re_buffer_reader& /* ch_symbols */, - const channel_equalizer::ch_est_list& /* ch_estimates */, - float /* noise_var_est */, - float /* tx_scaling */) +#ifndef SRSRAN_HAS_ENTERPRISE +void channel_equalizer_generic_impl::equalize_zf_3x4(span /* eq_symbols */, + span /* noise_vars */, + const re_buffer_reader& /* ch_symbols */, + const channel_equalizer::ch_est_list& /* ch_estimates */, + float /* noise_var_est */, + float /* tx_scaling */) { srsran_assertion_failure("Equalizer not implemented for 3x4 ZF algorithm."); } -SRSRAN_WEAK_SYMB void -channel_equalizer_generic_impl::equalize_zf_4x4(span /* eq_symbols */, - span /* noise_vars */, - const re_buffer_reader& /* ch_symbols */, - const channel_equalizer::ch_est_list& /* ch_estimates */, - float /* noise_var_est */, - float /* tx_scaling */) +void channel_equalizer_generic_impl::equalize_zf_4x4(span /* eq_symbols */, + span /* noise_vars */, + const re_buffer_reader& /* ch_symbols */, + const channel_equalizer::ch_est_list& /* ch_estimates */, + float /* noise_var_est */, + float /* tx_scaling */) { srsran_assertion_failure("Equalizer not implemented for 4x4 ZF algorithm."); } -SRSRAN_WEAK_SYMB void -channel_equalizer_generic_impl::equalize_mmse_2x2(span /* eq_symbols */, - span /* noise_vars */, - const re_buffer_reader& /* ch_symbols */, - const channel_equalizer::ch_est_list& /* ch_estimates */, - float /* noise_var_est */, - float /* tx_scaling */) +void channel_equalizer_generic_impl::equalize_mmse_2x2(span /* eq_symbols */, + span /* noise_vars */, + const re_buffer_reader& /* ch_symbols */, + const channel_equalizer::ch_est_list& /* ch_estimates */, + float /* noise_var_est */, + float /* tx_scaling */) { srsran_assertion_failure("Equalizer not implemented for 2x2 MMSE algorithm."); } -SRSRAN_WEAK_SYMB void -channel_equalizer_generic_impl::equalize_mmse_2x4(span /* eq_symbols */, - span /* noise_vars */, - const re_buffer_reader& /* ch_symbols */, - const channel_equalizer::ch_est_list& /* ch_estimates */, - float /* noise_var_est */, - float /* tx_scaling */) +void channel_equalizer_generic_impl::equalize_mmse_2x4(span /* eq_symbols */, + span /* noise_vars */, + const re_buffer_reader& /* ch_symbols */, + const channel_equalizer::ch_est_list& /* ch_estimates */, + float /* noise_var_est */, + float /* tx_scaling */) { srsran_assertion_failure("Equalizer not implemented for 2x4 MMSE algorithm."); } -SRSRAN_WEAK_SYMB void -channel_equalizer_generic_impl::equalize_mmse_3x4(span /* eq_symbols */, - span /* noise_vars */, - const re_buffer_reader& /* ch_symbols */, - const channel_equalizer::ch_est_list& /* ch_estimates */, - float /* noise_var_est */, - float /* tx_scaling */) +void channel_equalizer_generic_impl::equalize_mmse_3x4(span /* eq_symbols */, + span /* noise_vars */, + const re_buffer_reader& /* ch_symbols */, + const channel_equalizer::ch_est_list& /* ch_estimates */, + float /* noise_var_est */, + float /* tx_scaling */) { srsran_assertion_failure("Equalizer not implemented for 3x4 MMSE algorithm."); } -SRSRAN_WEAK_SYMB void -channel_equalizer_generic_impl::equalize_mmse_4x4(span /* eq_symbols */, - span /* noise_vars */, - const re_buffer_reader& /* ch_symbols */, - const channel_equalizer::ch_est_list& /* ch_estimates */, - float /* noise_var_est */, - float /* tx_scaling */) +void channel_equalizer_generic_impl::equalize_mmse_4x4(span /* eq_symbols */, + span /* noise_vars */, + const re_buffer_reader& /* ch_symbols */, + const channel_equalizer::ch_est_list& /* ch_estimates */, + float /* noise_var_est */, + float /* tx_scaling */) { srsran_assertion_failure("Equalizer not implemented for 4x4 MMSE algorithm."); } +bool channel_equalizer_generic_impl::is_supported(channel_equalizer_algorithm_type type, + unsigned nof_ports, + unsigned nof_layers) +{ + // Only one, two and four ports are currently supported. + if ((nof_ports != 1) && (nof_ports != 2) && (nof_ports != 4)) { + return false; + } + + // The number of layers cannot be greater than the number of ports. + if (nof_ports < nof_layers) { + return false; + } + + // ZF algorithm supports from one to two layers. + static constexpr interval zf_nof_layers_range(1, 2); + if ((type == channel_equalizer_algorithm_type::zf) && !zf_nof_layers_range.contains(nof_layers)) { + return false; + } + + // MMSE algorithm supports only one layer. + if ((type == channel_equalizer_algorithm_type::mmse) && (nof_layers != 1)) { + return false; + } + + // Otherwise it is supported. + return true; +} + +#endif // SRSRAN_HAS_ENTERPRISE + bool channel_equalizer_generic_impl::is_supported(unsigned nof_ports, unsigned nof_layers) { return is_supported(type, nof_ports, nof_layers); @@ -373,32 +399,3 @@ void channel_equalizer_generic_impl::equalize(span e ch_estimates.get_nof_tx_layers(), to_string(type)); } - -SRSRAN_WEAK_SYMB bool channel_equalizer_generic_impl::is_supported(channel_equalizer_algorithm_type type, - unsigned nof_ports, - unsigned nof_layers) -{ - // Only one, two and four ports are currently supported. - if ((nof_ports != 1) && (nof_ports != 2) && (nof_ports != 4)) { - return false; - } - - // The number of layers cannot be greater than the number of ports. - if (nof_ports < nof_layers) { - return false; - } - - // ZF algorithm supports from one to two layers. - static constexpr interval zf_nof_layers_range(1, 2); - if ((type == channel_equalizer_algorithm_type::zf) && !zf_nof_layers_range.contains(nof_layers)) { - return false; - } - - // MMSE algorithm supports only one layer. - if ((type == channel_equalizer_algorithm_type::mmse) && (nof_layers != 1)) { - return false; - } - - // Otherwise it is supported. - return true; -} diff --git a/lib/phy/upper/signal_processors/port_channel_estimator_average_impl.cpp b/lib/phy/upper/signal_processors/port_channel_estimator_average_impl.cpp index cf29e0ce00..63af8ee458 100644 --- a/lib/phy/upper/signal_processors/port_channel_estimator_average_impl.cpp +++ b/lib/phy/upper/signal_processors/port_channel_estimator_average_impl.cpp @@ -25,6 +25,8 @@ using namespace srsran; +#ifndef SRSRAN_HAS_ENTERPRISE + /// \brief Extracts channel observations corresponding to DM-RS pilots from the resource grid for one layer, one hop /// and for the selected port. /// \param[out] rx_symbols Symbol buffer destination. @@ -68,7 +70,6 @@ static float estimate_noise(const dmrs_symbol_list& pilots, unsigned last_hop_symbol, unsigned hop_offset); -SRSRAN_WEAK_SYMB void port_channel_estimator_average_impl::do_compute(channel_estimate& estimate, const resource_grid_reader& grid, unsigned port, @@ -147,7 +148,6 @@ void port_channel_estimator_average_impl::do_compute(channel_estimate& estimate.set_snr((noise_var != 0) ? datarp / noise_var : 1000, port, layer0); } -SRSRAN_WEAK_SYMB void port_channel_estimator_average_impl::compute_hop(srsran::channel_estimate& estimate, const srsran::resource_grid_reader& grid, unsigned port, @@ -284,20 +284,6 @@ void port_channel_estimator_average_impl::compute_hop(srsran::channel_estimate& hop_offset); } -void port_channel_estimator_average_impl::initialize_symbol_start_epochs(cyclic_prefix cp, subcarrier_spacing scs) -{ - unsigned nof_symbols_slot = get_nsymb_per_slot(cp); - symbol_start_epochs = span(aux_symbol_start_epochs).first(nof_symbols_slot); - - // Compute cumulative duration of CPs. - symbol_start_epochs[0] = cp.get_length(0, scs).to_seconds() * scs_to_khz(scs) * 1000; - for (unsigned i_cp = 1; i_cp != nof_symbols_slot; ++i_cp) { - symbol_start_epochs[i_cp] = - symbol_start_epochs[i_cp - 1] + cp.get_length(i_cp, scs).to_seconds() * scs_to_khz(scs) * 1000 + 1.0F; - } -} - -SRSRAN_WEAK_SYMB std::optional port_channel_estimator_average_impl::preprocess_pilots_and_cfo(const dmrs_symbol_list& pilots, const bounded_bitset& dmrs_mask, @@ -472,3 +458,18 @@ static float estimate_noise(const dmrs_symbol_list& pilots, return noise_energy; } + +#endif // SRSRAN_HAS_ENTERPRISE + +void port_channel_estimator_average_impl::initialize_symbol_start_epochs(cyclic_prefix cp, subcarrier_spacing scs) +{ + unsigned nof_symbols_slot = get_nsymb_per_slot(cp); + symbol_start_epochs = span(aux_symbol_start_epochs).first(nof_symbols_slot); + + // Compute cumulative duration of CPs. + symbol_start_epochs[0] = cp.get_length(0, scs).to_seconds() * scs_to_khz(scs) * 1000; + for (unsigned i_cp = 1; i_cp != nof_symbols_slot; ++i_cp) { + symbol_start_epochs[i_cp] = + symbol_start_epochs[i_cp - 1] + cp.get_length(i_cp, scs).to_seconds() * scs_to_khz(scs) * 1000 + 1.0F; + } +} diff --git a/lib/ran/pusch/pusch_antenna_port_mapping.cpp b/lib/ran/pusch/pusch_antenna_port_mapping.cpp index b2c7b3de31..6f8d844923 100644 --- a/lib/ran/pusch/pusch_antenna_port_mapping.cpp +++ b/lib/ran/pusch/pusch_antenna_port_mapping.cpp @@ -12,13 +12,15 @@ using namespace srsran; +#ifndef SRSRAN_HAS_ENTERPRISE + // Current range of supported number of layers. static constexpr interval nof_layers_range(1, 1); -SRSRAN_WEAK_SYMB unsigned srsran::get_pusch_antenna_port_mapping_row_index(unsigned nof_layers, - bool transform_precoder, - dmrs_config_type dmrs_cfg_type, - dmrs_max_length dmrs_max_len) +unsigned srsran::get_pusch_antenna_port_mapping_row_index(unsigned nof_layers, + bool transform_precoder, + dmrs_config_type dmrs_cfg_type, + dmrs_max_length dmrs_max_len) { srsran_assert(nof_layers_range.contains(nof_layers), "The number of layers (i.e., {}) is out of the range {}.", @@ -38,14 +40,13 @@ SRSRAN_WEAK_SYMB unsigned srsran::get_pusch_antenna_port_mapping_row_index(unsig return 2; } -SRSRAN_WEAK_SYMB unsigned -srsran::get_pusch_precoding_info_row_index(unsigned nof_layers, - unsigned max_rank, - srs_resource_configuration::one_two_four_enum nof_srs_ports, - bool transform_precoder, - dmrs_config_type dmrs_cfg_type, - dmrs_max_length dmrs_max_len, - unsigned tpmi) +unsigned srsran::get_pusch_precoding_info_row_index(unsigned nof_layers, + unsigned max_rank, + srs_resource_configuration::one_two_four_enum nof_srs_ports, + bool transform_precoder, + dmrs_config_type dmrs_cfg_type, + dmrs_max_length dmrs_max_len, + unsigned tpmi) { static constexpr interval max_rank_range(1, 4); srsran_assert( @@ -111,3 +112,4 @@ srsran::get_pusch_precoding_info_row_index(unsigned // Unhandled case. return 0; } +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/scheduler/support/ul_power_controller.cpp b/lib/scheduler/support/ul_power_controller.cpp index 039d1bd256..6bccf14a80 100644 --- a/lib/scheduler/support/ul_power_controller.cpp +++ b/lib/scheduler/support/ul_power_controller.cpp @@ -58,14 +58,6 @@ void ul_power_controller::reconfigure(const ue_cell_configuration& ue_cell_cfg) } } -SRSRAN_WEAK_SYMB void ul_power_controller::handle_phr(const cell_ph_report& phr, slot_point slot_rx) -{ - if (not pusch_pwr_ctrl.has_value()) { - return; - } - latest_phr.emplace(ue_phr_report{phr, std::nullopt}); -} - void ul_power_controller::update_pusch_pw_ctrl_state(slot_point slot_rx, unsigned nof_prbs) { const int latest_f_cl_pw_control = @@ -74,15 +66,27 @@ void ul_power_controller::update_pusch_pw_ctrl_state(slot_point slot_rx, unsigne pusch_pw_ctrl_grid[grid_idx] = {slot_rx, nof_prbs, latest_f_cl_pw_control}; } -SRSRAN_WEAK_SYMB unsigned ul_power_controller::adapt_pusch_prbs_to_phr(unsigned nof_prbs) const +#ifndef SRSRAN_HAS_ENTERPRISE + +void ul_power_controller::handle_phr(const cell_ph_report& phr, slot_point slot_rx) +{ + if (not pusch_pwr_ctrl.has_value()) { + return; + } + latest_phr.emplace(ue_phr_report{phr, std::nullopt}); +} + +unsigned ul_power_controller::adapt_pusch_prbs_to_phr(unsigned nof_prbs) const { // Dummy function. This feature is only available in the SRSRAN 5G Enterprise version. return nof_prbs; } -SRSRAN_WEAK_SYMB uint8_t ul_power_controller::compute_tpc_command(slot_point pusch_slot) +uint8_t ul_power_controller::compute_tpc_command(slot_point pusch_slot) { // Dummy function. This feature is only available in the SRSRAN 5G Enterprise version. static constexpr uint8_t default_tpc = 1; return default_tpc; } + +#endif // SRSRAN_HAS_ENTERPRISE diff --git a/lib/scheduler/ue_context/ue_channel_state_manager.cpp b/lib/scheduler/ue_context/ue_channel_state_manager.cpp index c0ca9b3887..b8122974a9 100644 --- a/lib/scheduler/ue_context/ue_channel_state_manager.cpp +++ b/lib/scheduler/ue_context/ue_channel_state_manager.cpp @@ -77,12 +77,16 @@ void ue_channel_state_manager::update_srs_channel_matrix(const srs_channel_matri get_tpmi_select_info(channel_matrix, noise_var, codebook_cfg.max_rank.value(), codebook_cfg.codebook_subset); } -SRSRAN_WEAK_SYMB unsigned ue_channel_state_manager::get_nof_ul_layers() const +#ifndef SRSRAN_HAS_ENTERPRISE + +unsigned ue_channel_state_manager::get_nof_ul_layers() const { return 1; } -SRSRAN_WEAK_SYMB unsigned ue_channel_state_manager::get_recommended_pusch_tpmi(unsigned nof_layers) const +#endif // SRSRAN_HAS_ENTERPRISE + +unsigned ue_channel_state_manager::get_recommended_pusch_tpmi(unsigned nof_layers) const { if (last_pusch_tpmi_select_info.has_value() && (nof_layers <= last_pusch_tpmi_select_info.value().get_max_nof_layers())) { From dc04ee3cd8109b9787907d01340bbe42e04680cf Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 18 Dec 2024 13:50:10 +0100 Subject: [PATCH 11/18] support: removed dynamic link library support --- apps/gnb/gnb.cpp | 1 - include/srsran/support/dynlink_manager.h | 35 --------- lib/support/CMakeLists.txt | 1 - lib/support/dynlink_manager.cpp | 94 ------------------------ 4 files changed, 131 deletions(-) delete mode 100644 include/srsran/support/dynlink_manager.h delete mode 100644 lib/support/dynlink_manager.cpp diff --git a/apps/gnb/gnb.cpp b/apps/gnb/gnb.cpp index 8799271013..0ff81cacf0 100644 --- a/apps/gnb/gnb.cpp +++ b/apps/gnb/gnb.cpp @@ -41,7 +41,6 @@ #include "srsran/support/backtrace.h" #include "srsran/support/config_parsers.h" #include "srsran/support/cpu_features.h" -#include "srsran/support/dynlink_manager.h" #include "srsran/support/io/io_broker_factory.h" #include "srsran/support/signal_handling.h" #include "srsran/support/tracing/event_tracing.h" diff --git a/include/srsran/support/dynlink_manager.h b/include/srsran/support/dynlink_manager.h deleted file mode 100644 index da7612bc25..0000000000 --- a/include/srsran/support/dynlink_manager.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright 2021-2024 Software Radio Systems Limited - * - * By using this file, you agree to the terms and conditions set - * forth in the LICENSE file which can be found at the top level of - * the distribution. - * - */ - -#pragma once - -#include "srsran/adt/expected.h" -#include "srsran/srslog/logger.h" - -namespace srsran { -class dynlink_manager -{ -public: - static std::optional create(const std::string& dl_name, srslog::basic_logger& logger_); - expected load_symbol(const std::string& symbol_name); - - ~dynlink_manager(); - -private: - explicit dynlink_manager(const std::string& dl_name_, srslog::basic_logger& logger_); - [[nodiscard]] bool open(); - bool close(); - - void* dl_handle = nullptr; - std::string dl_name; - srslog::basic_logger& logger; -}; - -} // namespace srsran diff --git a/lib/support/CMakeLists.txt b/lib/support/CMakeLists.txt index e55590e520..3fa9073cb4 100644 --- a/lib/support/CMakeLists.txt +++ b/lib/support/CMakeLists.txt @@ -29,7 +29,6 @@ set(SOURCES sysinfo.cpp timers.cpp math_utils.cpp - dynlink_manager.cpp ) add_library(srsran_support STATIC ${SOURCES}) diff --git a/lib/support/dynlink_manager.cpp b/lib/support/dynlink_manager.cpp deleted file mode 100644 index 1a754d10eb..0000000000 --- a/lib/support/dynlink_manager.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * - * Copyright 2021-2024 Software Radio Systems Limited - * - * By using this file, you agree to the terms and conditions set - * forth in the LICENSE file which can be found at the top level of - * the distribution. - * - */ - -#include "srsran/support/dynlink_manager.h" -#include -#include - -using namespace srsran; - -std::optional dynlink_manager::create(const std::string& dl_name, srslog::basic_logger& logger) -{ - dynlink_manager mng(dl_name, logger); - if (not mng.open()) { - return {}; - } - return mng; -} - -dynlink_manager::dynlink_manager(const std::string& dl_name_, srslog::basic_logger& logger_) : - dl_name(dl_name_), logger(logger_) -{ -} - -dynlink_manager::~dynlink_manager() -{ - close(); -} - -bool dynlink_manager::open() -{ - char* err = nullptr; - - dl_handle = ::dlopen(dl_name.c_str(), RTLD_NOW + RTLD_DEEPBIND + RTLD_GLOBAL); - if (dl_handle == nullptr) { - err = ::dlerror(); - if (err != nullptr) { - logger.error("Failed to load library {}: {}", dl_name, err); - } else { - logger.error("Failed to load library {}", dl_name); - } - return false; - } - logger.debug("Opened library: {}", dl_name); - return true; -} - -expected dynlink_manager::load_symbol(const std::string& symbol_name) -{ - if (dl_handle == nullptr) { - return make_unexpected(default_error_t{}); - } - - void* symb = ::dlsym(dl_handle, symbol_name.c_str()); - - // Handle an error loading the symbol. - char* err = nullptr; - if (symb == nullptr) { - err = ::dlerror(); - if (err != nullptr) { - logger.error("Error loading symbol {} in {}: {}\n", symbol_name, dl_name, err); - } else { - logger.error("Error loading symbol {} in {}:\n", symbol_name, dl_name); - } - return make_unexpected(default_error_t{}); - } - logger.debug("Loaded symbol: {}", symbol_name); - return symb; -} - -bool dynlink_manager::close() -{ - if (dl_handle == nullptr) { - return false; - } - - if (::dlclose(dl_handle) != 0) { - char* err = ::dlerror(); - if (err != nullptr) { - logger.error("Failed to close dynamic link handle: {}", err); - } else { - logger.error("Failed to close dynamic link handle"); - } - return false; - } - logger.debug("Closed library"); - return true; -} From ee3668bc604367acde8f26412d764bb26b3ee003 Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Thu, 19 Dec 2024 13:27:44 +0100 Subject: [PATCH 12/18] support,fmt: fix bogus -Wstringop-overflow Backport of patch a16ff57 from fmt repository to fix GCC false-alarm: warning: writing 8 bytes into a region of size 7 [-Wstringop-overflow=] #4192 --- external/fmt/include/fmt/format.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/external/fmt/include/fmt/format.h b/external/fmt/include/fmt/format.h index 67f0ab739b..dd4945973b 100644 --- a/external/fmt/include/fmt/format.h +++ b/external/fmt/include/fmt/format.h @@ -673,6 +673,8 @@ FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { } } if (auto num_chars_left = s.data() + s.size() - p) { + // Suppress bogus -Wstringop-overflow. + if (FMT_GCC_VERSION) num_chars_left &= 3; char buf[2 * block_size - 1] = {}; copy(p, p + num_chars_left, buf); const char* buf_ptr = buf; From 213ca4c5891943f49d50f2b0f9ddf24c66256f95 Mon Sep 17 00:00:00 2001 From: frankist Date: Thu, 19 Dec 2024 11:29:34 +0100 Subject: [PATCH 13/18] increase max nof cells per DU constant to 32 --- include/srsran/cu_cp/cu_cp_types.h | 4 ++-- include/srsran/cu_cp/up_context.h | 1 + include/srsran/ngap/ngap_handover.h | 1 + include/srsran/nrppa/nrppa.h | 1 + include/srsran/ran/du_types.h | 5 +++-- include/srsran/ran/gnb_constants.h | 21 +++++++++++++++++++ .../cu_up_connection_manager.h | 1 + .../cu_cp_controller/du_connection_manager.h | 3 ++- .../cu_up_processor_repository.h | 1 + lib/cu_cp/task_schedulers/du_task_scheduler.h | 1 + .../e1ap/common/e1ap_cu_cp_test_messages.h | 1 + 11 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 include/srsran/ran/gnb_constants.h diff --git a/include/srsran/cu_cp/cu_cp_types.h b/include/srsran/cu_cp/cu_cp_types.h index fe64797111..ade6f2646e 100644 --- a/include/srsran/cu_cp/cu_cp_types.h +++ b/include/srsran/cu_cp/cu_cp_types.h @@ -17,6 +17,7 @@ #include "srsran/ran/cause/ngap_cause.h" #include "srsran/ran/crit_diagnostics.h" #include "srsran/ran/cu_types.h" +#include "srsran/ran/gnb_constants.h" #include "srsran/ran/gnb_id.h" #include "srsran/ran/nr_cgi.h" #include "srsran/ran/pci.h" @@ -26,7 +27,6 @@ #include "srsran/ran/tac.h" #include "srsran/ran/up_transport_layer_info.h" #include -#include #include #include #include @@ -37,7 +37,7 @@ namespace srs_cu_cp { /// Maximum number of DUs supported by CU-CP (implementation-defined). const uint16_t MAX_NOF_DUS = 65535; /// Maximum number of cells per DU supported by CU-CP (implementation-defined). -const uint16_t MAX_NOF_DU_CELLS = 16; +const uint16_t MAX_NOF_DU_CELLS = MAX_CELLS_PER_DU; /// Maximum number of CU-UPs supported by CU-CP (implementation-defined). const uint16_t MAX_NOF_CU_UPS = 65535; /// Maximum number of UEs supported by CU-CP (implementation-defined). diff --git a/include/srsran/cu_cp/up_context.h b/include/srsran/cu_cp/up_context.h index ab7aca53b4..8cb36b71da 100644 --- a/include/srsran/cu_cp/up_context.h +++ b/include/srsran/cu_cp/up_context.h @@ -13,6 +13,7 @@ #include "srsran/cu_cp/cu_cp_types.h" #include "srsran/ran/rb_id.h" #include "srsran/rlc/rlc_config.h" +#include namespace srsran { diff --git a/include/srsran/ngap/ngap_handover.h b/include/srsran/ngap/ngap_handover.h index 3d03fdf662..6d0776ccdb 100644 --- a/include/srsran/ngap/ngap_handover.h +++ b/include/srsran/ngap/ngap_handover.h @@ -14,6 +14,7 @@ #include "srsran/ngap/ngap_types.h" #include "srsran/security/security.h" #include "srsran/support/async/async_task.h" +#include namespace srsran { namespace srs_cu_cp { diff --git a/include/srsran/nrppa/nrppa.h b/include/srsran/nrppa/nrppa.h index 356a9fab2e..4c32b70dd0 100644 --- a/include/srsran/nrppa/nrppa.h +++ b/include/srsran/nrppa/nrppa.h @@ -13,6 +13,7 @@ #include "srsran/cu_cp/cu_cp_types.h" #include "srsran/rrc/meas_types.h" #include "srsran/support/async/async_task.h" +#include namespace srsran { namespace srs_cu_cp { diff --git a/include/srsran/ran/du_types.h b/include/srsran/ran/du_types.h index ebe272065f..b71e1e28b1 100644 --- a/include/srsran/ran/du_types.h +++ b/include/srsran/ran/du_types.h @@ -10,6 +10,7 @@ #pragma once +#include "srsran/ran/gnb_constants.h" #include #include @@ -26,8 +27,8 @@ enum du_ue_index_t : uint16_t { /// Maximum number of cells supported by DU (implementation-defined). enum du_cell_index_t : uint16_t { MIN_DU_CELL_INDEX = 0, - MAX_DU_CELL_INDEX = 15, - MAX_NOF_DU_CELLS = 16, + MAX_DU_CELL_INDEX = MAX_CELLS_PER_DU - 1, + MAX_NOF_DU_CELLS = MAX_CELLS_PER_DU, INVALID_DU_CELL_INDEX = MAX_NOF_DU_CELLS }; diff --git a/include/srsran/ran/gnb_constants.h b/include/srsran/ran/gnb_constants.h new file mode 100644 index 0000000000..35dcb711bf --- /dev/null +++ b/include/srsran/ran/gnb_constants.h @@ -0,0 +1,21 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +#include + +namespace srsran { + +/// \brief Defines the maximum number of cells that can be instantiated per srsDU (implementation-defined). +/// \remark TS 38.473 defines an upper limit of maxCellingNBDU=512 for this value. +static constexpr uint16_t MAX_CELLS_PER_DU = 32; + +} // namespace srsran diff --git a/lib/cu_cp/cu_cp_controller/cu_up_connection_manager.h b/lib/cu_cp/cu_cp_controller/cu_up_connection_manager.h index 179186c55a..1e35f1e831 100644 --- a/lib/cu_cp/cu_cp_controller/cu_up_connection_manager.h +++ b/lib/cu_cp/cu_cp_controller/cu_up_connection_manager.h @@ -14,6 +14,7 @@ #include "srsran/cu_cp/cu_cp_types.h" #include "srsran/support/executors/task_executor.h" #include +#include namespace srsran { namespace srs_cu_cp { diff --git a/lib/cu_cp/cu_cp_controller/du_connection_manager.h b/lib/cu_cp/cu_cp_controller/du_connection_manager.h index f6e08bcefb..40886dd315 100644 --- a/lib/cu_cp/cu_cp_controller/du_connection_manager.h +++ b/lib/cu_cp/cu_cp_controller/du_connection_manager.h @@ -14,6 +14,7 @@ #include "srsran/cu_cp/cu_cp_types.h" #include "srsran/support/executors/task_executor.h" #include +#include namespace srsran { namespace srs_cu_cp { @@ -63,4 +64,4 @@ class du_connection_manager : public cu_cp_f1c_handler }; } // namespace srs_cu_cp -} // namespace srsran \ No newline at end of file +} // namespace srsran diff --git a/lib/cu_cp/cu_up_processor/cu_up_processor_repository.h b/lib/cu_cp/cu_up_processor/cu_up_processor_repository.h index 991b1d7a1c..930afc37e1 100644 --- a/lib/cu_cp/cu_up_processor/cu_up_processor_repository.h +++ b/lib/cu_cp/cu_up_processor/cu_up_processor_repository.h @@ -14,6 +14,7 @@ #include "cu_up_processor_impl_interface.h" #include "srsran/cu_cp/cu_cp_e1_handler.h" #include "srsran/cu_cp/cu_cp_types.h" +#include #include namespace srsran { diff --git a/lib/cu_cp/task_schedulers/du_task_scheduler.h b/lib/cu_cp/task_schedulers/du_task_scheduler.h index dfc073640a..7ba5c46c74 100644 --- a/lib/cu_cp/task_schedulers/du_task_scheduler.h +++ b/lib/cu_cp/task_schedulers/du_task_scheduler.h @@ -15,6 +15,7 @@ #include "srsran/support/async/fifo_async_task_scheduler.h" #include "srsran/support/executors/task_executor.h" #include "srsran/support/timers.h" +#include namespace srsran { namespace srs_cu_cp { diff --git a/tests/unittests/e1ap/common/e1ap_cu_cp_test_messages.h b/tests/unittests/e1ap/common/e1ap_cu_cp_test_messages.h index 0439b42d0a..6acc5fbd10 100644 --- a/tests/unittests/e1ap/common/e1ap_cu_cp_test_messages.h +++ b/tests/unittests/e1ap/common/e1ap_cu_cp_test_messages.h @@ -15,6 +15,7 @@ #include "srsran/e1ap/cu_cp/e1ap_cu_cp.h" #include "srsran/ran/cu_types.h" #include "srsran/ran/rb_id.h" +#include namespace srsran { namespace srs_cu_cp { From 0b400a0f6eafa719ee15661067aa592b33bcd37f Mon Sep 17 00:00:00 2001 From: frankist Date: Thu, 19 Dec 2024 12:35:58 +0100 Subject: [PATCH 14/18] increase ring size for test mode internal storage --- include/srsran/scheduler/resource_grid_util.h | 6 +++--- lib/du/du_high/test_mode/mac_test_mode_adapter.cpp | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/srsran/scheduler/resource_grid_util.h b/include/srsran/scheduler/resource_grid_util.h index 72448bae06..08f142ac65 100644 --- a/include/srsran/scheduler/resource_grid_util.h +++ b/include/srsran/scheduler/resource_grid_util.h @@ -25,8 +25,8 @@ namespace srsran { /// the numerology mu=0 (SCS=15kHz), it will be also satisfied for the same RING_ALLOCATOR_SIZE and larger numerologies. /// This means that in contexts where mu is not known (e.g. compile time), mu=0 can be used for generality sake, /// at the expense of more memory overhead. -constexpr inline unsigned get_allocator_ring_size_gt_min(unsigned minimum_value, - subcarrier_spacing scs = subcarrier_spacing::kHz15) +constexpr unsigned get_allocator_ring_size_gt_min(unsigned minimum_value, + subcarrier_spacing scs = subcarrier_spacing::kHz15) { auto power2_ceil = [](unsigned x) { if (x <= 1) @@ -44,7 +44,7 @@ constexpr inline unsigned get_allocator_ring_size_gt_min(unsigned mini } /// \brief Retrieves how far in advance the scheduler can allocate resources in the UL resource grid. -constexpr inline unsigned get_max_slot_ul_alloc_delay(unsigned ntn_cs_koffset) +constexpr unsigned get_max_slot_ul_alloc_delay(unsigned ntn_cs_koffset) { return SCHEDULER_MAX_K0 + std::max(SCHEDULER_MAX_K1, SCHEDULER_MAX_K2 + MAX_MSG3_DELTA) + ntn_cs_koffset; } diff --git a/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp b/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp index 76a01fda27..98e050f236 100644 --- a/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp +++ b/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp @@ -55,9 +55,12 @@ class test_ue_mac_sdu_tx_builder_adapter : public mac_sdu_tx_builder size_t get_ring_size(const mac_cell_creation_request& cell_cfg) { + // Estimation of the time it takes the UL lower-layers to process and forward CRC/UCI indications. + constexpr static unsigned MAX_UL_PHY_DELAY = 40; // Note: The history ring size has to be a multiple of the TDD frame size in slots. // Number of slots managed by this container. - return get_allocator_ring_size_gt_min(get_max_slot_ul_alloc_delay(cell_cfg.sched_req.ntn_cs_koffset)); + return get_allocator_ring_size_gt_min(get_max_slot_ul_alloc_delay(cell_cfg.sched_req.ntn_cs_koffset) + + MAX_UL_PHY_DELAY); } } // namespace From 6c2f05567bcff817352ce1dbdab4048d23c4dc7e Mon Sep 17 00:00:00 2001 From: frankist Date: Thu, 19 Dec 2024 16:22:58 +0100 Subject: [PATCH 15/18] du-high: fix race condition in test mode --- lib/du/du_high/test_mode/CMakeLists.txt | 3 +- .../test_mode/mac_test_mode_adapter.cpp | 74 +++-------- .../du_high/test_mode/mac_test_mode_adapter.h | 83 +----------- .../test_mode/mac_test_mode_ue_repository.cpp | 124 ++++++++++++++++++ .../test_mode/mac_test_mode_ue_repository.h | 90 +++++++++++++ 5 files changed, 241 insertions(+), 133 deletions(-) create mode 100644 lib/du/du_high/test_mode/mac_test_mode_ue_repository.cpp create mode 100644 lib/du/du_high/test_mode/mac_test_mode_ue_repository.h diff --git a/lib/du/du_high/test_mode/CMakeLists.txt b/lib/du/du_high/test_mode/CMakeLists.txt index 1947c0d8a8..05aad2a92d 100644 --- a/lib/du/du_high/test_mode/CMakeLists.txt +++ b/lib/du/du_high/test_mode/CMakeLists.txt @@ -9,5 +9,6 @@ add_library(srsran_du_high_adapters mac_test_mode_adapter.cpp f1ap_test_mode_adapter.cpp - mac_test_mode_helpers.cpp) + mac_test_mode_helpers.cpp + mac_test_mode_ue_repository.cpp) target_link_libraries(srsran_du_high_adapters srslog srsran_support srsran_du_manager srsran_mac srsran_f1ap_du) diff --git a/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp b/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp index 98e050f236..dc025c8160 100644 --- a/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp +++ b/lib/du/du_high/test_mode/mac_test_mode_adapter.cpp @@ -65,43 +65,6 @@ size_t get_ring_size(const mac_cell_creation_request& cell_cfg) } // namespace -test_ue_info_manager::test_ue_info_manager(rnti_t rnti_start_, uint16_t nof_ues_, uint16_t nof_cells_) : - rnti_start(rnti_start_), nof_ues(nof_ues_), nof_cells(nof_cells_), pending_tasks(128) -{ -} - -void test_ue_info_manager::add_ue(rnti_t rnti, du_ue_index_t ue_idx, const sched_ue_config_request& sched_ue_cfg_req) -{ - // Dispatch creation of UE to du_cell thread. - while (not pending_tasks.try_push([this, rnti, ue_idx, sched_ue_cfg_req]() { - rnti_to_ue_info_lookup[rnti] = - test_ue_info{.ue_idx = ue_idx, .sched_ue_cfg_req = sched_ue_cfg_req, .msg4_rx_flag = false}; - })) { - srslog::fetch_basic_logger("MAC").warning("Failed to add test mode UE. Retrying..."); - } -} - -void test_ue_info_manager::remove_ue(rnti_t rnti) -{ - while (not pending_tasks.try_push([this, rnti]() { - if (rnti_to_ue_info_lookup.count(rnti) > 0) { - rnti_to_ue_info_lookup.erase(rnti); - } - })) { - srslog::fetch_basic_logger("MAC").warning("Failed to remove test mode UE. Retrying..."); - } -} - -void test_ue_info_manager::process_pending_tasks() -{ - unique_task task; - while (pending_tasks.try_pop(task)) { - task(); - } -} - -// ---- - mac_test_mode_cell_adapter::mac_test_mode_cell_adapter( const srs_du::du_test_mode_config::test_mode_ue_config& test_ue_cfg_, const mac_cell_creation_request& cell_cfg, @@ -110,7 +73,8 @@ mac_test_mode_cell_adapter::mac_test_mode_cell_adapter( mac_cell_slot_handler& slot_handler_, mac_cell_result_notifier& result_notifier_, std::function dl_bs_notifier_, - test_ue_info_manager& ue_info_mgr_) : + mac_test_mode_ue_repository& ue_info_mgr_) : + cell_index(cell_cfg.cell_index), test_ue_cfg(test_ue_cfg_), adapted(adapted_), pdu_handler(pdu_handler_), @@ -216,7 +180,7 @@ void mac_test_mode_cell_adapter::handle_crc(const mac_crc_indication_message& ms if (entry.slot == msg.sl_rx) { // Forward CRC to MAC, but remove the UCI for the test mode UE. for (mac_crc_pdu& crc : msg_copy.crcs) { - if (ue_info_mgr.is_test_ue(crc.rnti)) { + if (ue_info_mgr.is_cell_test_ue(cell_index, crc.rnti)) { // test mode UE case. // Find respective PUSCH PDU that was previously scheduled. @@ -244,10 +208,11 @@ void mac_test_mode_cell_adapter::handle_crc(const mac_crc_indication_message& ms } } else { // In case of auto-ACK mode, test mode UEs are removed from CRC. - msg_copy.crcs.erase(std::remove_if(msg_copy.crcs.begin(), - msg_copy.crcs.end(), - [this](const auto& crc) { return ue_info_mgr.is_test_ue(crc.rnti); }), - msg_copy.crcs.end()); + msg_copy.crcs.erase( + std::remove_if(msg_copy.crcs.begin(), + msg_copy.crcs.end(), + [this](const auto& crc) { return ue_info_mgr.is_cell_test_ue(cell_index, crc.rnti); }), + msg_copy.crcs.end()); } // Forward resulting CRC indication to real MAC. @@ -278,7 +243,7 @@ void mac_test_mode_cell_adapter::forward_crc_ind_to_mac(const mac_crc_indication } for (const mac_crc_pdu& pdu : crc_msg.crcs) { - if (not ue_info_mgr.is_test_ue(pdu.rnti)) { + if (not ue_info_mgr.is_cell_test_ue(cell_index, pdu.rnti)) { continue; } @@ -302,7 +267,7 @@ void mac_test_mode_cell_adapter::handle_uci(const mac_uci_indication_message& ms if (entry.slot == msg_copy.sl_rx) { // Forward UCI to MAC, but alter the UCI for the test mode UE. for (mac_uci_pdu& test_uci : msg_copy.ucis) { - if (ue_info_mgr.is_test_ue(test_uci.rnti)) { + if (ue_info_mgr.is_cell_test_ue(cell_index, test_uci.rnti)) { bool entry_found = false; if (std::holds_alternative(test_uci.pdu)) { for (const ul_sched_info& pusch : entry.puschs) { @@ -339,10 +304,11 @@ void mac_test_mode_cell_adapter::handle_uci(const mac_uci_indication_message& ms } } else { // In case of auto-ACK mode, test mode UEs are removed from UCI. - msg_copy.ucis.erase(std::remove_if(msg_copy.ucis.begin(), - msg_copy.ucis.end(), - [this](const auto& u) { return ue_info_mgr.is_test_ue(u.rnti); }), - msg_copy.ucis.end()); + msg_copy.ucis.erase( + std::remove_if(msg_copy.ucis.begin(), + msg_copy.ucis.end(), + [this](const auto& u) { return ue_info_mgr.is_cell_test_ue(cell_index, u.rnti); }), + msg_copy.ucis.end()); } // Forward UCI indication to real MAC. @@ -359,7 +325,7 @@ void mac_test_mode_cell_adapter::on_new_downlink_scheduler_results(const mac_dl_ { if (last_slot_ind != dl_res.slot) { // Process any pending tasks for the test mode UE manager asynchronously. - ue_info_mgr.process_pending_tasks(); + ue_info_mgr.process_pending_tasks(cell_index); last_slot_ind = dl_res.slot; } @@ -372,7 +338,7 @@ void mac_test_mode_cell_adapter::on_new_uplink_scheduler_results(const mac_ul_sc { if (last_slot_ind != ul_res.slot) { // Process any pending tasks for the test mode UE manager asynchronously. - ue_info_mgr.process_pending_tasks(); + ue_info_mgr.process_pending_tasks(cell_index); last_slot_ind = ul_res.slot; } @@ -387,12 +353,12 @@ void mac_test_mode_cell_adapter::on_new_uplink_scheduler_results(const mac_ul_sc // Fill the ring element with the scheduler decisions. for (const pucch_info& pucch : ul_res.ul_res->pucchs) { - if (ue_info_mgr.is_test_ue(pucch.crnti)) { + if (ue_info_mgr.is_cell_test_ue(cell_index, pucch.crnti)) { entry.pucchs.push_back(pucch); } } for (const ul_sched_info& pusch : ul_res.ul_res->puschs) { - if (ue_info_mgr.is_test_ue(pusch.pusch_cfg.rnti)) { + if (ue_info_mgr.is_cell_test_ue(cell_index, pusch.pusch_cfg.rnti)) { entry.puschs.push_back(pusch); } } @@ -400,7 +366,7 @@ void mac_test_mode_cell_adapter::on_new_uplink_scheduler_results(const mac_ul_sc if (ul_res.ul_res != nullptr and not ul_res.ul_res->pucchs.empty()) { for (const pucch_info& pucch : ul_res.ul_res->pucchs) { - if (not ue_info_mgr.is_test_ue(pucch.crnti) or ue_info_mgr.is_msg4_rxed(pucch.crnti)) { + if (not ue_info_mgr.is_cell_test_ue(cell_index, pucch.crnti) or ue_info_mgr.is_msg4_rxed(pucch.crnti)) { // UE is not test mode or it has already received Msg4. continue; } diff --git a/lib/du/du_high/test_mode/mac_test_mode_adapter.h b/lib/du/du_high/test_mode/mac_test_mode_adapter.h index 619783cdf1..88e05dc7af 100644 --- a/lib/du/du_high/test_mode/mac_test_mode_adapter.h +++ b/lib/du/du_high/test_mode/mac_test_mode_adapter.h @@ -10,8 +10,7 @@ #pragma once -#include "srsran/adt/mpmc_queue.h" -#include "srsran/adt/unique_function.h" +#include "mac_test_mode_ue_repository.h" #include "srsran/du/du_high/du_test_mode_config.h" #include "srsran/mac/mac.h" #include "srsran/mac/mac_cell_result.h" @@ -19,83 +18,10 @@ #include "srsran/scheduler/result/pusch_info.h" #include "srsran/srslog/srslog.h" #include -#include namespace srsran { namespace srs_du { -/// \brief Handles information related to the test UE(s). -class test_ue_info_manager -{ -public: - test_ue_info_manager(rnti_t rnti_start_, uint16_t nof_ues_, uint16_t nof_cells_); - - du_ue_index_t rnti_to_du_ue_idx(rnti_t rnti) const - { - if (rnti_to_ue_info_lookup.count(rnti) == 0) { - return INVALID_DU_UE_INDEX; - } - return rnti_to_ue_info_lookup.at(rnti).ue_idx; - } - - bool is_test_ue(du_ue_index_t ue_idx) const { return ue_idx < nof_ues; } - - bool is_test_ue(rnti_t rnti) const - { - return (rnti >= rnti_start) and (rnti < to_rnti(to_value(rnti_start) + nof_ues * nof_cells)); - } - - void add_ue(rnti_t rnti, du_ue_index_t ue_idx_, const sched_ue_config_request& sched_ue_cfg_req_); - - void remove_ue(rnti_t rnti); - - const sched_ue_config_request& get_sched_ue_cfg_request(rnti_t rnti) const - { - return rnti_to_ue_info_lookup.at(rnti).sched_ue_cfg_req; - } - - const sched_ue_config_request* find_sched_ue_cfg_request(rnti_t rnti) const - { - auto it = rnti_to_ue_info_lookup.find(rnti); - return it != rnti_to_ue_info_lookup.end() ? &it->second.sched_ue_cfg_req : nullptr; - } - - bool is_msg4_rxed(rnti_t rnti) const - { - if (rnti_to_ue_info_lookup.count(rnti) > 0) { - return rnti_to_ue_info_lookup.at(rnti).msg4_rx_flag; - } - return false; - } - - void msg4_rxed(rnti_t rnti, bool msg4_rx_flag_) - { - if (rnti_to_ue_info_lookup.count(rnti) > 0) { - rnti_to_ue_info_lookup.at(rnti).msg4_rx_flag = msg4_rx_flag_; - } - } - - void process_pending_tasks(); - -private: - struct test_ue_info { - du_ue_index_t ue_idx; - sched_ue_config_request sched_ue_cfg_req; - bool msg4_rx_flag; - }; - - // Parameters received from configuration. - rnti_t rnti_start; - uint16_t nof_ues; - uint16_t nof_cells; - - // Mapping between UE RNTI and test UE information. - std::unordered_map rnti_to_ue_info_lookup; - - concurrent_queue - pending_tasks; -}; - class phy_test_mode_adapter : public mac_result_notifier { public: @@ -137,7 +63,7 @@ class mac_test_mode_cell_adapter : public mac_cell_control_information_handler, mac_cell_slot_handler& slot_handler_, mac_cell_result_notifier& result_notifier_, std::function dl_bs_notifier_, - test_ue_info_manager& ue_info_mgr_); + mac_test_mode_ue_repository& ue_info_mgr_); void on_new_downlink_scheduler_results(const mac_dl_sched_result& dl_res) override; @@ -176,6 +102,7 @@ class mac_test_mode_cell_adapter : public mac_cell_control_information_handler, size_t get_ring_idx(slot_point sl) const { return sl.to_uint() % sched_decision_history.size(); } + const du_cell_index_t cell_index; const srs_du::du_test_mode_config::test_mode_ue_config& test_ue_cfg; mac_cell_control_information_handler& adapted; mac_pdu_handler& pdu_handler; @@ -186,7 +113,7 @@ class mac_test_mode_cell_adapter : public mac_cell_control_information_handler, std::vector sched_decision_history; - test_ue_info_manager& ue_info_mgr; + mac_test_mode_ue_repository& ue_info_mgr; slot_point last_slot_ind; }; @@ -253,7 +180,7 @@ class mac_test_mode_adapter final : public mac_interface, srs_du::du_test_mode_config::test_mode_ue_config test_ue; std::unique_ptr mac_adapted; - test_ue_info_manager ue_info_mgr; + mac_test_mode_ue_repository ue_info_mgr; std::unique_ptr phy_notifier; diff --git a/lib/du/du_high/test_mode/mac_test_mode_ue_repository.cpp b/lib/du/du_high/test_mode/mac_test_mode_ue_repository.cpp new file mode 100644 index 0000000000..14e4be2bd0 --- /dev/null +++ b/lib/du/du_high/test_mode/mac_test_mode_ue_repository.cpp @@ -0,0 +1,124 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#include "mac_test_mode_ue_repository.h" +#include "srsran/srslog/srslog.h" +#include "srsran/support/srsran_assert.h" + +using namespace srsran; + +mac_test_mode_ue_repository::mac_test_mode_ue_repository(rnti_t rnti_start_, uint16_t nof_ues_, uint16_t nof_cells) : + rnti_start(static_cast(rnti_start_)), nof_ues(nof_ues_), rnti_end(rnti_start + nof_ues * nof_cells) +{ + cells.reserve(nof_cells); + for (unsigned i = 0, e = nof_cells; i < e; ++i) { + cells.emplace_back(std::make_unique(128U)); + } +} + +unsigned mac_test_mode_ue_repository::get_cell_index(du_ue_index_t ue_index) const +{ + unsigned cell_idx = static_cast(ue_index) / nof_ues; + srsran_assert(cell_idx < cells.size(), "Invalid UE index {}", fmt::underlying(ue_index)); + return cell_idx; +} + +unsigned mac_test_mode_ue_repository::get_cell_index(rnti_t rnti) const +{ + unsigned rnti_idx = static_cast(rnti) - static_cast(rnti_start); + unsigned cell_idx = rnti_idx / nof_ues; + srsran_assert(cell_idx < cells.size(), "Invalid RNTI {}", rnti); + return cell_idx; +} + +du_ue_index_t mac_test_mode_ue_repository::rnti_to_du_ue_idx(rnti_t rnti) const +{ + unsigned cell_idx = get_cell_index(rnti); + auto it = cells[cell_idx]->rnti_to_ue_info_lookup.find(rnti); + if (it == cells[cell_idx]->rnti_to_ue_info_lookup.end()) { + return INVALID_DU_UE_INDEX; + } + return it->second.ue_idx; +} + +const sched_ue_config_request& mac_test_mode_ue_repository::get_sched_ue_cfg_request(rnti_t rnti) const +{ + return cells[get_cell_index(rnti)]->rnti_to_ue_info_lookup.at(rnti).sched_ue_cfg_req; +} + +const sched_ue_config_request* mac_test_mode_ue_repository::find_sched_ue_cfg_request(rnti_t rnti) const +{ + unsigned cell_idx = get_cell_index(rnti); + auto it = cells[cell_idx]->rnti_to_ue_info_lookup.find(rnti); + return it != cells[cell_idx]->rnti_to_ue_info_lookup.end() ? &it->second.sched_ue_cfg_req : nullptr; +} + +bool mac_test_mode_ue_repository::is_msg4_rxed(rnti_t rnti) const +{ + unsigned cell_idx = get_cell_index(rnti); + if (cells[cell_idx]->rnti_to_ue_info_lookup.count(rnti) > 0) { + return cells[cell_idx]->rnti_to_ue_info_lookup.at(rnti).msg4_rx_flag; + } + return false; +} + +void mac_test_mode_ue_repository::msg4_rxed(rnti_t rnti, bool msg4_rx_flag_) +{ + unsigned cell_idx = get_cell_index(rnti); + if (cells[cell_idx]->rnti_to_ue_info_lookup.count(rnti) > 0) { + cells[cell_idx]->rnti_to_ue_info_lookup.at(rnti).msg4_rx_flag = msg4_rx_flag_; + } +} + +void mac_test_mode_ue_repository::add_ue(rnti_t rnti, + du_ue_index_t ue_idx, + const sched_ue_config_request& sched_ue_cfg_req) +{ + if (not is_test_ue(rnti) or not is_test_ue(ue_idx)) { + return; + } + unsigned rnti_idx = static_cast(rnti) - static_cast(rnti_start); + srsran_assert(rnti_idx == static_cast(ue_idx), + "rnti={}, ue={}: Invalid test mode UE identifiers", + rnti, + fmt::underlying(ue_idx)); + + unsigned cell_idx = get_cell_index(ue_idx); + + // Dispatch creation of UE to du_cell thread. + while (not cells[cell_idx]->pending_tasks.try_push([this, rnti, ue_idx, sched_ue_cfg_req]() { + unsigned idx = get_cell_index(ue_idx); + cells[idx]->rnti_to_ue_info_lookup[rnti] = + test_ue_info{.ue_idx = ue_idx, .sched_ue_cfg_req = sched_ue_cfg_req, .msg4_rx_flag = false}; + })) { + srslog::fetch_basic_logger("MAC").warning("Failed to add test mode UE. Retrying..."); + } +} + +void mac_test_mode_ue_repository::remove_ue(rnti_t rnti) +{ + unsigned cell_idx = get_cell_index(rnti); + while (not cells[cell_idx]->pending_tasks.try_push([this, rnti]() { + unsigned idx = get_cell_index(rnti); + if (cells[idx]->rnti_to_ue_info_lookup.count(rnti) > 0) { + cells[idx]->rnti_to_ue_info_lookup.erase(rnti); + } + })) { + srslog::fetch_basic_logger("MAC").warning("Failed to remove test mode UE. Retrying..."); + } +} + +void mac_test_mode_ue_repository::process_pending_tasks(du_cell_index_t cell_index) +{ + unique_task task; + while (cells[cell_index]->pending_tasks.try_pop(task)) { + task(); + } +} diff --git a/lib/du/du_high/test_mode/mac_test_mode_ue_repository.h b/lib/du/du_high/test_mode/mac_test_mode_ue_repository.h new file mode 100644 index 0000000000..fbae3d444f --- /dev/null +++ b/lib/du/du_high/test_mode/mac_test_mode_ue_repository.h @@ -0,0 +1,90 @@ +/* + * + * Copyright 2021-2024 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +#include "srsran/adt/mpmc_queue.h" +#include "srsran/adt/unique_function.h" +#include "srsran/ran/du_types.h" +#include "srsran/ran/rnti.h" +#include "srsran/scheduler/scheduler_configurator.h" +#include +#include + +namespace srsran { + +/// \brief Handles information related to the test UE(s). +class mac_test_mode_ue_repository +{ +public: + mac_test_mode_ue_repository(rnti_t rnti_start_, uint16_t nof_ues_, uint16_t nof_cells_); + + bool is_test_ue(du_ue_index_t ue_idx) const { return ue_idx < nof_ues * cells.size(); } + + bool is_test_ue(rnti_t rnti) const + { + uint16_t rnti_val = static_cast(rnti); + return rnti_val >= rnti_start and rnti_val < rnti_end; + } + + bool is_cell_test_ue(du_cell_index_t cell_idx, rnti_t rnti) const + { + unsigned rnti_val = static_cast(rnti) - rnti_start; + return rnti_val / nof_ues == cell_idx; + } + + const sched_ue_config_request& get_sched_ue_cfg_request(rnti_t rnti) const; + + const sched_ue_config_request* find_sched_ue_cfg_request(rnti_t rnti) const; + + bool is_msg4_rxed(rnti_t rnti) const; + + void msg4_rxed(rnti_t rnti, bool msg4_rx_flag_); + + void add_ue(rnti_t rnti, du_ue_index_t ue_idx_, const sched_ue_config_request& sched_ue_cfg_req_); + + void remove_ue(rnti_t rnti); + + void process_pending_tasks(du_cell_index_t cell_index); + + du_ue_index_t rnti_to_du_ue_idx(rnti_t rnti) const; + +private: + using cell_event_queue = + concurrent_queue; + + struct test_ue_info { + du_ue_index_t ue_idx; + sched_ue_config_request sched_ue_cfg_req; + bool msg4_rx_flag; + }; + + struct cell_info { + cell_event_queue pending_tasks; + // Mapping between UE RNTI and test UE information. + std::unordered_map rnti_to_ue_info_lookup; + + cell_info(unsigned qsize) : pending_tasks(qsize) {} + }; + + unsigned get_cell_index(du_ue_index_t ue_index) const; + unsigned get_cell_index(rnti_t rnti) const; + + // Parameters received from configuration. + const uint16_t rnti_start; + const uint16_t nof_ues; + + // Derived + uint16_t rnti_end; + + std::vector> cells; +}; + +} // namespace srsran From 3303ce11d80ab08e0355945cfbaeb133f3c0d2c2 Mon Sep 17 00:00:00 2001 From: frankist Date: Thu, 19 Dec 2024 19:01:21 +0100 Subject: [PATCH 16/18] sched: fix stack overflow in scheduler --- lib/mac/mac_sched/uci_cell_decoder.cpp | 3 ++- lib/mac/mac_sched/uci_cell_decoder.h | 2 +- lib/scheduler/logging/scheduler_metric_handler.cpp | 4 ++-- lib/scheduler/logging/scheduler_metrics_handler.h | 4 ++-- lib/scheduler/scheduler_impl.h | 2 -- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/mac/mac_sched/uci_cell_decoder.cpp b/lib/mac/mac_sched/uci_cell_decoder.cpp index eca82a2073..ae931d789e 100644 --- a/lib/mac/mac_sched/uci_cell_decoder.cpp +++ b/lib/mac/mac_sched/uci_cell_decoder.cpp @@ -21,7 +21,8 @@ uci_cell_decoder::uci_cell_decoder(const sched_cell_configuration_request_messag rnti_table(rnti_table_), cell_index(cell_cfg.cell_index), rlf_handler(rlf_hdlr_), - logger(srslog::fetch_basic_logger("MAC")) + logger(srslog::fetch_basic_logger("MAC")), + expected_uci_report_grid(MAX_GRID_SIZE) { } diff --git a/lib/mac/mac_sched/uci_cell_decoder.h b/lib/mac/mac_sched/uci_cell_decoder.h index b22ea2b024..8ef58aafe2 100644 --- a/lib/mac/mac_sched/uci_cell_decoder.h +++ b/lib/mac/mac_sched/uci_cell_decoder.h @@ -55,7 +55,7 @@ class uci_cell_decoder rlf_detector& rlf_handler; srslog::basic_logger& logger; - std::array, MAX_GRID_SIZE> expected_uci_report_grid; + std::vector> expected_uci_report_grid; }; } // namespace srsran diff --git a/lib/scheduler/logging/scheduler_metric_handler.cpp b/lib/scheduler/logging/scheduler_metric_handler.cpp index f30a8ebad1..1a963c8c76 100644 --- a/lib/scheduler/logging/scheduler_metric_handler.cpp +++ b/lib/scheduler/logging/scheduler_metric_handler.cpp @@ -410,7 +410,7 @@ cell_metrics_handler* scheduler_metrics_handler::add_cell(const cell_configurati return nullptr; } - cells.emplace(cell_cfg.cell_index, report_period, notifier, cell_cfg); + cells.emplace(cell_cfg.cell_index, std::make_unique(report_period, notifier, cell_cfg)); - return &cells[cell_cfg.cell_index]; + return cells[cell_cfg.cell_index].get(); } diff --git a/lib/scheduler/logging/scheduler_metrics_handler.h b/lib/scheduler/logging/scheduler_metrics_handler.h index c8175476b3..011af3954e 100644 --- a/lib/scheduler/logging/scheduler_metrics_handler.h +++ b/lib/scheduler/logging/scheduler_metrics_handler.h @@ -192,13 +192,13 @@ class scheduler_metrics_handler cell_metrics_handler* add_cell(const cell_configuration& cell_cfg); - cell_metrics_handler& at(du_cell_index_t cell_idx) { return cells[cell_idx]; } + cell_metrics_handler& at(du_cell_index_t cell_idx) { return *cells[cell_idx]; } private: scheduler_metrics_notifier& notifier; const std::chrono::milliseconds report_period; - slotted_array cells; + slotted_array, MAX_NOF_DU_CELLS> cells; }; } // namespace srsran diff --git a/lib/scheduler/scheduler_impl.h b/lib/scheduler/scheduler_impl.h index 578be45334..90c46c1abc 100644 --- a/lib/scheduler/scheduler_impl.h +++ b/lib/scheduler/scheduler_impl.h @@ -12,9 +12,7 @@ #include "cell_scheduler.h" #include "config/sched_config_manager.h" -#include "logging/scheduler_event_logger.h" #include "logging/scheduler_metrics_handler.h" -#include "logging/scheduler_result_logger.h" #include "ue_scheduling/ue_scheduler.h" #include "srsran/scheduler/config/scheduler_expert_config.h" #include "srsran/scheduler/mac_scheduler.h" From 1256f31061e5f5a48b68670d9657f0018e8f7e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfredo=20S=C3=A1ez?= Date: Thu, 19 Dec 2024 16:37:44 +0100 Subject: [PATCH 17/18] ci: fix run_viavi_pipeline script --- .gitlab/run_viavi_pipeline.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab/run_viavi_pipeline.py b/.gitlab/run_viavi_pipeline.py index 4d257b59ef..22f0cb702e 100755 --- a/.gitlab/run_viavi_pipeline.py +++ b/.gitlab/run_viavi_pipeline.py @@ -134,6 +134,8 @@ def run_test(args_definition: _ArgsDefinition, test_definition: _TestDefinition) {"key": "TEST_MODE", "value": TESTMODE}, {"key": "BUILD_ARGS", "value": BUILD_ARGS}, {"key": "MAKE_ARGS", "value": MAKE_ARGS}, + {"key": "SRS_TARGET", "value": "gnb_split_7_2"}, + {"key": "PLUGIN_BRANCH", "value": "main"}, {"key": "UHD_VERSION", "value": ""}, {"key": "DPDK_VERSION", "value": DPDK_VERSION}, {"key": "TESTBED", "value": TESTBED}, From 93c93e84465e2a8d25d25ff94f5e4129f6eb430d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfredo=20S=C3=A1ez?= Date: Thu, 19 Dec 2024 15:42:15 +0000 Subject: [PATCH 18/18] ci,e2e: fix drx job name --- .gitlab/ci/e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/e2e.yml b/.gitlab/ci/e2e.yml index 0e9f521058..561a6544f8 100644 --- a/.gitlab/ci/e2e.yml +++ b/.gitlab/ci/e2e.yml @@ -473,7 +473,7 @@ android x300: artifacts: true - *retina-needs -android x300 drx: +android drx: stage: rf extends: .e2e-run allow_failure: true