pespin submitted this change.
hnb: Allow setting Iuh tx-queue-max-length per HNB
Related: SYS#7693
Depends: libosmo-netif.git Change-Id Ibc68612bd8dee4f9b8031ce2c3f5c7ff6bb639e3
Change-Id: Ibf69a5a2e6ff8d6829320efe793c6368aa542102
---
M TODO-RELEASE
M include/osmocom/hnbgw/hnb.h
M include/osmocom/hnbgw/hnb_persistent.h
M src/osmo-hnbgw/hnb.c
M src/osmo-hnbgw/hnb_persistent.c
M src/osmo-hnbgw/hnbgw_vty.c
M tests/osmo-hnbgw.vty
7 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 895cb3c..a42e798 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -8,3 +8,4 @@
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
libosmo-sigtran >2.1.0 osmo_sccp_addr_{create,update}()
+libosmo-netif >1.6.0 osmo_stream_srv_set_tx_queue_max_length()
diff --git a/include/osmocom/hnbgw/hnb.h b/include/osmocom/hnbgw/hnb.h
index 9c210e6..caa566a 100644
--- a/include/osmocom/hnbgw/hnb.h
+++ b/include/osmocom/hnbgw/hnb.h
@@ -72,5 +72,7 @@
void hnb_context_release(struct hnb_context *ctx);
void hnb_context_release_ue_state(struct hnb_context *ctx);
+void hnb_context_apply_tx_queue_max_length(struct hnb_context *ctx);
+
unsigned long long hnb_get_updowntime(const struct hnb_context *ctx);
void hnb_store_rab_durations(struct hnb_context *hnb);
diff --git a/include/osmocom/hnbgw/hnb_persistent.h b/include/osmocom/hnbgw/hnb_persistent.h
index 07c017b..08db9c4 100644
--- a/include/osmocom/hnbgw/hnb_persistent.h
+++ b/include/osmocom/hnbgw/hnb_persistent.h
@@ -157,6 +157,10 @@
struct rate_ctr_group *ctrs;
struct osmo_stat_item_group *statg;
+ struct {
+ int iuh_tx_queue_max_length; /* -1: Use hnbgw default */
+ } config;
+
/* State that the main thread needs in order to know what was requested from the nft worker threads and what
* still needs to be requested. */
struct {
diff --git a/src/osmo-hnbgw/hnb.c b/src/osmo-hnbgw/hnb.c
index 88c64f6..63aa622 100644
--- a/src/osmo-hnbgw/hnb.c
+++ b/src/osmo-hnbgw/hnb.c
@@ -115,6 +115,7 @@
}
osmo_stream_srv_set_read_cb(ctx->conn, hnb_read_cb);
osmo_stream_srv_set_closed_cb(ctx->conn, hnb_closed_cb);
+ hnb_context_apply_tx_queue_max_length(ctx);
llist_add_tail(&ctx->list, &g_hnbgw->hnb_list);
return ctx;
@@ -206,6 +207,22 @@
return hnbp_get_updowntime(ctx->persistent);
}
+void hnb_context_apply_tx_queue_max_length(struct hnb_context *ctx)
+{
+ unsigned int v;
+ const struct hnb_persistent *hnbp = ctx->persistent;
+
+ if (!ctx->conn)
+ return;
+
+ if (hnbp &&
+ hnbp->config.iuh_tx_queue_max_length >= 0)
+ v = hnbp->config.iuh_tx_queue_max_length >= 0;
+ else /* Use global HNBGW default */
+ v = g_hnbgw->config.iuh.tx_queue_max_length;
+ osmo_stream_srv_set_tx_queue_max_length(ctx->conn, v);
+}
+
/***********************************************************************
* SCTP Socket / stream handling
***********************************************************************/
diff --git a/src/osmo-hnbgw/hnb_persistent.c b/src/osmo-hnbgw/hnb_persistent.c
index 015e7c6..63c0c6a 100644
--- a/src/osmo-hnbgw/hnb_persistent.c
+++ b/src/osmo-hnbgw/hnb_persistent.c
@@ -275,6 +275,8 @@
goto out_free_ctrs;
osmo_stat_item_group_set_name(hnbp->statg, hnbp->id_str);
+ hnbp->config.iuh_tx_queue_max_length = -1; /* global HNBGW default */
+
llist_add(&hnbp->list, &g_hnbgw->hnb_persistent_list);
hash_add(g_hnbgw->hnb_persistent_by_id, &hnbp->node_by_id, umts_cell_id_hash(&hnbp->id));
diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c
index 28d5e84..45f3567 100644
--- a/src/osmo-hnbgw/hnbgw_vty.c
+++ b/src/osmo-hnbgw/hnbgw_vty.c
@@ -323,10 +323,17 @@
"Maximum transmit queue length, in msgbs\n"
"Amount of msgbs which can be queued at maximum in the transmit queue\n")
{
+ struct hnb_context *hnb;
+
g_hnbgw->config.iuh.tx_queue_max_length = atoi(argv[0]);
if (g_hnbgw->iuh)
osmo_stream_srv_link_set_tx_queue_max_length(g_hnbgw->iuh,
g_hnbgw->config.iuh.tx_queue_max_length);
+
+ /* Apply new default to HNBs which don't hace a specific value set. */
+ llist_for_each_entry(hnb, &g_hnbgw->hnb_list, list)
+ hnb_context_apply_tx_queue_max_length(hnb);
+
return CMD_SUCCESS;
}
@@ -874,6 +881,18 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_hnb_tx_queue_max_length, cfg_hnb_tx_queue_max_length_cmd,
+ "tx-queue-max-length <-1-65535>",
+ "Maximum transmit queue length, in msgbs\n"
+ "Amount of msgbs which can be queued at maximum in the tramist queue (-1: Use hnbgw default)\n")
+{
+ struct hnb_persistent *hnbp = vty->index;
+ hnbp->config.iuh_tx_queue_max_length = atoi(argv[0]);
+ if (hnbp->ctx)
+ hnb_context_apply_tx_queue_max_length(hnbp->ctx);
+ return CMD_SUCCESS;
+}
+
#define NFT_KPI_STR "Retrieve traffic counters from nftables\n"
DEFUN(cfg_hnbgw_nft_kpi, cfg_hnbgw_nft_kpi_cmd,
@@ -997,6 +1016,8 @@
static void write_one_hnbp(struct vty *vty, const struct hnb_persistent *hnbp)
{
vty_out(vty, " hnb %s%s", hnbp->id_str, VTY_NEWLINE);
+ if (hnbp->config.iuh_tx_queue_max_length >= 0)
+ vty_out(vty, " tx-queue-max-length %u%s", hnbp->config.iuh_tx_queue_max_length, VTY_NEWLINE);
}
static int config_write_hnbgw(struct vty *vty)
@@ -1162,6 +1183,7 @@
install_element(HNBGW_NODE, &cfg_hnbgw_hnb_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_no_hnb_cmd);
install_node(&hnb_node, NULL);
+ install_element(HNB_NODE, &cfg_hnb_tx_queue_max_length_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_nft_kpi_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_no_nft_kpi_cmd);
diff --git a/tests/osmo-hnbgw.vty b/tests/osmo-hnbgw.vty
index c3e1f11..e10cb27 100644
--- a/tests/osmo-hnbgw.vty
+++ b/tests/osmo-hnbgw.vty
@@ -103,6 +103,27 @@
...
OsmoHNBGW(config-hnbgw-iuh)# exit
+OsmoHNBGW(config-hnbgw)# hnb 23-42-L1-R2-S3-C4
+OsmoHNBGW(config-hnbgw-hnb)# list
+...
+ tx-queue-max-length <-1-65535>
+...
+OsmoHNBGW(config-hnbgw-hnb)# show running-config
+...
+hnbgw
+...
+ hnb 023-42-L1-R2-S3-C4
+...
+OsmoHNBGW(config-hnbgw-hnb)# tx-queue-max-length 3000
+OsmoHNBGW(config-hnbgw-hnb)# show running-config
+...
+hnbgw
+...
+ hnb 023-42-L1-R2-S3-C4
+ tx-queue-max-length 3000
+...
+OsmoHNBGW(config-hnbgw-hnb)# exit
+
OsmoHNBGW(config-hnbgw)# nft-kpi?
nft-kpi Retrieve traffic counters from nftables
OsmoHNBGW(config-hnbgw)# nft-kpi ?
To view, visit change 41444. To unsubscribe, or for help writing mail filters, visit settings.