Skip to content

Commit 8c860bd

Browse files
committed
gnb: add the promiscuous flag to the gNB app configuration.
Defined defaults value for the expert threads configuration
1 parent 6485bce commit 8c860bd

16 files changed

+108
-53
lines changed

apps/gnb/gnb_appconfig.h

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ struct expert_upper_phy_appconfig {
741741
/// Higher values increase the downlink processing pipeline length, which improves performance and stability for
742742
/// demanding cell configurations, such as using large bandwidths or higher order MIMO. Higher values also increase
743743
/// the round trip latency of the radio link.
744-
unsigned max_processing_delay_slots = 2U;
744+
unsigned max_processing_delay_slots = 5U;
745745
/// Number of PUSCH LDPC decoder iterations.
746746
unsigned pusch_decoder_max_iterations = 6;
747747
/// Set to true to enable the PUSCH LDPC decoder early stop.
@@ -887,6 +887,8 @@ struct ru_ofh_cell_appconfig {
887887
ru_ofh_base_cell_appconfig cell;
888888
/// Ethernet network interface name.
889889
std::string network_interface = "enp1s0f0";
890+
/// Promiscuous mode flag.
891+
bool enable_promiscuous_mode = true;
890892
/// Radio Unit MAC address.
891893
std::string ru_mac_address = "70:b3:d5:e1:5b:06";
892894
/// Distributed Unit MAC address.
@@ -962,15 +964,6 @@ struct upper_phy_threads_appconfig {
962964

963965
/// Lower PHY thread configuration fo the gNB.
964966
struct lower_phy_threads_appconfig {
965-
lower_phy_threads_appconfig()
966-
{
967-
// Set the lower PHY thread profile according to the number of CPU cores.
968-
if (srsran::compute_host_nof_hardware_threads() >= 8U) {
969-
execution_profile = lower_phy_thread_profile::quad;
970-
} else {
971-
execution_profile = lower_phy_thread_profile::dual;
972-
}
973-
}
974967
/// \brief Lower physical layer thread profile.
975968
///
976969
/// If not configured, a default value is selected based on the number of available CPU cores.
@@ -984,6 +977,41 @@ struct ofh_threads_appconfig {
984977

985978
/// Expert threads configuration of the gNB app.
986979
struct expert_threads_appconfig {
980+
expert_threads_appconfig()
981+
{
982+
unsigned nof_threads = compute_host_nof_hardware_threads();
983+
984+
if (nof_threads < 4) {
985+
upper_threads.nof_ul_threads = 1;
986+
upper_threads.nof_pusch_decoder_threads = 0;
987+
upper_threads.nof_pdsch_threads = 1;
988+
upper_threads.nof_dl_threads = 1;
989+
lower_threads.execution_profile = lower_phy_thread_profile::single;
990+
ofh_threads.is_downlink_parallelized = false;
991+
} else if (nof_threads < 8) {
992+
upper_threads.nof_ul_threads = 1;
993+
upper_threads.nof_pusch_decoder_threads = 1;
994+
upper_threads.nof_pdsch_threads = 2;
995+
upper_threads.nof_dl_threads = 2;
996+
lower_threads.execution_profile = lower_phy_thread_profile::dual;
997+
ofh_threads.is_downlink_parallelized = true;
998+
} else if (nof_threads < 16) {
999+
upper_threads.nof_ul_threads = 1;
1000+
upper_threads.nof_pusch_decoder_threads = 1;
1001+
upper_threads.nof_pdsch_threads = 4;
1002+
upper_threads.nof_dl_threads = 2;
1003+
lower_threads.execution_profile = lower_phy_thread_profile::quad;
1004+
ofh_threads.is_downlink_parallelized = true;
1005+
} else {
1006+
upper_threads.nof_ul_threads = 2;
1007+
upper_threads.nof_pusch_decoder_threads = 2;
1008+
upper_threads.nof_pdsch_threads = 8;
1009+
upper_threads.nof_dl_threads = 4;
1010+
lower_threads.execution_profile = lower_phy_thread_profile::quad;
1011+
ofh_threads.is_downlink_parallelized = true;
1012+
}
1013+
}
1014+
9871015
/// Upper PHY thread configuration of the gNB app.
9881016
upper_phy_threads_appconfig upper_threads;
9891017
/// Lower PHY thread configuration of the gNB app.

apps/gnb/gnb_appconfig_cli11_schema.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,8 @@ static void configure_cli11_ru_ofh_cells_args(CLI::App& app, ru_ofh_cell_appconf
16441644
{
16451645
configure_cli11_ru_ofh_base_cell_args(app, config.cell);
16461646
app.add_option("--network_interface", config.network_interface, "Network interface")->capture_default_str();
1647+
app.add_option("--enable_promiscuous", config.enable_promiscuous_mode, "Promiscuous mode flag")
1648+
->capture_default_str();
16471649
app.add_option("--ru_mac_addr", config.ru_mac_address, "Radio Unit MAC address")->capture_default_str();
16481650
app.add_option("--du_mac_addr", config.du_mac_address, "Distributed Unit MAC address")->capture_default_str();
16491651
app.add_option("--vlan_tag", config.vlan_tag, "V-LAN identifier")->capture_default_str()->check(CLI::Range(1, 4094));

apps/gnb/gnb_appconfig_translators.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,8 @@ generate_ru_ofh_config(ru_ofh_configuration& out_cfg, const gnb_appconfig& confi
11571157
out_cfg.sector_configs.emplace_back();
11581158
ru_ofh_sector_configuration& sector_cfg = out_cfg.sector_configs.back();
11591159

1160-
sector_cfg.interface = cell_cfg.network_interface;
1160+
sector_cfg.interface = cell_cfg.network_interface;
1161+
sector_cfg.is_promiscuous_mode_enabled = cell_cfg.enable_promiscuous_mode;
11611162
if (!parse_mac_address(cell_cfg.du_mac_address, sector_cfg.mac_src_address)) {
11621163
srsran_terminate("Invalid Distributed Unit MAC address");
11631164
}

include/srsran/ofh/ethernet/ethernet_factories.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ std::unique_ptr<gateway> create_gateway(const gw_config& config, srslog::basic_l
3131

3232
/// Creates an Ethernet receiver.
3333
std::unique_ptr<receiver> create_receiver(const std::string& interface,
34+
bool is_promiscuous_mode_enabled,
3435
task_executor& executor,
3536
frame_notifier& notifier,
3637
srslog::basic_logger& logger);

include/srsran/ofh/ethernet/ethernet_gw_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ namespace ether {
1919
struct gw_config {
2020
/// Interface name.
2121
std::string interface;
22+
/// Promiscuous mode flag.
23+
bool is_promiscuous_mode_enabled;
2224
/// Destination MAC address.
2325
mac_address mac_dst_address;
2426
};

include/srsran/ofh/ofh_sector_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ struct sector_configuration {
4242

4343
/// Ethernet interface name.
4444
std::string interface;
45+
/// Promiscuous mode flag.
46+
bool is_promiscuous_mode_enabled;
4547
/// Destination MAC address, corresponds to the Radio Unit MAC address.
4648
ether::mac_address mac_dst_address;
4749
/// Source MAC address, corresponds to the Distributed Unit MAC address.

include/srsran/ru/ru_ofh_configuration.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ struct ru_ofh_sector_configuration {
6868

6969
/// Ethernet interface name.
7070
std::string interface;
71+
/// Promiscuous mode flag.
72+
bool is_promiscuous_mode_enabled;
7173
/// Destination MAC address, corresponds to Radio Unit MAC address.
7274
ether::mac_address mac_dst_address;
7375
/// Source MAC address, corresponds to Distributed Unit MAC address.

lib/ofh/ethernet/dpdk/dpdk_ethernet_factories.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
using namespace srsran;
1616
using namespace ether;
1717

18-
std::unique_ptr<gateway> srsran::ether::create_dpdk_gateway(srslog::basic_logger& logger)
18+
std::unique_ptr<gateway> srsran::ether::create_dpdk_gateway(const gw_config& config, srslog::basic_logger& logger)
1919
{
20-
return std::make_unique<dpdk_transmitter_impl>(logger);
20+
return std::make_unique<dpdk_transmitter_impl>(config, logger);
2121
}
2222

2323
std::unique_ptr<receiver>

lib/ofh/ethernet/dpdk/dpdk_ethernet_factories.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ class task_executor;
2222
namespace ether {
2323

2424
class frame_notifier;
25+
struct gw_config;
2526

2627
/// Creates a DPDK Ethernet gateway.
27-
std::unique_ptr<gateway> create_dpdk_gateway(srslog::basic_logger& logger);
28+
std::unique_ptr<gateway> create_dpdk_gateway(const gw_config& config, srslog::basic_logger& logger);
2829

2930
/// Creates a DPDK Ethernet receiver.
3031
std::unique_ptr<receiver>

lib/ofh/ethernet/dpdk/dpdk_ethernet_transmitter.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "dpdk_ethernet_transmitter.h"
1212
#include "srsran/adt/static_vector.h"
13+
#include "srsran/ofh/ethernet/ethernet_gw_config.h"
1314
#include <rte_ethdev.h>
1415

1516
using namespace srsran;
@@ -24,7 +25,7 @@ static constexpr unsigned TX_RING_SIZE = 1024;
2425
static constexpr unsigned NUM_MBUFS = 8191;
2526

2627
/// DPDK port initialization routine.
27-
static bool port_init(::rte_mempool* mbuf_pool, unsigned port)
28+
static bool port_init(const gw_config& config, ::rte_mempool* mbuf_pool, unsigned port)
2829
{
2930
uint16_t nb_rxd = RX_RING_SIZE;
3031
uint16_t nb_txd = TX_RING_SIZE;
@@ -84,16 +85,18 @@ static bool port_init(::rte_mempool* mbuf_pool, unsigned port)
8485
}
8586

8687
// Enable RX in promiscuous mode for the Ethernet device.
87-
if (::rte_eth_promiscuous_enable(port) != 0) {
88-
fmt::print("Error enabling promiscuous mode\n");
89-
return false;
88+
if (config.is_promiscuous_mode_enabled) {
89+
if (::rte_eth_promiscuous_enable(port) != 0) {
90+
fmt::print("Error enabling promiscuous mode\n");
91+
return false;
92+
}
9093
}
9194

9295
return true;
9396
}
9497

9598
/// Configures an Ethernet port using DPDK.
96-
static void dpdk_port_configure(::rte_mempool*& mbuf_pool)
99+
static void dpdk_port_configure(const gw_config& config, ::rte_mempool*& mbuf_pool)
97100
{
98101
if (::rte_eth_dev_count_avail() != 1) {
99102
::rte_exit(EXIT_FAILURE, "Error: number of ports must be one\n");
@@ -110,7 +113,7 @@ static void dpdk_port_configure(::rte_mempool*& mbuf_pool)
110113
unsigned portid;
111114
RTE_ETH_FOREACH_DEV(portid)
112115
{
113-
if (!port_init(mbuf_pool, portid)) {
116+
if (!port_init(config, mbuf_pool, portid)) {
114117
::rte_exit(EXIT_FAILURE, "Cannot init port\n");
115118
}
116119
}
@@ -143,7 +146,7 @@ void dpdk_transmitter_impl::send(span<span<const uint8_t>> frames)
143146
::rte_eth_tx_burst(port_id, 0, mbufs.data(), mbufs.size());
144147
}
145148

146-
dpdk_transmitter_impl::dpdk_transmitter_impl(srslog::basic_logger& logger_) : logger(logger_)
149+
dpdk_transmitter_impl::dpdk_transmitter_impl(const gw_config& config, srslog::basic_logger& logger_) : logger(logger_)
147150
{
148-
dpdk_port_configure(mbuf_pool);
151+
dpdk_port_configure(config, mbuf_pool);
149152
}

0 commit comments

Comments
 (0)