[MERGED] osmo-bsc[master]: HO: add new_lchan_type arg to bsc_handover_start()

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Feb 16 15:37:09 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: HO: add new_lchan_type arg to bsc_handover_start()
......................................................................


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
---
M include/osmocom/bsc/handover.h
M src/libbsc/bsc_vty.c
M src/libbsc/handover_decision.c
M src/libbsc/handover_logic.c
4 files changed, 16 insertions(+), 13 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/handover.h b/include/osmocom/bsc/handover.h
index a9349ee..bbb448c 100644
--- a/include/osmocom/bsc/handover.h
+++ b/include/osmocom/bsc/handover.h
@@ -4,7 +4,8 @@
 struct gsm_bts;
 struct gsm_subscriber_connection;
 
-int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts);
+int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *new_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/bsc_vty.c b/src/libbsc/bsc_vty.c
index e48275d..f5f77dd 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -1399,7 +1399,7 @@
 	} else
 		LOGP(DHO, LOGL_NOTICE, "%s (ARFCN %u) --> BTS %u Manually triggering Handover from VTY\n",
 		     gsm_lchan_name(from_lchan), from_lchan->ts->trx->arfcn, to_bts->nr);
-	rc = bsc_handover_start(from_lchan, to_bts);
+	rc = bsc_handover_start(from_lchan, to_bts, from_lchan->type);
 	if (rc) {
 		vty_out(vty, "bsc_handover_start() returned %d=%s%s", rc,
 			strerror(-rc), VTY_NEWLINE);
diff --git a/src/libbsc/handover_decision.c b/src/libbsc/handover_decision.c
index 40f85c0..896f24a 100644
--- a/src/libbsc/handover_decision.c
+++ b/src/libbsc/handover_decision.c
@@ -70,7 +70,7 @@
 	}
 
 	/* and actually try to handover to that cell */
-	return bsc_handover_start(lchan, new_bts);
+	return bsc_handover_start(lchan, new_bts, lchan->type);
 }
 
 /* did we get a RXLEV for a given cell in the given report? */
diff --git a/src/libbsc/handover_logic.c b/src/libbsc/handover_logic.c
index 20ecc6c..b7f350f 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,11 @@
 	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 @@
 
 	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 @@
 	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: merged
Gerrit-Change-Id: I4478ebcaada00897cc38c5a299e07661139ed3c5
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list