From c5396155adc6ea11fd264d98d837ce6a5692064a Mon Sep 17 00:00:00 2001 From: Francisco Date: Wed, 5 May 2021 13:31:42 +0100 Subject: [PATCH] set default gtpu tunnel close timeout to infinity --- .../srsran/interfaces/enb_gtpu_interfaces.h | 2 +- srsenb/enb.conf.example | 4 ++-- srsenb/src/main.cc | 2 +- srsenb/src/stack/upper/gtpu.cc | 20 ++++++++++--------- srsenb/test/upper/gtpu_test.cc | 9 +++++---- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/lib/include/srsran/interfaces/enb_gtpu_interfaces.h b/lib/include/srsran/interfaces/enb_gtpu_interfaces.h index a09aaf00b..c88edac4d 100644 --- a/lib/include/srsran/interfaces/enb_gtpu_interfaces.h +++ b/lib/include/srsran/interfaces/enb_gtpu_interfaces.h @@ -24,7 +24,7 @@ struct gtpu_args_t { std::string embms_m1u_multiaddr; std::string embms_m1u_if_addr; bool embms_enable = false; - uint32_t indirect_tunnel_timeout_msec = 2000; + uint32_t indirect_tunnel_timeout_msec = 0; }; // GTPU interface for PDCP diff --git a/srsenb/enb.conf.example b/srsenb/enb.conf.example index 507aa86a9..ce64a9dae 100644 --- a/srsenb/enb.conf.example +++ b/srsenb/enb.conf.example @@ -307,7 +307,7 @@ enable = false # nof_prealloc_ues: Number of UE memory resources to preallocate during eNB initialization for faster UE creation (Default 8) # eea_pref_list: Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1). # eia_pref_list: Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0). -# gtpu_tunnel_timeout: Maximum time that GTPU takes to release indirect forwarding tunnel since the last received GTPU PDU. +# gtpu_tunnel_timeout: Time that GTPU takes to release indirect forwarding tunnel since the last received GTPU PDU (0 for no timer). # ##################################################################### [expert] @@ -332,4 +332,4 @@ enable = false #nof_prealloc_ues = 8 #eea_pref_list = EEA0, EEA2, EEA1 #eia_pref_list = EIA2, EIA1, EIA0 -#gtpu_tunnel_timeout = 2000 +#gtpu_tunnel_timeout = 0 diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 446e60847..a4e56f6cb 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -217,7 +217,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) ("expert.nof_prealloc_ues", bpo::value(&args->stack.mac.nof_prealloc_ues)->default_value(8), "Number of UE resources to preallocate during eNB initialization") ("expert.max_mac_dl_kos", bpo::value(&args->general.max_mac_dl_kos)->default_value(100), "Maximum number of consecutive KOs in DL before triggering the UE's release") ("expert.max_mac_ul_kos", bpo::value(&args->general.max_mac_ul_kos)->default_value(100), "Maximum number of consecutive KOs in UL before triggering the UE's release") - ("expert.gtpu_tunnel_timeout", bpo::value(&args->stack.gtpu_indirect_tunnel_timeout_msec)->default_value(2000), "Maximum time that GTPU takes to release indirect forwarding tunnel since the last received GTPU PDU.") + ("expert.gtpu_tunnel_timeout", bpo::value(&args->stack.gtpu_indirect_tunnel_timeout_msec)->default_value(0), "Maximum time that GTPU takes to release indirect forwarding tunnel since the last received GTPU PDU. (0 for infinity)") // eMBMS section diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index d873e5e86..0fbeba79a 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -244,15 +244,17 @@ void gtpu_tunnel_manager::set_tunnel_priority(uint32_t before_teid, uint32_t aft // TS 36.300 - On detection of the "end marker", the target eNB may also initiate the release of the data forwarding // resource. However, the release of the data forwarding resource is implementation dependent and could // also be based on other mechanisms (e.g. timer-based mechanism). - before_tun.rx_timer = task_sched.get_unique_timer(); - before_tun.rx_timer.set(gtpu_args->indirect_tunnel_timeout_msec, [this, before_teid](uint32_t tid) { - // Note: This will self-destruct the callback object - logger.info("Forwarding tunnel " TEID_IN_FMT "being closed after timeout=%d msec", - before_teid, - gtpu_args->indirect_tunnel_timeout_msec); - remove_tunnel(before_teid); - }); - before_tun.rx_timer.run(); + if (gtpu_args->indirect_tunnel_timeout_msec > 0) { + before_tun.rx_timer = task_sched.get_unique_timer(); + before_tun.rx_timer.set(gtpu_args->indirect_tunnel_timeout_msec, [this, before_teid](uint32_t tid) { + // Note: This will self-destruct the callback object + logger.info("Forwarding tunnel " TEID_IN_FMT "being closed after timeout=%d msec", + before_teid, + gtpu_args->indirect_tunnel_timeout_msec); + remove_tunnel(before_teid); + }); + before_tun.rx_timer.run(); + } } void gtpu_tunnel_manager::handle_rx_pdcp_sdu(uint32_t teid) diff --git a/srsenb/test/upper/gtpu_test.cc b/srsenb/test/upper/gtpu_test.cc index ca2092a11..020667ddd 100644 --- a/srsenb/test/upper/gtpu_test.cc +++ b/srsenb/test/upper/gtpu_test.cc @@ -209,6 +209,8 @@ enum class tunnel_test_event { success, wait_end_marker_timeout }; int test_gtpu_direct_tunneling(tunnel_test_event event) { + std::random_device rd; + std::mt19937 g(rd()); srslog::basic_logger& logger = srslog::fetch_basic_logger("TEST"); logger.info("\n\n**** Test GTPU Direct Tunneling ****\n"); uint16_t rnti = 0x46, rnti2 = 0x50; @@ -235,8 +237,9 @@ int test_gtpu_direct_tunneling(tunnel_test_event event) srsenb::gtpu senb_gtpu(&task_sched, logger1, &senb_rx_sockets), tenb_gtpu(&task_sched, logger2, &tenb_rx_sockets); pdcp_tester senb_pdcp, tenb_pdcp; gtpu_args_t gtpu_args; - gtpu_args.gtp_bind_addr = senb_addr_str; - gtpu_args.mme_addr = sgw_addr_str; + gtpu_args.gtp_bind_addr = senb_addr_str; + gtpu_args.mme_addr = sgw_addr_str; + gtpu_args.indirect_tunnel_timeout_msec = std::uniform_int_distribution{500, 2000}(g); senb_gtpu.init(gtpu_args, &senb_pdcp); gtpu_args.gtp_bind_addr = tenb_addr_str; tenb_gtpu.init(gtpu_args, &tenb_pdcp); @@ -262,8 +265,6 @@ int test_gtpu_direct_tunneling(tunnel_test_event event) props.forward_from_teidin = senb_teid_in; senb_gtpu.add_bearer(rnti, drb1, tenb_addr, dl_tenb_teid_in, &props); - std::random_device rd; - std::mt19937 g(rd()); std::vector data_vec(10); std::iota(data_vec.begin(), data_vec.end(), 0); std::vector encoded_data;