From 6dff51d583bbdd2beb9bbbc27ba65abf1df99a9c Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 12 Feb 2018 16:56:41 +0100 Subject: HO: add new_lchan_type arg to bsc_handover_start() Upcoming handover_decision_2 will want to be able to handover to a differing TCH type, hence add a parameter to bsc_handover_start(); adjust current callers to pass the old lchan type. Tweak the 'bts' argument to 'new_bts'. Change-Id: I4478ebcaada00897cc38c5a299e07661139ed3c5 --- src/libbsc/handover_logic.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/libbsc/handover_logic.c') diff --git a/src/libbsc/handover_logic.c b/src/libbsc/handover_logic.c index 20ecc6c1b..b7f350ff3 100644 --- a/src/libbsc/handover_logic.c +++ b/src/libbsc/handover_logic.c @@ -38,6 +38,7 @@ #include #include #include +#include struct bsc_handover { struct llist_head list; @@ -86,10 +87,11 @@ static struct bsc_handover *bsc_ho_by_old_lchan(struct gsm_lchan *old_lchan) return NULL; } -/*! \brief Hand over the specified logical channel to the specified new BTS. - * This is the main entry point for the actual handover algorithm, after the - * decision whether to initiate HO to a specific BTS. */ -int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts) +/*! Hand over the specified logical channel to the specified new BTS and possibly change the lchan type. + * This is the main entry point for the actual handover algorithm, after the decision whether to initiate + * HO to a specific BTS. To not change the lchan type, pass old_lchan->type. */ +int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *new_bts, + enum gsm_chan_t new_lchan_type) { struct gsm_lchan *new_lchan; struct bsc_handover *ho; @@ -103,19 +105,19 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts) DEBUGP(DHO, "Beginning with handover operation" "(old_lchan on BTS %u, new BTS %u) ...\n", - old_lchan->ts->trx->bts->nr, bts->nr); + old_lchan->ts->trx->bts->nr, new_bts->nr); - rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_HANDOVER_ATTEMPTED]); + rate_ctr_inc(&new_bts->network->bsc_ctrs->ctr[BSC_CTR_HANDOVER_ATTEMPTED]); if (!old_lchan->conn) { LOGP(DHO, LOGL_ERROR, "Old lchan lacks connection data.\n"); return -ENOSPC; } - new_lchan = lchan_alloc(bts, old_lchan->type, 0); + new_lchan = lchan_alloc(new_bts, new_lchan_type, 0); if (!new_lchan) { - LOGP(DHO, LOGL_NOTICE, "No free channel\n"); - rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_HANDOVER_NO_CHANNEL]); + LOGP(DHO, LOGL_NOTICE, "No free channel for %s\n", gsm_lchant_name(new_lchan_type)); + rate_ctr_inc(&new_bts->network->bsc_ctrs->ctr[BSC_CTR_HANDOVER_NO_CHANNEL]); return -ENOSPC; } @@ -128,7 +130,7 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts) ho->old_lchan = old_lchan; ho->new_lchan = new_lchan; ho->ho_ref = ho_ref++; - if (old_lchan->ts->trx->bts != bts) { + if (old_lchan->ts->trx->bts != new_bts) { ho->inter_cell = true; ho->async = true; } -- cgit v1.2.3