daniel has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmocore/+/34245 )
Change subject: ns2: Add VTY option to change the UDP write queue
......................................................................
ns2: Add VTY option to change the UDP write queue
In some cases the default max length of the osmo_io txqueue is too small
(32). Set it to 128 by default and add a VTY option to change it for for
an NSI (program-wide).
Change-Id: I993b87fd6b83b3981f5e293f70b931075afec715
Related: SYS#6550
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_udp.c
M src/gb/gprs_ns2_vty.c
4 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/34245/1
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 02d2266..4e496c1 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1451,6 +1451,8 @@
nsi->timeout[NS_TOUT_TSNS_CONFIG_RETRIES] = 3;
nsi->timeout[NS_TOUT_TSNS_PROCEDURES_RETRIES] = 3;
+ nsi->txqueue_max_length = NS_DEFAULT_TXQUEUE_MAX_LENGTH;
+
return nsi;
}
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 37b142e..b4ec077 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -80,6 +80,8 @@
#define NS_ALLOC_SIZE 3072
#define NS_ALLOC_HEADROOM 20
+#define NS_DEFAULT_TXQUEUE_MAX_LENGTH 128
+
enum ns2_timeout {
NS_TOUT_TNS_BLOCK,
NS_TOUT_TNS_BLOCK_RETRIES,
@@ -164,6 +166,8 @@
/*! workaround for rate counter until rate counter accepts char str as index */
uint32_t nsvc_rate_ctr_idx;
uint32_t bind_rate_ctr_idx;
+
+ uint32_t txqueue_max_length;
};
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index f24eae6..d8a2d87 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -336,6 +336,7 @@
priv->iofd = osmo_iofd_setup(bind, rc, "NS bind",
OSMO_IO_FD_MODE_RECVFROM_SENDTO, &ioops, bind);
osmo_iofd_register(priv->iofd, rc);
osmo_iofd_set_alloc_info(priv->iofd, 4096, 128);
+ osmo_iofd_set_txqueue_max_length(priv->iofd, nsi->txqueue_max_length);
/* IPv4: max fragmented payload can be (13 bit) * 8 byte => 65535.
* IPv6: max payload can be 65535 (RFC 2460).
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 3046fff..566423f 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -595,6 +595,9 @@
get_value_string(gprs_ns_timer_strs, i),
vty_nsi->timeout[i], VTY_NEWLINE);
+ if (vty_nsi->txqueue_max_length != NS_DEFAULT_TXQUEUE_MAX_LENGTH)
+ vty_out(vty, " txqueue max-length %u%s", vty_nsi->txqueue_max_length,
VTY_NEWLINE);
+
ret = config_write_ns_bind(vty);
if (ret)
return ret;
@@ -1707,6 +1710,17 @@
return CMD_WARNING;
}
+DEFUN(cfg_ns_txqueue_max_length, cfg_ns_txqueue_max_length_cmd,
+ "txqueue max-length <1-4096>",
+ "UDP txqueue options\n"
+ "Set the maximum length of the txqueue\n"
+ "Maximum length of the txqueue\n")
+{
+ uint32_t max_length = atoi(argv[0]);
+ vty_nsi->txqueue_max_length = max_length;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_ns_nse_ip_sns_bind, cfg_ns_nse_ip_sns_bind_cmd,
"ip-sns-bind BINDID",
"IP SNS binds\n"
@@ -2292,6 +2306,8 @@
install_lib_element(L_NS_NODE, &cfg_ns_ip_sns_default_bind_cmd);
install_lib_element(L_NS_NODE, &cfg_no_ns_ip_sns_default_bind_cmd);
+ install_lib_element(L_NS_NODE, &cfg_ns_txqueue_max_length_cmd);
+
install_node(&ns_bind_node, NULL);
install_lib_element(L_NS_BIND_NODE, &cfg_ns_bind_listen_cmd);
install_lib_element(L_NS_BIND_NODE, &cfg_no_ns_bind_listen_cmd);
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/34245
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I993b87fd6b83b3981f5e293f70b931075afec715
Gerrit-Change-Number: 34245
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: newchange