From e213f654060b7b9f2bae11420c5175e876cf006e Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Sat, 2 Apr 2022 13:36:23 +0900 Subject: [PATCH] Improve data-path performance using talloc_pool() allocate a talloc pool for GTP to ensure it doesn't have to go back to the libc malloc all the time. --- src/sgwu/gtp-path.c | 7 +++++++ src/upf/gtp-path.c | 9 ++++++++- tests/vonr/session-test.c | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/sgwu/gtp-path.c b/src/sgwu/gtp-path.c index b72f1aa5d..4130b16db 100644 --- a/src/sgwu/gtp-path.c +++ b/src/sgwu/gtp-path.c @@ -244,7 +244,14 @@ int sgwu_gtp_init(void) config.cluster_2048_pool = ogs_app()->pool.packet; +#if OGS_USE_TALLOC + /* allocate a talloc pool for GTP to ensure it doesn't have to go back + * to the libc malloc all the time */ + packet_pool = talloc_pool(__ogs_talloc_core, 1000*1024); + ogs_assert(packet_pool); +#else packet_pool = ogs_pkbuf_pool_create(&config); +#endif return OGS_OK; } diff --git a/src/upf/gtp-path.c b/src/upf/gtp-path.c index 83447b87e..108cb357b 100644 --- a/src/upf/gtp-path.c +++ b/src/upf/gtp-path.c @@ -222,7 +222,7 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data) ogs_assert(fd != INVALID_SOCKET); - pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_PKT_LEN); + pkbuf = ogs_pkbuf_alloc(packet_pool, OGS_MAX_PKT_LEN); ogs_assert(pkbuf); ogs_pkbuf_reserve(pkbuf, OGS_TUN_MAX_HEADROOM); ogs_pkbuf_put(pkbuf, OGS_MAX_PKT_LEN-OGS_TUN_MAX_HEADROOM); @@ -579,7 +579,14 @@ int upf_gtp_init(void) config.cluster_2048_pool = ogs_app()->pool.packet; +#if OGS_USE_TALLOC + /* allocate a talloc pool for GTP to ensure it doesn't have to go back + * to the libc malloc all the time */ + packet_pool = talloc_pool(__ogs_talloc_core, 1000*1024); + ogs_assert(packet_pool); +#else packet_pool = ogs_pkbuf_pool_create(&config); +#endif return OGS_OK; } diff --git a/tests/vonr/session-test.c b/tests/vonr/session-test.c index 648572cb5..c088e6350 100644 --- a/tests/vonr/session-test.c +++ b/tests/vonr/session-test.c @@ -1937,6 +1937,9 @@ static void test5_func(abts_case *tc, void *data) OGS_NAS_5GS_5GMM_STATUS, test_ue->gmm_message_type); + /* Waiting for deleting PDU session */ + ogs_msleep(100); + /* Send De-registration request */ gmmbuf = testgmm_build_de_registration_request(test_ue, 1, true, true); ABTS_PTR_NOTNULL(tc, gmmbuf);