diff --git a/docs/rtpengine.md b/docs/rtpengine.md index 0390c0f5c..6705b0dee 100644 --- a/docs/rtpengine.md +++ b/docs/rtpengine.md @@ -1187,6 +1187,12 @@ call to inject-DTMF won't be sent to __\-\-dtmf-log-dest=__ or __\-\-listen-tcp- not actual CPU usage but rather indicates time spent waiting for a network event, and so should be considered the same as idle CPU time._ +- __\-\-io-uring-buffers=__*INT* + + Number of `io_uring` entries in the buffer allocated from the kernel per + thread. Defaults to 16384. Must be large enough so that submission entries + and completion entries are always available when needed. + - __\-\-dtls-cert-cipher=prime256v1__\|__RSA__ Choose the type of key to use for the signature used by the self-signed diff --git a/lib/auxlib.c b/lib/auxlib.c index 06eff4ae5..4b9e4a613 100644 --- a/lib/auxlib.c +++ b/lib/auxlib.c @@ -201,6 +201,7 @@ void config_load(int *argc, char ***argv, GOptionEntry *app_entries, const char { "poller-size", 0,0, G_OPTION_ARG_INT, &rtpe_common_config_ptr->poller_size, "Max poller items per iteration", "INT" }, #ifdef HAVE_LIBURING { "io-uring", 0,0, G_OPTION_ARG_NONE, &rtpe_common_config_ptr->io_uring, "Use io_uring", NULL }, + { "io-uring-buffers", 0,0, G_OPTION_ARG_INT, &rtpe_common_config_ptr->io_uring_buffers,"Number of io_uring entries per thread","INT" }, #endif { "evs-lib-path", 0,0, G_OPTION_ARG_FILENAME, &rtpe_common_config_ptr->evs_lib_path, "Location of .so for 3GPP EVS codec", "FILE" }, #ifdef HAVE_CODEC_CHAIN @@ -403,6 +404,13 @@ out: rtpe_common_config_ptr->codec_chain_async = 0; #endif +#if HAVE_LIBURING + if (rtpe_common_config_ptr->io_uring_buffers == 0) + rtpe_common_config_ptr->io_uring_buffers = 16384; + else if (rtpe_common_config_ptr->io_uring_buffers < 0) + die("Invalid value for --io-uring-buffers"); +#endif + return; err: diff --git a/lib/auxlib.h b/lib/auxlib.h index c98ad099a..e7d63b754 100644 --- a/lib/auxlib.h +++ b/lib/auxlib.h @@ -35,6 +35,7 @@ struct rtpengine_common_config { int thread_stack; int poller_size; gboolean io_uring; + int io_uring_buffers; int max_log_line_length; char *evs_lib_path; char *codec_chain_lib_path; diff --git a/lib/uring.c b/lib/uring.c index 977115b6b..f6b4ca0f5 100644 --- a/lib/uring.c +++ b/lib/uring.c @@ -99,7 +99,7 @@ static unsigned int __uring_thread_loop(void) { void uring_thread_init(void) { struct io_uring_params params = {0}; - int ret = io_uring_queue_init_params(4096, &rtpe_uring, ¶ms); + int ret = io_uring_queue_init_params(rtpe_common_config_ptr->io_uring_buffers, &rtpe_uring, ¶ms); if (ret) die("io_uring init failed (%s)", strerror(errno));