mirror of https://gerrit.osmocom.org/osmo-pcap
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:
parent
50dcc15a2e
commit
a55253f438
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
struct rate_ctr_group;
|
struct rate_ctr_group;
|
||||||
|
|
||||||
|
#define WQUEUE_MAXLEN_DEFAULT 1000
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CLIENT_CTR_CONNECT,
|
CLIENT_CTR_CONNECT,
|
||||||
CLIENT_CTR_BYTES,
|
CLIENT_CTR_BYTES,
|
||||||
|
|
|
@ -341,7 +341,7 @@ void osmo_client_conn_init(struct osmo_pcap_client_conn *conn,
|
||||||
{
|
{
|
||||||
conn->client = client;
|
conn->client = client;
|
||||||
conn->tls_verify = true;
|
conn->tls_verify = true;
|
||||||
osmo_wqueue_init(&conn->wqueue, 1000);
|
osmo_wqueue_init(&conn->wqueue, WQUEUE_MAXLEN_DEFAULT);
|
||||||
conn->wqueue.bfd.fd = -1;
|
conn->wqueue.bfd.fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,10 @@ static void write_client_conn_data(
|
||||||
if (conn->protocol != PROTOCOL_OSMOPCAP)
|
if (conn->protocol != PROTOCOL_OSMOPCAP)
|
||||||
vty_out(vty, "%s protocol %s%s", indent,
|
vty_out(vty, "%s protocol %s%s", indent,
|
||||||
get_value_string(osmopcap_protocol_names, conn->protocol), VTY_NEWLINE);
|
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)
|
static int config_write_server(struct vty *vty)
|
||||||
|
@ -518,6 +522,18 @@ DEFUN(cfg_client_protocol,
|
||||||
return CMD_SUCCESS;
|
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)
|
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_server_port_cmd);
|
||||||
install_element(CLIENT_NODE, &cfg_source_ip_cmd);
|
install_element(CLIENT_NODE, &cfg_source_ip_cmd);
|
||||||
install_element(CLIENT_NODE, &cfg_protocol_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_enable_tls_cmd);
|
||||||
install_element(CLIENT_NODE, &cfg_disable_tls_cmd);
|
install_element(CLIENT_NODE, &cfg_disable_tls_cmd);
|
||||||
|
|
Loading…
Reference in New Issue