aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/bsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-11-27 21:29:33 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-01-12 03:28:12 +0100
commit0fe106869314de8b983a2e61ee7c878ba4f936bf (patch)
tree1bfa517d7990c507b1139100c1026772dedb3232 /include/osmocom/bsc
parent02b02e893bcc0cfd1419be6584da4ed94c4f396b (diff)
HO prep: introduce per-BTS handover config, with defaults on net node
It is desirable to allow configuring handover for each individual network cell. At the same time, it is desirable to set global defaults. Treat the 'network' node handover parameters as global defaults, add another set of parameters for each individual BTS. This raises questions on how the 'network' node should affect the individual BTS. The simplistic solution would have been: on creating a BTS in the config, just copy the current defaults; with serious drawbacks: - tweaking any parameter in the telnet VTY on network node will never affect any running BTS. - network node defaults *must* be issued before the bts sections in the config file. - when writing a config back to file, we would copy all net node defaults to each BTS node, making the network node configs pointless. Instead, add a handover_cfg API that tracks whether a given node has a value set or not. A bts node ho_cfg gets a pointer to the network node config and returns those values if locally unset. If no value is set on any node, use the "factory" defaults, which are hardcoded in the API. Only write back exactly those config items that were actually issued in a config file / on the telnet VTY. (ho_cfg API wise, we could trivially add another ho_cfg level per TRX if we so desire in the future.) Implement ho parameters as an opaque config struct with getters and setters to ensure the tracking is always heeded. Opaqueness dictates allocating instead of direct embedding in gsm_network and gsm_bts structs, ctx is gsm_net / bts. This is 100% backwards compatible to old configs. - No VTY command syntax changes (only the online help). - If a 'bts' sets nothing, it will use the 'network' defaults. - The 'show network' output only changes in presence of individual BTS configs. On 'show network', say "Handover: On|Off" as before, iff all BTS reflect identical behavior. Otherwise, output BTS counts of handover being enabled or not. Use the same set of VTY commands (same VTY cmd syntax as before) on network and BTS nodes, i.e. don't duplicate VTY code. From the current vty->node, figure out which ho_cfg to modify. For linking, add handover_cfg.c (the value API) in libcommon, while the handover_vty.c is in libbsc. This is mainly because some utility programs use gsm_network and hence suck in the ho stuff, but don't need the VTY commands. Review the VTY online help strings. Add VTY transcript test for handover options, testing config propagation from network to bts nodes, 'show network' output and VTY online help strings. (Needs recent addition of '... !' wildcard to osmo_interact_common.py.) I considered leaving parts of this more readable, but in the end decided for heavy use of macros to define and declare the API, because more values will be added in upcoming patches and I want to prevent myself from messing them up. Inspired-by: jolly/new_handover branch, which moves the config to 'bts' level Depends: I7c1ebb2e7f059047903a53de26a0ec1ce7fa9b98 (osmo-python-tests) Change-Id: I79d35f6d3c0fbee67904378ad7f216df34fde79a
Diffstat (limited to 'include/osmocom/bsc')
-rw-r--r--include/osmocom/bsc/Makefile.am2
-rw-r--r--include/osmocom/bsc/gsm_data.h17
-rw-r--r--include/osmocom/bsc/gsm_data_shared.h2
-rw-r--r--include/osmocom/bsc/handover_cfg.h112
-rw-r--r--include/osmocom/bsc/handover_vty.h7
5 files changed, 124 insertions, 16 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index b067fc2b2..699aeb339 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -25,7 +25,9 @@ noinst_HEADERS = \
gsm_data.h \
gsm_data_shared.h \
handover.h \
+ handover_cfg.h \
handover_decision.h \
+ handover_vty.h \
ipaccess.h \
meas_feed.h \
meas_rep.h \
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 0ff58117e..f07a593cc 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -225,22 +225,7 @@ struct gsm_network {
uint16_t network_code;
int a5_encryption;
int neci;
- struct {
- int active;
- /* Window RXLEV averaging */
- unsigned int win_rxlev_avg; /* number of SACCH frames */
- /* Window RXQUAL averaging */
- unsigned int win_rxqual_avg; /* number of SACCH frames */
- /* Window RXLEV neighbouring cells averaging */
- unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */
-
- /* how often should we check for power budget HO */
- unsigned int pwr_interval; /* SACCH frames */
- /* how much better does a neighbor cell have to be ? */
- unsigned int pwr_hysteresis; /* dBm */
- /* maximum distacne before we try a handover */
- unsigned int max_distance; /* TA values */
- } handover;
+ struct handover_cfg *ho;
struct rate_ctr_group *bsc_ctrs;
diff --git a/include/osmocom/bsc/gsm_data_shared.h b/include/osmocom/bsc/gsm_data_shared.h
index db854fd00..fd566d2dd 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -799,6 +799,8 @@ struct gsm_bts {
struct pcu_sock_state *pcu_state;
struct rate_ctr_group *bts_ctrs;
+
+ struct handover_cfg *ho;
};
diff --git a/include/osmocom/bsc/handover_cfg.h b/include/osmocom/bsc/handover_cfg.h
new file mode 100644
index 000000000..264cb1bc1
--- /dev/null
+++ b/include/osmocom/bsc/handover_cfg.h
@@ -0,0 +1,112 @@
+#pragma once
+
+#include <stdbool.h>
+
+struct vty;
+
+/* handover_cfg is an opaque struct to manage several levels of configuration. There is an overall handover
+ * config on 'network' level and a per-'bts' specific handover config. If the 'bts' level sets no values,
+ * the defaults from 'network' level are used implicitly, and changes take effect immediately. */
+struct handover_cfg;
+
+struct handover_cfg *ho_cfg_init(void *ctx, struct handover_cfg *higher_level_cfg);
+
+#define HO_CFG_STR_HANDOVER "Handover options\n"
+#define HO_CFG_STR_WIN HO_CFG_STR_HANDOVER "Measurement averaging settings\n"
+#define HO_CFG_STR_WIN_RXLEV HO_CFG_STR_WIN "Received-Level averaging\n"
+#define HO_CFG_STR_WIN_RXQUAL HO_CFG_STR_WIN "Received-Quality averaging\n"
+#define HO_CFG_STR_POWER_BUDGET HO_CFG_STR_HANDOVER "Neighbor cell power triggering\n" "Neighbor cell power triggering\n"
+#define HO_CFG_STR_AVG_COUNT "Number of values to average over\n"
+
+#define as_is(x) (x)
+
+static inline bool a2bool(const char *arg)
+{
+ return (bool)(atoi(arg));
+}
+
+static inline int bool2i(bool arg)
+{
+ return arg? 1 : 0;
+}
+
+
+/* The HO_CFG_ONE_MEMBER macro gets redefined, depending on whether to define struct members,
+ * function declarations or definitions... It is of the format
+ * HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL,
+ * VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL,
+ * VTY_WRITE_FMT, VTY_WRITE_CONV,
+ * VTY_DOC)
+ * Then using HO_CFG_ALL_MEMBERS can save a lot of code dup in defining API declaration, API
+ * definitions, VTY commands and VTY write code. Of course this doesn't prevent us from adding manual
+ * members as well, in case future additions don't fit in this scheme.
+ *
+ * TYPE: a type name like int.
+ * NAME: a variable name suitable for a struct member.
+ * DEFAULT_VAL: default value, as passed to the VTY, e.g. '0' or 'foo', without quotes.
+ * VTY_CMD: a command string for VTY without any arguments.
+ * VTY_CMD_ARG: VTY value range like '<0-23>' or 'foo|bar', will become '(VTY_CMD_ARG|default)'.
+ * VTY_ARG_EVAL: function name for parsing the VTY arg[0], e.g. 'atoi'.
+ * VTY_WRITE_FMT: printf-like string format for vty_out().
+ * VTY_WRITE_CONV: function name to convert struct value to VTY_WRITE_FMT, e.g. 'as_is'.
+ * VTY_DOC: VTY documentation strings to match VTY_CMD and VTY_CMD_ARGs.
+ */
+#define HO_CFG_ALL_MEMBERS \
+ \
+ HO_CFG_ONE_MEMBER(bool, ho_active, 0, \
+ "handover", "0|1", a2bool, "%d", bool2i, \
+ HO_CFG_STR_HANDOVER \
+ "Disable in-call handover\n" \
+ "Enable in-call handover\n" \
+ "Enable/disable handover: ") \
+ \
+ HO_CFG_ONE_MEMBER(unsigned int, rxlev_avg_win, 10, \
+ "handover window rxlev averaging", "<1-10>", atoi, "%u", as_is, \
+ HO_CFG_STR_WIN_RXLEV \
+ "How many RxLev measurements are used for averaging\n" \
+ "RxLev averaging: " HO_CFG_STR_AVG_COUNT) \
+ \
+ HO_CFG_ONE_MEMBER(unsigned int, rxqual_avg_win, 1, \
+ "handover window rxqual averaging", "<1-10>", atoi, "%u", as_is, \
+ HO_CFG_STR_WIN_RXQUAL \
+ "How many RxQual measurements are used for averaging\n" \
+ "RxQual averaging: " HO_CFG_STR_AVG_COUNT) \
+ \
+ HO_CFG_ONE_MEMBER(unsigned int, rxlev_neigh_avg_win, 10, \
+ "handover window rxlev neighbor averaging", "<1-10>", atoi, "%u", as_is, \
+ HO_CFG_STR_WIN_RXLEV \
+ "How many Neighbor RxLev measurements are used for averaging\n" \
+ "How many Neighbor RxLev measurements are used for averaging\n" \
+ "Neighbor RxLev averaging: " HO_CFG_STR_AVG_COUNT) \
+ \
+ HO_CFG_ONE_MEMBER(unsigned int, pwr_interval, 6, \
+ "handover power budget interval", "<1-99>", atoi, "%u", as_is, \
+ HO_CFG_STR_POWER_BUDGET \
+ "How often to check for a better cell (SACCH frames)\n" \
+ "Check for stronger neighbor every N number of SACCH frames\n") \
+ \
+ HO_CFG_ONE_MEMBER(unsigned int, pwr_hysteresis, 3, \
+ "handover power budget hysteresis", "<0-999>", atoi, "%u", as_is, \
+ HO_CFG_STR_POWER_BUDGET \
+ "How many dBm stronger must a neighbor be to become a HO candidate\n" \
+ "Neighbor's strength difference in dBm\n") \
+ \
+ HO_CFG_ONE_MEMBER(unsigned int, max_distance, 9999, \
+ "handover maximum distance" , "<0-9999>", atoi, "%u", as_is, \
+ HO_CFG_STR_HANDOVER \
+ "Maximum Timing-Advance value (i.e. MS distance) before triggering HO\n" \
+ "Maximum Timing-Advance value (i.e. MS distance) before triggering HO\n" \
+ "Maximum Timing-Advance value (i.e. MS distance) before triggering HO\n") \
+
+
+/* Declare public API for handover cfg parameters... */
+
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \
+ TYPE ho_get_##NAME(struct handover_cfg *ho); \
+ void ho_set_##NAME(struct handover_cfg *ho, TYPE val); \
+ bool ho_isset_##NAME(struct handover_cfg *ho); \
+ void ho_clear_##NAME(struct handover_cfg *ho); \
+ bool ho_isset_on_parent_##NAME(struct handover_cfg *ho);
+
+HO_CFG_ALL_MEMBERS
+#undef HO_CFG_ONE_MEMBER
diff --git a/include/osmocom/bsc/handover_vty.h b/include/osmocom/bsc/handover_vty.h
new file mode 100644
index 000000000..48af136e5
--- /dev/null
+++ b/include/osmocom/bsc/handover_vty.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#include <osmocom/vty/vty.h>
+#include <osmocom/bsc/handover_cfg.h>
+
+void ho_vty_init();
+void ho_vty_write(struct vty *vty, const char *indent, struct handover_cfg *ho);