re-order packet buffer clear #568

This commit is contained in:
Sukchan Lee 2020-10-03 21:18:08 -04:00
parent f642cc0389
commit 9c67459481
6 changed files with 46 additions and 19 deletions

View File

@ -173,11 +173,8 @@ cleanup:
ogs_pkbuf_free(pkbuf); ogs_pkbuf_free(pkbuf);
} }
int sgwu_gtp_open(void) int sgwu_gtp_init(void)
{ {
ogs_socknode_t *node = NULL;
ogs_sock_t *sock = NULL;
ogs_pkbuf_config_t config; ogs_pkbuf_config_t config;
memset(&config, 0, sizeof config); memset(&config, 0, sizeof config);
@ -185,6 +182,19 @@ int sgwu_gtp_open(void)
packet_pool = ogs_pkbuf_pool_create(&config); packet_pool = ogs_pkbuf_pool_create(&config);
return OGS_OK;
}
void sgwu_gtp_final(void)
{
ogs_pkbuf_pool_destroy(packet_pool);
}
int sgwu_gtp_open(void)
{
ogs_socknode_t *node = NULL;
ogs_sock_t *sock = NULL;
ogs_list_for_each(&sgwu_self()->gtpu_list, node) { ogs_list_for_each(&sgwu_self()->gtpu_list, node) {
sock = ogs_gtp_server(node); sock = ogs_gtp_server(node);
ogs_assert(sock); ogs_assert(sock);
@ -206,6 +216,4 @@ int sgwu_gtp_open(void)
void sgwu_gtp_close(void) void sgwu_gtp_close(void)
{ {
ogs_socknode_remove_all(&sgwu_self()->gtpu_list); ogs_socknode_remove_all(&sgwu_self()->gtpu_list);
ogs_pkbuf_pool_destroy(packet_pool);
} }

View File

@ -26,6 +26,9 @@
extern "C" { extern "C" {
#endif #endif
int sgwu_gtp_init(void);
void sgwu_gtp_final(void);
int sgwu_gtp_open(void); int sgwu_gtp_open(void);
void sgwu_gtp_close(void); void sgwu_gtp_close(void);

View File

@ -18,6 +18,7 @@
*/ */
#include "context.h" #include "context.h"
#include "gtp-path.h"
static ogs_thread_t *thread; static ogs_thread_t *thread;
static void sgwu_main(void *data); static void sgwu_main(void *data);
@ -31,6 +32,7 @@ int sgwu_initialize()
ogs_pfcp_context_init(OGS_MAX_NUM_OF_GTPU_RESOURCE); ogs_pfcp_context_init(OGS_MAX_NUM_OF_GTPU_RESOURCE);
sgwu_context_init(); sgwu_context_init();
sgwu_event_init(); sgwu_event_init();
sgwu_gtp_init();
rv = ogs_pfcp_xact_init(); rv = ogs_pfcp_xact_init();
if (rv != OGS_OK) return rv; if (rv != OGS_OK) return rv;
@ -62,10 +64,11 @@ void sgwu_terminate(void)
ogs_thread_destroy(thread); ogs_thread_destroy(thread);
sgwu_context_final(); sgwu_context_final();
ogs_pfcp_context_final();
ogs_pfcp_context_final();
ogs_pfcp_xact_final(); ogs_pfcp_xact_final();
sgwu_gtp_final();
sgwu_event_final(); sgwu_event_final();
} }

View File

@ -250,6 +250,24 @@ cleanup:
ogs_pkbuf_free(pkbuf); ogs_pkbuf_free(pkbuf);
} }
int upf_gtp_init(void)
{
ogs_pkbuf_config_t config;
memset(&config, 0, sizeof config);
config.cluster_2048_pool = ogs_app()->pool.packet;
packet_pool = ogs_pkbuf_pool_create(&config);
return OGS_OK;
}
void upf_gtp_final(void)
{
ogs_pkbuf_pool_destroy(packet_pool);
}
int upf_gtp_open(void) int upf_gtp_open(void)
{ {
ogs_pfcp_dev_t *dev = NULL; ogs_pfcp_dev_t *dev = NULL;
@ -258,13 +276,6 @@ int upf_gtp_open(void)
ogs_sock_t *sock = NULL; ogs_sock_t *sock = NULL;
int rc; int rc;
ogs_pkbuf_config_t config;
memset(&config, 0, sizeof config);
config.cluster_2048_pool = ogs_app()->pool.packet;
packet_pool = ogs_pkbuf_pool_create(&config);
ogs_list_for_each(&upf_self()->gtpu_list, node) { ogs_list_for_each(&upf_self()->gtpu_list, node) {
sock = ogs_gtp_server(node); sock = ogs_gtp_server(node);
ogs_assert(sock); ogs_assert(sock);
@ -342,8 +353,6 @@ void upf_gtp_close(void)
ogs_pollset_remove(dev->poll); ogs_pollset_remove(dev->poll);
ogs_closesocket(dev->fd); ogs_closesocket(dev->fd);
} }
ogs_pkbuf_pool_destroy(packet_pool);
} }
static void upf_gtp_handle_multicast(ogs_pkbuf_t *recvbuf) static void upf_gtp_handle_multicast(ogs_pkbuf_t *recvbuf)

View File

@ -27,6 +27,9 @@
extern "C" { extern "C" {
#endif #endif
int upf_gtp_init(void);
void upf_gtp_final(void);
int upf_gtp_open(void); int upf_gtp_open(void);
void upf_gtp_close(void); void upf_gtp_close(void);

View File

@ -18,8 +18,7 @@
*/ */
#include "context.h" #include "context.h"
#include "event.h" #include "gtp-path.h"
#include "upf-sm.h"
static ogs_thread_t *thread; static ogs_thread_t *thread;
static void upf_main(void *data); static void upf_main(void *data);
@ -33,6 +32,7 @@ int upf_initialize()
ogs_pfcp_context_init(OGS_MAX_NUM_OF_GTPU_RESOURCE); ogs_pfcp_context_init(OGS_MAX_NUM_OF_GTPU_RESOURCE);
upf_context_init(); upf_context_init();
upf_event_init(); upf_event_init();
upf_gtp_init();
rv = ogs_pfcp_xact_init(); rv = ogs_pfcp_xact_init();
if (rv != OGS_OK) return rv; if (rv != OGS_OK) return rv;
@ -67,10 +67,11 @@ void upf_terminate(void)
ogs_thread_destroy(thread); ogs_thread_destroy(thread);
upf_context_final(); upf_context_final();
ogs_pfcp_context_final();
ogs_pfcp_context_final();
ogs_pfcp_xact_final(); ogs_pfcp_xact_final();
upf_gtp_final();
upf_event_final(); upf_event_final();
} }