<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/21696">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gbproxy: Implement scaling of BVC flow control in SGSN pool<br><br>When there are multiple SGSNs inside a pool, we need to decide<br>how much of the per-BVC capacity advertised by the BSS in its<br>BVC-FLOW-CONTROL we should announce to each of the pool members.<br><br>A conservative approach would be to advertise 1/num_sgsn, but<br>there may also be use case where over-provisioning (announcing more<br>than an equal share of the capacity) is useful.<br><br>Hence, let's introduce "pool bvc-flow-control-ratio <1-100>" in order<br>to allow the administrator to decide.<br><br>Related: OS#4891<br>Change-Id: Ibe5addf657e7237499ca0205bacfe999ecd1e771<br>---<br>M doc/manuals/chapters/gbproxy-configuration.adoc<br>M include/osmocom/sgsn/gb_proxy.h<br>M src/gbproxy/gb_proxy.c<br>M src/gbproxy/gb_proxy_vty.c<br>4 files changed, 65 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/96/21696/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/manuals/chapters/gbproxy-configuration.adoc b/doc/manuals/chapters/gbproxy-configuration.adoc</span><br><span>index 599b3f7..e61af48 100644</span><br><span>--- a/doc/manuals/chapters/gbproxy-configuration.adoc</span><br><span>+++ b/doc/manuals/chapters/gbproxy-configuration.adoc</span><br><span>@@ -4,3 +4,29 @@</span><br><span> Osmocom has very limited funding and support resources; Feel free to help</span><br><span> us completing this documentation by contributing with code, documentation</span><br><span> or by supporting the developers financially.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+=== SGSN pool support</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+In a SGSN pool, osmo-gbproxy is facing the problem of dividing the downlink</span><br><span style="color: hsl(120, 100%, 40%);">+capacity of a cell towards the SGSN.  The BSS advertises the per-BVC capacity</span><br><span style="color: hsl(120, 100%, 40%);">+by means of the BSSGP FLOW-CONTROL-BVC messages, but as there are multiple</span><br><span style="color: hsl(120, 100%, 40%);">+SGSN in a pool, they all have to share / divide that total capacity.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+By default, osmo-gbproxy advertises the full capacity to _each_ of the SGSN</span><br><span style="color: hsl(120, 100%, 40%);">+pool members, which results in significant over-provisioning and can lead to</span><br><span style="color: hsl(120, 100%, 40%);">+overload situations.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The administrator can configure the _percentage_ of the overall BSS-advertised</span><br><span style="color: hsl(120, 100%, 40%);">+capacity that shall be reported to each pool member SGSN using the</span><br><span style="color: hsl(120, 100%, 40%);">+`pool bvc-flow-control-ratio <1-100>` configuration command.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+A setting of 100 means that each pool member is informed of 100% of the</span><br><span style="color: hsl(120, 100%, 40%);">+BSS side capacity.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+A setting of 25 means that each pool member is informed of 25% of the</span><br><span style="color: hsl(120, 100%, 40%);">+BSS side capacity.  This would make most sense in a set-up with four</span><br><span style="color: hsl(120, 100%, 40%);">+SGSN of equal share.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+More complex capacity division schemes are so far not supported by</span><br><span style="color: hsl(120, 100%, 40%);">+osmo-gbproxy.</span><br><span>diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h</span><br><span>index 8892cf4..200a539 100644</span><br><span>--- a/include/osmocom/sgsn/gb_proxy.h</span><br><span>+++ b/include/osmocom/sgsn/gb_proxy.h</span><br><span>@@ -52,6 +52,11 @@</span><br><span>  /* NS instance of libosmogb */</span><br><span>       struct gprs_ns2_inst *nsi;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+        struct {</span><br><span style="color: hsl(120, 100%, 40%);">+              /* percentage of BVC flow control advertised to each SGSN in the pool */</span><br><span style="color: hsl(120, 100%, 40%);">+              uint8_t bvc_fc_ratio;</span><br><span style="color: hsl(120, 100%, 40%);">+ } pool;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>    /* Linked list of all BSS side Gb peers */</span><br><span>   DECLARE_HASHTABLE(bss_nses, 8);</span><br><span> </span><br><span>diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c</span><br><span>index a976d25..53aecdf 100644</span><br><span>--- a/src/gbproxy/gb_proxy.c</span><br><span>+++ b/src/gbproxy/gb_proxy.c</span><br><span>@@ -40,6 +40,7 @@</span><br><span> </span><br><span> #include <osmocom/gprs/gprs_ns2.h></span><br><span> #include <osmocom/gprs/gprs_bssgp.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/gprs/gprs_bssgp2.h></span><br><span> #include <osmocom/gprs/gprs_bssgp_bss.h></span><br><span> #include <osmocom/gprs/bssgp_bvc_fsm.h></span><br><span> </span><br><span>@@ -566,15 +567,28 @@</span><br><span> /* BVC FSM informs us about BVC-FC PDU receive */</span><br><span> static void bss_ptp_bvc_fc_bvc(uint16_t nsei, uint16_t bvci, const struct bssgp2_flow_ctrl *fc, void *priv)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+       struct bssgp2_flow_ctrl fc_reduced;</span><br><span>  struct gbproxy_bvc *bss_bvc = priv;</span><br><span style="color: hsl(0, 100%, 40%);">-     struct gbproxy_cell *cell = bss_bvc->cell;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct gbproxy_cell *cell;</span><br><span style="color: hsl(120, 100%, 40%);">+    struct gbproxy_config *cfg;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+       OSMO_ASSERT(bss_bvc);</span><br><span style="color: hsl(120, 100%, 40%);">+ OSMO_ASSERT(fc);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    cell = bss_bvc->cell;</span><br><span>     if (!cell)</span><br><span>           return;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     /* FIXME: actually split the bandwidth among the SGSNs! */</span><br><span style="color: hsl(120, 100%, 40%);">+    cfg = cell->cfg;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- dispatch_to_all_sgsn_bvc(cell, BSSGP_BVCFSM_E_REQ_FC_BVC, (void *) fc);</span><br><span style="color: hsl(120, 100%, 40%);">+       /* reduce / scale according to configuration to make sure we only advertise a fraction</span><br><span style="color: hsl(120, 100%, 40%);">+         * of the capacity to each of the SGSNs in the pool */</span><br><span style="color: hsl(120, 100%, 40%);">+        fc_reduced = *fc;</span><br><span style="color: hsl(120, 100%, 40%);">+     fc_reduced.bucket_size_max = (fc->bucket_size_max * cfg->pool.bvc_fc_ratio) / 100;</span><br><span style="color: hsl(120, 100%, 40%);">+      fc_reduced.bucket_leak_rate = (fc->bucket_leak_rate * cfg->pool.bvc_fc_ratio) / 100;</span><br><span style="color: hsl(120, 100%, 40%);">+    /* we don't modify the per-MS related values as any single MS is only served by one SGSN */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     dispatch_to_all_sgsn_bvc(cell, BSSGP_BVCFSM_E_REQ_FC_BVC, (void *) &fc_reduced);</span><br><span> }</span><br><span> </span><br><span> static const struct bssgp_bvc_fsm_ops bss_ptp_bvc_fsm_ops = {</span><br><span>@@ -1270,6 +1284,8 @@</span><br><span> {</span><br><span>  struct timespec tp;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+       /* by default we advertise 100% of the BSS-side capacity to _each_ SGSN */</span><br><span style="color: hsl(120, 100%, 40%);">+    cfg->pool.bvc_fc_ratio = 100;</span><br><span>     hash_init(cfg->bss_nses);</span><br><span>         cfg->ctrg = rate_ctr_group_alloc(tall_sgsn_ctx, &global_ctrg_desc, 0);</span><br><span>        if (!cfg->ctrg) {</span><br><span>diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c</span><br><span>index a9db596..49ec91c 100644</span><br><span>--- a/src/gbproxy/gb_proxy_vty.c</span><br><span>+++ b/src/gbproxy/gb_proxy_vty.c</span><br><span>@@ -76,6 +76,9 @@</span><br><span> </span><br><span>    vty_out(vty, "gbproxy%s", VTY_NEWLINE);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (g_cfg->pool.bvc_fc_ratio != 100)</span><br><span style="color: hsl(120, 100%, 40%);">+               vty_out(vty, " pool bvc-flow-control-ratio %u%s", g_cfg->pool.bvc_fc_ratio, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     hash_for_each(g_cfg->sgsn_nses, i, nse, list) {</span><br><span>           vty_out(vty, " sgsn nsei %u%s", nse->nsei, VTY_NEWLINE);</span><br><span>        }</span><br><span>@@ -134,6 +137,17 @@</span><br><span>     return CMD_WARNING;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN(cfg_pool_bvc_fc_ratio,</span><br><span style="color: hsl(120, 100%, 40%);">+      cfg_pool_bvc_fc_ratio_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+      "pool bvc-flow-control-ratio <1-100>",</span><br><span style="color: hsl(120, 100%, 40%);">+      "SGSN Pool related configuration\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "Ratio of BSS-advertised bucket size + leak rate advertised to each SGSN\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "Ratio of BSS-advertised bucket size + leak rate advertised to each SGSN (Percent)\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       g_cfg->pool.bvc_fc_ratio = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+  return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void log_set_bvc_filter(struct log_target *target,</span><br><span>                                const uint16_t *bvci)</span><br><span> {</span><br><span>@@ -315,6 +329,7 @@</span><br><span>     install_element(CONFIG_NODE, &cfg_gbproxy_cmd);</span><br><span>  install_node(&gbproxy_node, config_write_gbproxy);</span><br><span>       install_element(GBPROXY_NODE, &cfg_nsip_sgsn_nsei_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+   install_element(GBPROXY_NODE, &cfg_pool_bvc_fc_ratio_cmd);</span><br><span> </span><br><span>   return 0;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/21696">change 21696</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-sgsn/+/21696"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sgsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ibe5addf657e7237499ca0205bacfe999ecd1e771 </div>
<div style="display:none"> Gerrit-Change-Number: 21696 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>