From 1c251f0c9f59a56c991b254563455adf6c678200 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 8 Jan 2018 15:44:56 +0100 Subject: HO: rename gsm_bts_neighbor() to bts_by_arfcn_bsic() The name sounds like it is looking up neighbors, instead it simply traverses the global list of BTSes. Rename to reflect what it does. Move FIXME comment to its logical place: at the invocation of bts_by_arfcn_bsic(). Change-Id: I063870d09f782a4f18e85d87c7cd17fe660cb3fd --- src/libbsc/handover_decision.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/libbsc/handover_decision.c b/src/libbsc/handover_decision.c index 069361343..93ca28bfa 100644 --- a/src/libbsc/handover_decision.c +++ b/src/libbsc/handover_decision.c @@ -35,21 +35,16 @@ #include #include -/* Get reference to a neighbor cell on a given BCCH ARFCN */ -static struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, - uint16_t arfcn, uint8_t bsic) +/* Find BTS by ARFCN and BSIC */ +static struct gsm_bts *bts_by_arfcn_bsic(const struct gsm_network *net, + uint16_t arfcn, uint8_t bsic) { - struct gsm_bts *neigh; - /* FIXME: use some better heuristics here to determine which cell - * using this ARFCN really is closest to the target cell. For - * now we simply assume that each ARFCN will only be used by one - * cell */ + struct gsm_bts *bts; - llist_for_each_entry(neigh, &bts->network->bts_list, list) { - /* FIXME: this is probably returning the same bts again!? */ - if (neigh->c0->arfcn == arfcn && - neigh->bsic == bsic) - return neigh; + llist_for_each_entry(bts, &net->bts_list, list) { + if (bts->c0->arfcn == arfcn && + bts->bsic == bsic) + return bts; } return NULL; @@ -63,7 +58,11 @@ static int handover_to_arfcn_bsic(struct gsm_lchan *lchan, struct gsm_bts *new_bts; /* resolve the gsm_bts structure for the best neighbor */ - new_bts = gsm_bts_neighbor(lchan->ts->trx->bts, arfcn, bsic); + /* FIXME: use some better heuristics here to determine which cell + * using this ARFCN really is closest to the target cell. For + * now we simply assume that each ARFCN will only be used by one + * cell */ + new_bts = bts_by_arfcn_bsic(lchan->ts->trx->bts->network, arfcn, bsic); if (!new_bts) { LOGP(DHODEC, LOGL_NOTICE, "unable to determine neighbor BTS " "for ARFCN %u BSIC %u ?!?\n", arfcn, bsic); -- cgit v1.2.3