pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-hnbgw/+/41444?usp=email )


Change subject: hnb: Allow setting Iuh tx-queue-max-length per HNB
......................................................................

hnb: Allow setting Iuh tx-queue-max-length per HNB

Related: SYS#7693
Change-Id: Ibf69a5a2e6ff8d6829320efe793c6368aa542102
---
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
6 files changed, 68 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/44/41444/1

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 bd6b02c..2ea5ce3 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 da1f3fa..9f1121b 100644
--- a/src/osmo-hnbgw/hnbgw_vty.c
+++ b/src/osmo-hnbgw/hnbgw_vty.c
@@ -326,10 +326,17 @@
       "Maximum transmit queue length, in msgbs\n"
       "Amount of msgbs which can be queued at maximum in the tramist 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;
 }

@@ -877,6 +884,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,
@@ -1000,6 +1019,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)
@@ -1165,6 +1186,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 https://gerrit.osmocom.org/c/osmo-hnbgw/+/41444?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ibf69a5a2e6ff8d6829320efe793c6368aa542102
Gerrit-Change-Number: 41444
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to