[PROTO] Increase SDU buffer 8k->16k (#2008)

This commit is contained in:
Sukchan Lee 2023-01-21 12:58:43 +09:00
parent df4c83372d
commit ff261681c0
9 changed files with 40 additions and 26 deletions

View File

@ -425,10 +425,10 @@ int ogs_app_context_parse_config(void)
const char *v = ogs_yaml_iter_value(&pool_iter);
if (v)
self.pool.defconfig.cluster_2048_pool = atoi(v);
} else if (!strcmp(pool_key, "8192")) {
} else if (!strcmp(pool_key, "16384")) {
const char *v = ogs_yaml_iter_value(&pool_iter);
if (v)
self.pool.defconfig.cluster_8192_pool = atoi(v);
self.pool.defconfig.cluster_16384_pool = atoi(v);
} else if (!strcmp(pool_key, "big")) {
const char *v = ogs_yaml_iter_value(&pool_iter);
if (v)

View File

@ -28,15 +28,27 @@
#define OGS_CLUSTER_512_SIZE 512
#define OGS_CLUSTER_1024_SIZE 1024
#define OGS_CLUSTER_2048_SIZE 2048
#define OGS_CLUSTER_8192_SIZE 8192
#define OGS_CLUSTER_BIG_SIZE 1024*1024
#define OGS_CLUSTER_16384_SIZE 16384
/*
*
* In lib/core/ogs-kqueue.c:69
* context->change_list = ogs_calloc(
* pollset->capacity, sizeof(struct kevent));
* 1. pollset->capacity : 1024*16
* 2. sizeof(struct kevent) : 64
* 3. sizeof(ogs_pkbuf_t *) is headroom in ogs_calloc()
*
* So, we use BIG_SIZE : 1024*(16*64=1024)*64+8
*/
#define OGS_CLUSTER_BIG_SIZE (1024*1024+sizeof(ogs_pkbuf_t *))
typedef uint8_t ogs_cluster_128_t[OGS_CLUSTER_128_SIZE];
typedef uint8_t ogs_cluster_256_t[OGS_CLUSTER_256_SIZE];
typedef uint8_t ogs_cluster_512_t[OGS_CLUSTER_512_SIZE];
typedef uint8_t ogs_cluster_1024_t[OGS_CLUSTER_1024_SIZE];
typedef uint8_t ogs_cluster_2048_t[OGS_CLUSTER_2048_SIZE];
typedef uint8_t ogs_cluster_8192_t[OGS_CLUSTER_8192_SIZE];
typedef uint8_t ogs_cluster_16384_t[OGS_CLUSTER_16384_SIZE];
typedef uint8_t ogs_cluster_big_t[OGS_CLUSTER_BIG_SIZE];
OGS_STATIC_ASSERT(sizeof(ogs_cluster_128_t) % sizeof(void *) == 0);
@ -44,7 +56,7 @@ OGS_STATIC_ASSERT(sizeof(ogs_cluster_256_t) % sizeof(void *) == 0);
OGS_STATIC_ASSERT(sizeof(ogs_cluster_512_t) % sizeof(void *) == 0);
OGS_STATIC_ASSERT(sizeof(ogs_cluster_1024_t) % sizeof(void *) == 0);
OGS_STATIC_ASSERT(sizeof(ogs_cluster_2048_t) % sizeof(void *) == 0);
OGS_STATIC_ASSERT(sizeof(ogs_cluster_8192_t) % sizeof(void *) == 0);
OGS_STATIC_ASSERT(sizeof(ogs_cluster_16384_t) % sizeof(void *) == 0);
OGS_STATIC_ASSERT(sizeof(ogs_cluster_big_t) % sizeof(void *) == 0);
typedef struct ogs_pkbuf_pool_s {
@ -56,7 +68,7 @@ typedef struct ogs_pkbuf_pool_s {
OGS_POOL(cluster_512, ogs_cluster_512_t);
OGS_POOL(cluster_1024, ogs_cluster_1024_t);
OGS_POOL(cluster_2048, ogs_cluster_2048_t);
OGS_POOL(cluster_8192, ogs_cluster_8192_t);
OGS_POOL(cluster_16384, ogs_cluster_16384_t);
OGS_POOL(cluster_big, ogs_cluster_big_t);
ogs_thread_mutex_t mutex;
@ -104,7 +116,7 @@ void ogs_pkbuf_default_init(ogs_pkbuf_config_t *config)
config->cluster_512_pool = 4096;
config->cluster_1024_pool = 2048;
config->cluster_2048_pool = 1024;
config->cluster_8192_pool = 512;
config->cluster_16384_pool = 512;
config->cluster_big_pool = 8;
#endif
}
@ -139,7 +151,7 @@ ogs_pkbuf_pool_t *ogs_pkbuf_pool_create(ogs_pkbuf_config_t *config)
tmp = config->cluster_128_pool + config->cluster_256_pool +
config->cluster_512_pool + config->cluster_1024_pool +
config->cluster_2048_pool + config->cluster_8192_pool +
config->cluster_2048_pool + config->cluster_16384_pool +
config->cluster_big_pool;
ogs_pool_init(&pool->pkbuf, tmp);
@ -150,7 +162,7 @@ ogs_pkbuf_pool_t *ogs_pkbuf_pool_create(ogs_pkbuf_config_t *config)
ogs_pool_init(&pool->cluster_512, config->cluster_512_pool);
ogs_pool_init(&pool->cluster_1024, config->cluster_1024_pool);
ogs_pool_init(&pool->cluster_2048, config->cluster_2048_pool);
ogs_pool_init(&pool->cluster_8192, config->cluster_8192_pool);
ogs_pool_init(&pool->cluster_16384, config->cluster_16384_pool);
ogs_pool_init(&pool->cluster_big, config->cluster_big_pool);
#endif
@ -188,7 +200,7 @@ void ogs_pkbuf_pool_destroy(ogs_pkbuf_pool_t *pool)
ogs_pool_final(&pool->cluster_512);
ogs_pool_final(&pool->cluster_1024);
ogs_pool_final(&pool->cluster_2048);
ogs_pool_final(&pool->cluster_8192);
ogs_pool_final(&pool->cluster_16384);
ogs_pool_final(&pool->cluster_big);
ogs_thread_mutex_destroy(&pool->mutex);
@ -378,10 +390,10 @@ static ogs_cluster_t *cluster_alloc(
ogs_pool_alloc(&pool->cluster_2048, (ogs_cluster_2048_t**)&buffer);
ogs_expect_or_return_val(buffer, NULL);
cluster->size = OGS_CLUSTER_2048_SIZE;
} else if (size <= OGS_CLUSTER_8192_SIZE) {
ogs_pool_alloc(&pool->cluster_8192, (ogs_cluster_8192_t**)&buffer);
} else if (size <= OGS_CLUSTER_16384_SIZE) {
ogs_pool_alloc(&pool->cluster_16384, (ogs_cluster_16384_t**)&buffer);
ogs_expect_or_return_val(buffer, NULL);
cluster->size = OGS_CLUSTER_8192_SIZE;
cluster->size = OGS_CLUSTER_16384_SIZE;
} else if (size <= OGS_CLUSTER_BIG_SIZE) {
ogs_pool_alloc(&pool->cluster_big, (ogs_cluster_big_t**)&buffer);
ogs_expect_or_return_val(buffer, NULL);
@ -419,9 +431,9 @@ static void cluster_free(ogs_pkbuf_pool_t *pool, ogs_cluster_t *cluster)
ogs_pool_free(
&pool->cluster_2048, (ogs_cluster_2048_t*)cluster->buffer);
break;
case OGS_CLUSTER_8192_SIZE:
case OGS_CLUSTER_16384_SIZE:
ogs_pool_free(
&pool->cluster_8192, (ogs_cluster_8192_t*)cluster->buffer);
&pool->cluster_16384, (ogs_cluster_16384_t*)cluster->buffer);
break;
case OGS_CLUSTER_BIG_SIZE:
ogs_pool_free(&pool->cluster_big, (ogs_cluster_big_t*)cluster->buffer);

View File

@ -68,7 +68,7 @@ typedef struct ogs_pkbuf_config_s {
int cluster_512_pool;
int cluster_1024_pool;
int cluster_2048_pool;
int cluster_8192_pool;
int cluster_16384_pool;
int cluster_big_pool;
} ogs_pkbuf_config_t;

View File

@ -54,7 +54,7 @@
extern "C" {
#endif
#define OGS_HUGE_LEN 8192
#define OGS_HUGE_LEN 16384
#if defined(_WIN32)
#define ogs_strtok_r strtok_s

View File

@ -143,8 +143,8 @@ ogs_pfcp_rule_t *ogs_pfcp_pdr_rule_find_by_packet(
proto = ip_h->ip_p;
ip_hlen = (ip_h->ip_hl)*4;
src_addr = &ip_h->ip_src.s_addr;
dst_addr = &ip_h->ip_dst.s_addr;
src_addr = (void *)&ip_h->ip_src.s_addr;
dst_addr = (void *)&ip_h->ip_dst.s_addr;
addr_len = OGS_IPV4_LEN;
} else if (ip_h->ip_v == 6) {
ip_h = NULL;
@ -152,8 +152,8 @@ ogs_pfcp_rule_t *ogs_pfcp_pdr_rule_find_by_packet(
decode_ipv6_header(ip6_h, &proto, &ip_hlen);
src_addr = (uint32_t *)ip6_h->ip6_src.s6_addr;
dst_addr = (uint32_t *)ip6_h->ip6_dst.s6_addr;
src_addr = (void *)ip6_h->ip6_src.s6_addr;
dst_addr = (void *)ip6_h->ip6_dst.s6_addr;
addr_len = OGS_IPV6_LEN;
} else {
ogs_error("Invalid packet [IP version:%d, Packet Length:%d]",

View File

@ -51,7 +51,7 @@ extern "C" {
#define OGS_MAX_NUM_OF_GTPU_RESOURCE 4
#define OGS_MAX_SDU_LEN 8192
#define OGS_MAX_SDU_LEN OGS_HUGE_LEN
#define OGS_MAX_PKT_LEN 2048
#define OGS_PLMN_ID_LEN 3
#define OGS_MAX_PLMN_ID_BCD_LEN 6

View File

@ -382,6 +382,8 @@ static connection_t *connection_add(
request->h.uri = uri;
}
curl_easy_setopt(conn->easy, CURLOPT_BUFFERSIZE, OGS_MAX_SDU_LEN*2);
curl_easy_setopt(conn->easy, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(conn->easy, CURLOPT_SSL_VERIFYHOST, 0);

View File

@ -555,7 +555,7 @@ static int response_handler(
ogs_error("No NF-Instance ID");
}
ogs_assert(true == ogs_sbi_server_send_response(stream, response));
ogs_expect(true == ogs_sbi_server_send_response(stream, response));
scp_assoc_remove(assoc);
return OGS_OK;

View File

@ -429,7 +429,7 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
ogs_assert(far);
if (ip_h->ip_v == 4 && sess->ipv4) {
src_addr = &ip_h->ip_src.s_addr;
src_addr = (void *)&ip_h->ip_src.s_addr;
ogs_assert(src_addr);
/*
@ -460,7 +460,7 @@ static void _gtpv1_u_recv_cb(short when, ogs_socket_t fd, void *data)
} else if (ip_h->ip_v == 6 && sess->ipv6) {
struct ip6_hdr *ip6_h = (struct ip6_hdr *)pkbuf->data;
ogs_assert(ip6_h);
src_addr = (uint32_t *)ip6_h->ip6_src.s6_addr;
src_addr = (void *)ip6_h->ip6_src.s6_addr;
ogs_assert(src_addr);
/*