aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcommon
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-11-27 21:29:33 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-01-19 16:03:16 +0100
commite25018b8c1b24f049ec38c6085a8c4ba2d983185 (patch)
treec78780f7f1feab6ed917c056592b9ebcc9a32ce8 /src/libcommon
parentbe1131df42b3e0a7b4113ecc0c159977ecc8fae7 (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 'src/libcommon')
-rw-r--r--src/libcommon/Makefile.am1
-rw-r--r--src/libcommon/gsm_data.c1
-rw-r--r--src/libcommon/gsm_data_shared.c3
-rw-r--r--src/libcommon/handover_cfg.c83
4 files changed, 88 insertions, 0 deletions
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index c66cbcdcd..9f7e7b9e9 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -27,4 +27,5 @@ libcommon_a_SOURCES = \
gsm_data_shared.c \
socket.c \
talloc_ctx.c \
+ handover_cfg.c \
$(NULL)
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index 87d954ad8..92ebbfe0c 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -37,6 +37,7 @@
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/bsc_msc_data.h>
#include <osmocom/bsc/abis_nm.h>
+#include <osmocom/bsc/handover_cfg.h>
void *tall_bsc_ctx;
diff --git a/src/libcommon/gsm_data_shared.c b/src/libcommon/gsm_data_shared.c
index c14047d49..e4ec594f8 100644
--- a/src/libcommon/gsm_data_shared.c
+++ b/src/libcommon/gsm_data_shared.c
@@ -33,6 +33,7 @@
#include <osmocom/core/statistics.h>
#include <osmocom/bsc/gsm_data.h>
+#include <osmocom/bsc/handover_cfg.h>
void gsm_abis_mo_reset(struct gsm_abis_mo *mo)
{
@@ -374,6 +375,8 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
/* si handling */
bts->bcch_change_mark = 1;
+ bts->ho = ho_cfg_init(bts, net->ho);
+
return bts;
}
diff --git a/src/libcommon/handover_cfg.c b/src/libcommon/handover_cfg.c
new file mode 100644
index 000000000..8c208f669
--- /dev/null
+++ b/src/libcommon/handover_cfg.c
@@ -0,0 +1,83 @@
+/* OsmoBSC handover configuration implementation */
+/* (C) 2017 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ * (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
+ * All Rights Reserved
+ *
+ * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdbool.h>
+#include <talloc.h>
+
+#include <osmocom/bsc/vty.h>
+#include <osmocom/bsc/handover_cfg.h>
+#include <osmocom/bsc/gsm_data.h>
+
+struct handover_cfg {
+ struct handover_cfg *higher_level_cfg;
+
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \
+ TYPE NAME; \
+ bool has_##NAME;
+
+ HO_CFG_ALL_MEMBERS
+#undef HO_CFG_ONE_MEMBER
+};
+
+struct handover_cfg *ho_cfg_init(void *ctx, struct handover_cfg *higher_level_cfg)
+{
+ struct handover_cfg *ho = talloc_zero(ctx, struct handover_cfg);
+ OSMO_ASSERT(ho);
+ ho->higher_level_cfg = higher_level_cfg;
+ return ho;
+}
+
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY_ARG_EVAL, VTY4, VTY5, VTY6) \
+TYPE ho_get_##NAME(struct handover_cfg *ho) \
+{ \
+ if (ho->has_##NAME) \
+ return ho->NAME; \
+ if (ho->higher_level_cfg) \
+ return ho_get_##NAME(ho->higher_level_cfg); \
+ return VTY_ARG_EVAL(#DEFAULT_VAL); \
+} \
+\
+void ho_set_##NAME(struct handover_cfg *ho, TYPE value) \
+{ \
+ ho->NAME = value; \
+ ho->has_##NAME = true; \
+} \
+\
+bool ho_isset_##NAME(struct handover_cfg *ho) \
+{ \
+ return ho->has_##NAME; \
+} \
+\
+void ho_clear_##NAME(struct handover_cfg *ho) \
+{ \
+ ho->has_##NAME = false; \
+} \
+\
+bool ho_isset_on_parent_##NAME(struct handover_cfg *ho) \
+{ \
+ return ho->higher_level_cfg \
+ && (ho_isset_##NAME(ho->higher_level_cfg) \
+ || ho_isset_on_parent_##NAME(ho->higher_level_cfg)); \
+}
+
+HO_CFG_ALL_MEMBERS
+#undef HO_CFG_ONE_MEMBER