Review at  https://gerrit.osmocom.org/6463

HO: add bsc_handover_start_lchan_change()

Upcoming handover_decision_2 will want to be able to handover to a differing
TCH type, hence "add a parameter" to bsc_handover_start() by introducing
bsc_handover_start_lchan_change().

The previous bsc_handover_start() passes the old lchan type to the new function
to provide unchanged behavior. Callers of the current signature are
handover_decision.c (HO algo 1) and bsc_vty.c (manual HO triggering).

Change-Id: I4478ebcaada00897cc38c5a299e07661139ed3c5
---
M include/osmocom/bsc/handover.h
M src/libbsc/handover_logic.c
2 files changed, 19 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/63/6463/1

diff --git a/include/osmocom/bsc/handover.h b/include/osmocom/bsc/handover.h
index a9349ee..f764456 100644
--- a/include/osmocom/bsc/handover.h
+++ b/include/osmocom/bsc/handover.h
@@ -5,6 +5,8 @@
 struct gsm_subscriber_connection;
 
 int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts);
+int bsc_handover_start_lchan_change(struct gsm_lchan *old_lchan, struct 
gsm_bts *bts,
+                                   enum gsm_chan_t new_lchan_type);
 void bsc_clear_handover(struct gsm_subscriber_connection *conn, int 
free_lchan);
 struct gsm_lchan *bsc_handover_pending(struct gsm_lchan *new_lchan);
 
diff --git a/src/libbsc/handover_logic.c b/src/libbsc/handover_logic.c
index fd06a54..013377e 100644
--- a/src/libbsc/handover_logic.c
+++ b/src/libbsc/handover_logic.c
@@ -38,6 +38,7 @@
 #include <osmocom/core/talloc.h>
 #include <osmocom/bsc/bsc_subscriber.h>
 #include <osmocom/bsc/gsm_04_08_utils.h>
+#include <osmocom/bsc/handover.h>
 
 struct bsc_handover {
        struct llist_head list;
@@ -86,10 +87,17 @@
        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. */
+/*! Hand over the specified logical channel to the specified new BTS. */
 int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
+{
+       return bsc_handover_start_lchan_change(old_lchan, bts, old_lchan->type);
+}
+
+/*! 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. */
+int bsc_handover_start_lchan_change(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 +111,19 @@
 
        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 +136,7 @@
        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;
        }

-- 
To view, visit https://gerrit.osmocom.org/6463
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4478ebcaada00897cc38c5a299e07661139ed3c5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to