diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-22 04:54:57 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-07-28 12:18:23 +0200 |
commit | 19bed23065e19caac62b4a6cfe565e609046da7d (patch) | |
tree | 2dbb8b89ae72974c4a9a1498b52af887898aed86 /include | |
parent | 08d02dd5100cbff47922427e3beb31a3373bf75c (diff) |
inter-BSC HO: add neighbor_ident API to manage neighbor-BSS-cells
Depends: Ia71ba742108b5ff020997bfb612ad5eb30d04fcd (libosmocore)
Change-Id: I0153d7069817fba9146ddc11214de2757d7d37bf
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/bsc/Makefile.am | 1 | ||||
-rw-r--r-- | include/osmocom/bsc/gsm_data.h | 22 | ||||
-rw-r--r-- | include/osmocom/bsc/handover.h | 6 | ||||
-rw-r--r-- | include/osmocom/bsc/neighbor_ident.h | 63 |
4 files changed, 92 insertions, 0 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index dfab5929c..0b576cddd 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -28,6 +28,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 579461732..a16a4b743 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,13 @@ 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_lai(const struct gsm_bts *bts, const struct osmo_location_area_id *lai); +bool gsm_bts_matches_cell_id(const struct gsm_bts *bts, const struct gsm0808_cell_id *cell_id); +struct gsm_bts *gsm_bts_by_cell_id(const struct gsm_network *net, + const struct gsm0808_cell_id *cell_id, + int match_idx); +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); @@ -1281,6 +1300,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/handover.h b/include/osmocom/bsc/handover.h index 772ab98e2..aa117cc24 100644 --- a/include/osmocom/bsc/handover.h +++ b/include/osmocom/bsc/handover.h @@ -6,6 +6,8 @@ #include <osmocom/core/timer.h> #include <osmocom/gsm/gsm_utils.h> +#include <osmocom/bsc/neighbor_ident.h> + struct gsm_lchan; struct gsm_bts; struct gsm_subscriber_connection; @@ -94,3 +96,7 @@ struct handover_decision_callbacks { void handover_decision_callbacks_register(struct handover_decision_callbacks *hdc); struct handover_decision_callbacks *handover_decision_callbacks_get(int hodec_id); + +struct gsm_bts *bts_by_neighbor_ident(const struct gsm_network *net, + const struct neighbor_ident_key *search_for); +struct neighbor_ident_key *bts_ident_key(const 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..bba18c3e3 --- /dev/null +++ b/include/osmocom/bsc/neighbor_ident.h @@ -0,0 +1,63 @@ +/* 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); +bool neighbor_ident_bts_parse_key_params(struct vty *vty, struct gsm_bts *bts, const char **argv, + struct neighbor_ident_key *key); |