aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-10-19 15:13:10 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-11-01 01:15:03 +0100
commit8e5b8def075c064093b3deae16af57b7b9b27c80 (patch)
tree81fbdbf8d3a33499bdd7a008d12e231f4dfb9d23
parent7a9104bfada915bb41a34b862120a4e85b847793 (diff)
handover: skip legacy neighbors if explicit neighbors exist
We ignore the legacy neighbor-list configuration in the presence of explicit neighbor mappings -- so far this applied only to local-BSS neighbors. Also skip the neighbor-list configuration in the presence of remote-BSS neighbors. At first, I was not entirely sure whether this patch is necessary, but it serves clarity. Consider: it might make sense to a user to use legacy 'neighbor-list' configuration for local-BSS cells, and only add some remote-BSS cells using the new 'neighbor' config item; from that POV it makes sense to still heed 'neighbor-list' even if remote-BSS neighbors are configured, and to only ignore 'neighbor-list' if there are actual local-BSS neighbor mappings. However, it is not always immediately obvious whether a given neighbor mapping refers to a local-BSS or a remote-BSS neighbor. So, let's not convolute the new and old configuration schemes in weird ways: rather completely ignore a cell's legacy 'neighbor-list' config as soon as any new 'neighbor' mapping exists on it. Change-Id: I3ae22552db521ea640d4343078acb36048119ed2
-rw-r--r--src/osmo-bsc/system_information.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c
index 2104e9272..e0c83aeb7 100644
--- a/src/osmo-bsc/system_information.c
+++ b/src/osmo-bsc/system_information.c
@@ -594,6 +594,7 @@ static int bitvec2freq_list(uint8_t *chan_list, struct bitvec *bv,
struct generate_bcch_chan_list__ni_iter_data {
struct gsm_bts *bts;
struct bitvec *bv;
+ unsigned int count;
};
static bool generate_bcch_chan_list__ni_iter_cb(const struct neighbor_ident_key *key,
@@ -607,6 +608,7 @@ static bool generate_bcch_chan_list__ni_iter_cb(const struct neighbor_ident_key
return true;
bitvec_set_bit_pos(data->bv, key->arfcn, 1);
+ data->count ++;
return true;
}
@@ -632,32 +634,31 @@ static int generate_bcch_chan_list(uint8_t *chan_list, struct gsm_bts *bts,
/* Generate list of neighbor cells if we are in automatic mode */
if (bts->neigh_list_manual_mode == NL_MODE_AUTOMATIC) {
+ struct generate_bcch_chan_list__ni_iter_data ni_data = {
+ .bv = bv,
+ .bts = bts,
+ };
+
/* Zero-initialize the bit-vector */
memset(bv->data, 0, bv->data_len);
- if (llist_empty(&bts->local_neighbors)) {
- /* There are no explicit neighbors, assume all BTS are. */
- llist_for_each_entry(cur_bts, &bts->network->bts_list, list) {
- if (cur_bts == bts)
- continue;
- bitvec_set_bit_pos(bv, cur_bts->c0->arfcn, 1);
- }
- } else {
+ /* Add neighboring BSS cells' ARFCNs */
+ neighbor_ident_iter(bts->network->neighbor_bss_cells,
+ generate_bcch_chan_list__ni_iter_cb, &ni_data);
+
+ if (!llist_empty(&bts->local_neighbors)) {
/* Only add explicit neighbor cells */
struct gsm_bts_ref *neigh;
llist_for_each_entry(neigh, &bts->local_neighbors, entry) {
bitvec_set_bit_pos(bv, neigh->bts->c0->arfcn, 1);
}
- }
-
- /* Also add neighboring BSS cells' ARFCNs */
- {
- struct generate_bcch_chan_list__ni_iter_data data = {
- .bv = bv,
- .bts = bts,
- };
- neighbor_ident_iter(bts->network->neighbor_bss_cells,
- generate_bcch_chan_list__ni_iter_cb, &data);
+ } else if (!ni_data.count) {
+ /* There are no explicit neighbors, assume all local BTS are. */
+ llist_for_each_entry(cur_bts, &bts->network->bts_list, list) {
+ if (cur_bts == bts)
+ continue;
+ bitvec_set_bit_pos(bv, cur_bts->c0->arfcn, 1);
+ }
}
}