Skip to content

Commit ac3eed8

Browse files
alvasMancodebot
authored andcommitted
gtpu: add warn on drop config
1 parent 3cbecb3 commit ac3eed8

File tree

10 files changed

+47
-9
lines changed

10 files changed

+47
-9
lines changed

apps/gnb/gnb_appconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ struct cu_cp_appconfig {
711711
struct cu_up_appconfig {
712712
unsigned gtpu_queue_size = 2048;
713713
unsigned gtpu_reordering_timer_ms = 0;
714+
bool warn_on_drop = false;
714715
};
715716

716717
/// Configuration of logging functionalities.

apps/gnb/gnb_appconfig_cli11_schema.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ static void configure_cli11_cu_up_args(CLI::App& app, cu_up_appconfig& cu_up_par
430430
cu_up_params.gtpu_reordering_timer_ms,
431431
"GTP-U RX reordering timer (in milliseconds)")
432432
->capture_default_str();
433+
app.add_option("--warn_on_drop",
434+
cu_up_params.warn_on_drop,
435+
"Log a warning for dropped packets in GTP-U and PDCP due to full queues")
436+
->capture_default_str();
433437
}
434438

435439
static void configure_cli11_expert_phy_args(CLI::App& app, expert_upper_phy_appconfig& expert_phy_params)

apps/gnb/gnb_appconfig_translators.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ srs_cu_up::cu_up_configuration srsran::generate_cu_up_config(const gnb_appconfig
261261
srs_cu_up::cu_up_configuration out_cfg;
262262
out_cfg.statistics_report_period = std::chrono::seconds{config.metrics_cfg.cu_up_statistics_report_period};
263263
out_cfg.n3_cfg.gtpu_reordering_timer = std::chrono::milliseconds{config.cu_up_cfg.gtpu_reordering_timer_ms};
264+
out_cfg.n3_cfg.warn_on_drop = config.cu_up_cfg.warn_on_drop;
264265

265266
if (config.amf_cfg.n3_bind_addr == "auto") {
266267
out_cfg.net_cfg.n3_bind_addr = config.amf_cfg.bind_addr;

include/srsran/cu_up/cu_up_configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct network_interface_config {
4848

4949
struct n3_interface_config {
5050
std::chrono::milliseconds gtpu_reordering_timer; // N3 reordering timer
51+
bool warn_on_drop;
5152
};
5253

5354
struct e1ap_config_params {

include/srsran/gtpu/gtpu_demux.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
namespace srsran {
1818

19+
struct gtpu_demux_cfg_t {
20+
bool warn_on_drop;
21+
};
22+
1923
/// The GTP-U demux component will only be relevant for the reception and de-multiplexing
2024
/// of GTP-U packets. It does not require Tx capabilities as the corresponding GTP-U entities
2125
/// will already be calling the corresponding UDP network gateway.

include/srsran/gtpu/gtpu_demux_factory.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
namespace srsran {
1919

2020
struct gtpu_demux_creation_request {
21-
task_executor* cu_up_exec = nullptr;
22-
dlt_pcap* gtpu_pcap = nullptr;
21+
gtpu_demux_cfg_t cfg = {};
22+
task_executor* cu_up_exec = nullptr;
23+
dlt_pcap* gtpu_pcap = nullptr;
2324
};
2425

2526
/// Creates an instance of an GTP-U demux object.

lib/cu_up/cu_up_impl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ cu_up::cu_up(const cu_up_configuration& config_) : cfg(config_), main_ctrl_loop(
5353

5454
// Create GTP-U demux
5555
gtpu_demux_creation_request demux_msg = {};
56+
demux_msg.cfg.warn_on_drop = cfg.n3_cfg.warn_on_drop;
5657
demux_msg.cu_up_exec = cfg.dl_executor;
5758
demux_msg.gtpu_pcap = cfg.gtpu_pcap;
5859
ngu_demux = create_gtpu_demux(demux_msg);

lib/gtpu/gtpu_demux_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ std::unique_ptr<gtpu_demux> srsran::create_gtpu_demux(const gtpu_demux_creation_
1717
{
1818
report_fatal_error_if_not(msg.cu_up_exec, "CU-UP exec is uninitialized");
1919
report_fatal_error_if_not(msg.gtpu_pcap, "CU-UP exec is uninitialized");
20-
return std::make_unique<gtpu_demux_impl>(*msg.cu_up_exec, *msg.gtpu_pcap);
20+
return std::make_unique<gtpu_demux_impl>(msg.cfg, *msg.cu_up_exec, *msg.gtpu_pcap);
2121
}

lib/gtpu/gtpu_demux_impl.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
using namespace srsran;
1616

17-
gtpu_demux_impl::gtpu_demux_impl(task_executor& cu_up_exec_, dlt_pcap& gtpu_pcap_) :
18-
cu_up_exec(cu_up_exec_), gtpu_pcap(gtpu_pcap_), logger(srslog::fetch_basic_logger("GTPU"))
17+
gtpu_demux_impl::gtpu_demux_impl(gtpu_demux_cfg_t cfg_, task_executor& cu_up_exec_, dlt_pcap& gtpu_pcap_) :
18+
cfg(cfg_), cu_up_exec(cu_up_exec_), gtpu_pcap(gtpu_pcap_), logger(srslog::fetch_basic_logger("GTPU"))
1919
{
20+
logger.info("GTP-U demux. {}", cfg);
2021
}
2122

2223
bool gtpu_demux_impl::add_tunnel(gtpu_teid_t teid, gtpu_tunnel_rx_upper_layer_interface* tunnel)
@@ -53,7 +54,11 @@ void gtpu_demux_impl::handle_pdu(byte_buffer pdu, const sockaddr_storage& src_ad
5354
handle_pdu_impl(gtpu_teid_t{teid}, std::move(p), src_addr);
5455
};
5556
if (not cu_up_exec.execute(std::move(fn))) {
56-
logger.info("Dropped GTP-U PDU, queue is full. teid={}", teid);
57+
if (not cfg.warn_on_drop) {
58+
logger.info("Dropped GTP-U PDU, queue is full. teid={}", teid);
59+
} else {
60+
logger.warning("Dropped GTP-U PDU, queue is full. teid={}", teid);
61+
}
5762
}
5863
}
5964

lib/gtpu/gtpu_demux_impl.h

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "srsran/gtpu/gtpu_demux.h"
1414
#include "srsran/pcap/dlt_pcap.h"
1515
#include "srsran/support/executors/task_executor.h"
16+
#include "fmt/format.h"
1617
#include <memory>
1718
#include <unordered_map>
1819

@@ -21,7 +22,7 @@ namespace srsran {
2122
class gtpu_demux_impl final : public gtpu_demux
2223
{
2324
public:
24-
explicit gtpu_demux_impl(task_executor& cu_up_exec, dlt_pcap& gtpu_pcap_);
25+
explicit gtpu_demux_impl(gtpu_demux_cfg_t cfg_, task_executor& cu_up_exec, dlt_pcap& gtpu_pcap_);
2526
~gtpu_demux_impl() = default;
2627

2728
// gtpu_demux_rx_upper_layer_interface
@@ -35,8 +36,9 @@ class gtpu_demux_impl final : public gtpu_demux
3536
// Actual demuxing, to be run in CU-UP executor.
3637
void handle_pdu_impl(gtpu_teid_t teid, byte_buffer pdu, const sockaddr_storage& src_addr);
3738

38-
task_executor& cu_up_exec;
39-
dlt_pcap& gtpu_pcap;
39+
const gtpu_demux_cfg_t cfg;
40+
task_executor& cu_up_exec;
41+
dlt_pcap& gtpu_pcap;
4042

4143
///< TODO: revisit mapping of TEID to executors, one executor per UE should be doable.
4244
std::unordered_map<gtpu_teid_t, gtpu_tunnel_rx_upper_layer_interface*, gtpu_teid_hasher_t> teid_to_tunnel;
@@ -45,3 +47,21 @@ class gtpu_demux_impl final : public gtpu_demux
4547
};
4648

4749
} // namespace srsran
50+
51+
namespace fmt {
52+
// GTP-U demux config formatter
53+
template <>
54+
struct formatter<srsran::gtpu_demux_cfg_t> {
55+
template <typename ParseContext>
56+
auto parse(ParseContext& ctx) -> decltype(ctx.begin())
57+
{
58+
return ctx.begin();
59+
}
60+
61+
template <typename FormatContext>
62+
auto format(srsran::gtpu_demux_cfg_t cfg, FormatContext& ctx) -> decltype(std::declval<FormatContext>().out())
63+
{
64+
return format_to(ctx.out(), "warn_on_drop={}", cfg.warn_on_drop);
65+
}
66+
};
67+
} // namespace fmt

0 commit comments

Comments
 (0)