laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/27795 )
Change subject: client: Add 'wqueue max-length <0-4294967295>' VTY command ......................................................................
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 --- M include/osmo-pcap/osmo_pcap_client.h M src/osmo_client_core.c M src/osmo_client_vty.c 3 files changed, 20 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/include/osmo-pcap/osmo_pcap_client.h b/include/osmo-pcap/osmo_pcap_client.h index 887d422..5bc203a 100644 --- a/include/osmo-pcap/osmo_pcap_client.h +++ b/include/osmo-pcap/osmo_pcap_client.h @@ -32,6 +32,8 @@
struct rate_ctr_group;
+#define WQUEUE_MAXLEN_DEFAULT 1000 + enum { CLIENT_CTR_CONNECT, CLIENT_CTR_BYTES, diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c index 8209afe..4bb4b4e 100644 --- a/src/osmo_client_core.c +++ b/src/osmo_client_core.c @@ -341,7 +341,7 @@ { 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; }
diff --git a/src/osmo_client_vty.c b/src/osmo_client_vty.c index 7458f85..8e21d67 100644 --- a/src/osmo_client_vty.c +++ b/src/osmo_client_vty.c @@ -104,6 +104,10 @@ 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 @@ 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 @@ 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);