summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/handover_logic.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-10-11 13:01:38 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-06-17 21:49:02 +0200
commit1cba3fce705c2d103952811599ed1bf9781c9e09 (patch)
treed3d18969a167ffd104fbb9516cbcbda647f19fd9 /openbsc/src/libbsc/handover_logic.c
parent7500d737e8434cea846e76b1c57ae5d1561fb63e (diff)
dyn PDCH: Add new_lchan argument to bsc_handover_start()
This is useful if the caller already allocated a new lchan, which will be used to dynamically re-assign lchans. The old behavior is maintained by passing NULL. Change-Id: I2b7151f32f0c04c22f294eb5dd3c7d7dfddf35e7
Diffstat (limited to 'openbsc/src/libbsc/handover_logic.c')
-rw-r--r--openbsc/src/libbsc/handover_logic.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c
index 56b623a..de80526 100644
--- a/openbsc/src/libbsc/handover_logic.c
+++ b/openbsc/src/libbsc/handover_logic.c
@@ -87,10 +87,13 @@ static struct bsc_handover *bsc_ho_by_old_lchan(struct gsm_lchan *old_lchan)
/*! \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)
+ * decision whether to initiate HO to a specific BTS.
+ *
+ * If new_lchan is NULL, allocate a new lchan. If not NULL, new_lchan must be a
+ * newly allocated lchan passed in by the caller. */
+int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan,
+ struct gsm_bts *new_bts)
{
- struct gsm_lchan *new_lchan;
struct bsc_handover *ho;
static uint8_t ho_ref;
int rc;
@@ -101,19 +104,20 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
return -EBUSY;
DEBUGP(DHO, "(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);
- osmo_counter_inc(bts->network->stats.handover.attempted);
+ osmo_counter_inc(new_bts->network->stats.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);
+ if (!new_lchan)
+ new_lchan = lchan_alloc(new_bts, old_lchan->type, 0);
if (!new_lchan) {
LOGP(DHO, LOGL_NOTICE, "No free channel\n");
- osmo_counter_inc(bts->network->stats.handover.no_channel);
+ osmo_counter_inc(new_bts->network->stats.handover.no_channel);
return -ENOSPC;
}