summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-05-30 09:14:31 (UTC)
committerAndreas Eversberg <jolly@eversberg.eu>2013-07-29 10:43:57 (UTC)
commitb4b630baf2a4731a0433c6d79462d11591397a2b (patch)
tree57fb1fb644068b5a82ae0ff2a540cf18745d7c45
parent507c0a363a7e55040b3925858299966f849b6c78 (diff)
HO: Add function to count currently ongoing handovers to a given BTS
In order to keep processing power at BTS at a defined level, the handover decision might want to limit maximum number of slots that require RACH detection.
-rw-r--r--openbsc/include/openbsc/handover.h3
-rw-r--r--openbsc/src/libbsc/handover_logic.c26
2 files changed, 26 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/handover.h b/openbsc/include/openbsc/handover.h
index bd0d8ad..5ba8e16 100644
--- a/openbsc/include/openbsc/handover.h
+++ b/openbsc/include/openbsc/handover.h
@@ -3,6 +3,9 @@
struct gsm_subscriber_connection;
+/* Count number of currently ongoing async handovers */
+int bsc_ho_count(struct gsm_bts *bts);
+
/* Hand over the specified logical channel to the specified new BTS.
* This is the main entry point for the actual handover algorithm,
* after it has decided it wants to initiate HO to a specific BTS */
diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c
index 9cf26af..c040c13 100644
--- a/openbsc/src/libbsc/handover_logic.c
+++ b/openbsc/src/libbsc/handover_logic.c
@@ -49,6 +49,7 @@ struct bsc_handover {
struct osmo_timer_list T3103;
uint8_t ho_ref;
+ int ho_async;
};
static LLIST_HEAD(bsc_handovers);
@@ -77,6 +78,22 @@ static struct bsc_handover *bsc_ho_by_old_lchan(struct gsm_lchan *old_lchan)
return NULL;
}
+/* Count number of currently ongoing async handovers */
+int bsc_ho_count(struct gsm_bts *bts)
+{
+ struct bsc_handover *ho;
+ int count = 0;
+
+ llist_for_each_entry(ho, &bsc_handovers, list) {
+ if (!ho->ho_async)
+ continue;
+ if (ho->new_lchan->bts == bts)
+ count++;
+ }
+
+ return count;
+}
+
/* Hand over the specified logical channel to the specified new BTS.
* This is the main entry point for the actual handover algorithm,
* after it has decided it wants to initiate HO to a specific BTS */
@@ -117,7 +134,10 @@ 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->bts != bts) {
+ ho->ho_ref = ho_ref++;
+ ho->ho_async = 1;
+ }
/* copy some parameters from old lchan */
memcpy(&new_lchan->encr, &old_lchan->encr, sizeof(new_lchan->encr));
@@ -130,8 +150,8 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
new_lchan->conn->ho_lchan = new_lchan;
/* FIXME: do we have a better idea of the timing advance? */
- rc = rsl_chan_activate_lchan(new_lchan, RSL_ACT_INTER_ASYNC, 0,
- ho->ho_ref);
+ rc = rsl_chan_activate_lchan(new_lchan,
+ (ho->ho_async) ? RSL_ACT_INTER_ASYNC : 0x00, 0, ho->ho_ref);
if (rc < 0) {
LOGP(DHO, LOGL_ERROR, "could not activate channel\n");
new_lchan->conn->ho_lchan = NULL;