diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2013-05-30 11:14:31 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2013-07-29 12:43:57 +0200 |
commit | b4b630baf2a4731a0433c6d79462d11591397a2b (patch) | |
tree | 57fb1fb644068b5a82ae0ff2a540cf18745d7c45 | |
parent | 507c0a363a7e55040b3925858299966f849b6c78 (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.h | 3 | ||||
-rw-r--r-- | openbsc/src/libbsc/handover_logic.c | 26 |
2 files changed, 26 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/handover.h b/openbsc/include/openbsc/handover.h index bd0d8ad6c..5ba8e1641 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 9cf26af9d..c040c13aa 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; |