client: Add 'wqueue max-length <0-4294967295>' VTY command

This allows setting a suitable write-queue max length per client. The
desired value can be different based on a lot of variables, like memory
availabilty, network and CPU load, input/output link state, etc.

Related: SYS#5921
Change-Id: I4e9d5d836ddda215f9e7a075aa8e10d2d3854dd2
This commit is contained in:
Pau Espin 2022-04-14 18:13:30 +02:00
parent 50dcc15a2e
commit a55253f438
3 changed files with 20 additions and 1 deletions

View File

@ -32,6 +32,8 @@
struct rate_ctr_group;
#define WQUEUE_MAXLEN_DEFAULT 1000
enum {
CLIENT_CTR_CONNECT,
CLIENT_CTR_BYTES,

View File

@ -341,7 +341,7 @@ void osmo_client_conn_init(struct osmo_pcap_client_conn *conn,
{
conn->client = client;
conn->tls_verify = true;
osmo_wqueue_init(&conn->wqueue, 1000);
osmo_wqueue_init(&conn->wqueue, WQUEUE_MAXLEN_DEFAULT);
conn->wqueue.bfd.fd = -1;
}

View File

@ -104,6 +104,10 @@ static void write_client_conn_data(
if (conn->protocol != PROTOCOL_OSMOPCAP)
vty_out(vty, "%s protocol %s%s", indent,
get_value_string(osmopcap_protocol_names, conn->protocol), VTY_NEWLINE);
if (conn->wqueue.max_length != WQUEUE_MAXLEN_DEFAULT)
vty_out(vty, "%s wqueue max-length %u%s", indent,
conn->wqueue.max_length, VTY_NEWLINE);
}
static int config_write_server(struct vty *vty)
@ -518,6 +522,18 @@ DEFUN(cfg_client_protocol,
return CMD_SUCCESS;
}
DEFUN(cfg_wqueue_maxlength,
cfg_wqueue_maxlength_cmd,
"wqueue max-length <1-4294967295>",
"Configure the write-queue used for transfer\n"
"Configure the maximum amount of packets to be stored in the write-queue\n"
"Maximum amount of packets before dropping starts\n")
{
struct osmo_pcap_client_conn *conn = get_conn(vty);
conn->wqueue.max_length = atoi(argv[0]);
return CMD_SUCCESS;
}
int vty_client_init(void)
{
@ -535,6 +551,7 @@ int vty_client_init(void)
install_element(CLIENT_NODE, &cfg_server_port_cmd);
install_element(CLIENT_NODE, &cfg_source_ip_cmd);
install_element(CLIENT_NODE, &cfg_protocol_cmd);
install_element(CLIENT_NODE, &cfg_wqueue_maxlength_cmd);
install_element(CLIENT_NODE, &cfg_enable_tls_cmd);
install_element(CLIENT_NODE, &cfg_disable_tls_cmd);