aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/bsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-22 04:54:57 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-06-16 15:53:51 +0200
commitd4a80811026effef6fdd01cc67e811b8dc76c9cc (patch)
tree73b62bcae6db77c15483a5b0e557e72606733e92 /include/osmocom/bsc
parenta677148aa453eeadf611a5fc021c9ede30f7cf9b (diff)
inter-BSC HO: add neighbor_ident API to manage neighbor-BSS-cells
Diffstat (limited to 'include/osmocom/bsc')
-rw-r--r--include/osmocom/bsc/Makefile.am1
-rw-r--r--include/osmocom/bsc/gsm_data.h19
-rw-r--r--include/osmocom/bsc/neighbor_ident.h60
3 files changed, 80 insertions, 0 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 5fa39ebc5..18737a390 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -27,6 +27,7 @@ noinst_HEADERS = \
meas_feed.h \
meas_rep.h \
misdn.h \
+ neighbor_ident.h \
network_listen.h \
openbscdefines.h \
osmo_bsc.h \
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index a0bf3281f..1cba22e68 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -35,6 +35,7 @@
struct mgcp_client_conf;
struct mgcp_client;
struct mgcp_ctx;
+struct gsm0808_cell_id;
/** annotations for msgb ownership */
#define __uses
@@ -750,6 +751,12 @@ struct load_counter {
unsigned int used;
};
+/* Useful to track N-N relations between BTS, for example neighbors. */
+struct gsm_bts_ref {
+ struct llist_head entry;
+ struct gsm_bts *bts;
+};
+
/* One BTS */
struct gsm_bts {
/* list header in net->bts_list */
@@ -984,6 +991,11 @@ struct gsm_bts {
struct handover_cfg *ho;
+ /* A list of struct gsm_bts_ref, indicating neighbors of this BTS.
+ * When the si_common neigh_list is in automatic mode, it is populated from this list as well as
+ * gsm_network->neighbor_bss_cells. */
+ struct llist_head local_neighbors;
+
/* BTS-specific overrides for timer values from struct gsm_network. */
uint8_t T3122; /* ASSIGMENT REJECT wait indication */
@@ -998,6 +1010,10 @@ struct gsm_network *gsm_network_init(void *ctx);
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num);
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
+bool gsm_bts_matches_cell_id(struct gsm_bts *bts, const struct gsm0808_cell_id *ci);
+struct gsm_bts *gsm_bts_by_cell_id(struct gsm_network *net, const struct gsm0808_cell_id *ci);
+int gsm_bts_local_neighbor_add(struct gsm_bts *bts, struct gsm_bts *neighbor);
+int gsm_bts_local_neighbor_del(struct gsm_bts *bts, const struct gsm_bts *neighbor);
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
@@ -1333,6 +1349,9 @@ struct gsm_network {
struct mgcp_client_conf *conf;
struct mgcp_client *client;
} mgw;
+
+ /* Remote BSS Cell Identifier Lists */
+ struct neighbor_ident_list *neighbor_bss_cells;
};
static inline const struct osmo_location_area_id *bts_lai(struct gsm_bts *bts)
diff --git a/include/osmocom/bsc/neighbor_ident.h b/include/osmocom/bsc/neighbor_ident.h
new file mode 100644
index 000000000..86e062a67
--- /dev/null
+++ b/include/osmocom/bsc/neighbor_ident.h
@@ -0,0 +1,60 @@
+/* Manage identity of neighboring BSS cells for inter-BSC handover */
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <osmocom/core/linuxlist.h>
+
+struct vty;
+struct gsm_network;
+struct gsm_bts;
+struct neighbor_ident_list;
+struct gsm0808_cell_id_list2;
+
+enum bsic_kind {
+ BSIC_NONE,
+ BSIC_6BIT,
+ BSIC_9BIT,
+};
+
+#define NEIGHBOR_IDENT_KEY_ANY_BTS -1
+
+struct neighbor_ident_key {
+ int from_bts; /*< BTS nr 0..255 or NEIGHBOR_IDENT_KEY_ANY_BTS */
+ uint16_t arfcn;
+ enum bsic_kind bsic_kind;
+ uint16_t bsic;
+};
+
+const char *neighbor_ident_key_name(const struct neighbor_ident_key *ni_key);
+
+struct neighbor_ident_list *neighbor_ident_init(void *talloc_ctx);
+void neighbor_ident_free(struct neighbor_ident_list *nil);
+
+bool neighbor_ident_key_match(const struct neighbor_ident_key *entry,
+ const struct neighbor_ident_key *search_for,
+ bool exact_match);
+
+int neighbor_ident_add(struct neighbor_ident_list *nil, const struct neighbor_ident_key *key,
+ const struct gsm0808_cell_id_list2 *val);
+const struct gsm0808_cell_id_list2 *neighbor_ident_get(const struct neighbor_ident_list *nil,
+ const struct neighbor_ident_key *key);
+bool neighbor_ident_del(struct neighbor_ident_list *nil, const struct neighbor_ident_key *key);
+void neighbor_ident_clear(struct neighbor_ident_list *nil);
+
+void neighbor_ident_iter(const struct neighbor_ident_list *nil,
+ bool (* iter_cb )(const struct neighbor_ident_key *key,
+ const struct gsm0808_cell_id_list2 *val,
+ void *cb_data),
+ void *cb_data);
+
+void neighbor_ident_vty_init(struct gsm_network *net, struct neighbor_ident_list *nil);
+void neighbor_ident_vty_write(struct vty *vty, const char *indent, struct gsm_bts *bts);
+
+#define NEIGHBOR_IDENT_VTY_KEY_PARAMS "arfcn <0-1023> (bsic|bsic9) (<0-511>|any)"
+#define NEIGHBOR_IDENT_VTY_KEY_DOC \
+ "ARFCN of neighbor cell\n" "ARFCN value\n" \
+ "BSIC of neighbor cell\n" "9-bit BSIC of neighbor cell\n" "BSIC value\n" \
+ "for all BSICs / use any BSIC in this ARFCN\n"
+bool neighbor_ident_vty_parse_key_params(struct vty *vty, const char **argv, struct neighbor_ident_key *key);