From 587eaf10edadef1356e0fa3be4ba82f2ddf128ac Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 30 May 2013 14:12:48 +0200 Subject: HO: Add a penalty timer list to the subscriber connection entity This penalty timer is used to temporarily block cells where handover or assignment failed or where handover is not allowed. This is usefull to prevent repeated handover attempts to broken cells or cells that have limited allowed distance. --- openbsc/include/openbsc/gsm_data.h | 10 ++++++++++ openbsc/src/libbsc/bsc_api.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 8ec08ecb0..8822b9b3e 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -97,6 +97,13 @@ struct neigh_meas_proc { uint8_t last_seen_nr; }; +/* penalty timers for handover */ +struct ho_penalty_timer { + struct llist_head entry; + uint8_t bts; + time_t timeout; +}; + /* the per subscriber data for lchan */ struct gsm_subscriber_connection { struct llist_head entry; @@ -130,6 +137,9 @@ struct gsm_subscriber_connection { /* for assignment handling */ struct osmo_timer_list T10; struct gsm_lchan *secondary_lchan; + + /* penalty timers for handover */ + struct llist_head ho_penalty_timers; }; diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 045068f24..8ac822e93 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -249,6 +249,7 @@ struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan) conn->lchan = lchan; conn->bts = lchan->ts->trx->bts; lchan->conn = conn; + INIT_LLIST_HEAD(&conn->ho_penalty_timers); llist_add_tail(&conn->entry, &sub_connections); return conn; } @@ -256,6 +257,8 @@ struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan) /* TODO: move subscriber put here... */ void subscr_con_free(struct gsm_subscriber_connection *conn) { + struct ho_penalty_timer *penalty; + if (!conn) return; @@ -281,6 +284,14 @@ void subscr_con_free(struct gsm_subscriber_connection *conn) conn->secondary_lchan->conn = NULL; } + /* flush handover penalty timers */ + while (!llist_empty(&conn->ho_penalty_timers)) { + penalty = llist_entry(conn->ho_penalty_timers.next, + struct ho_penalty_timer, entry); + llist_del(&penalty->entry); + talloc_free(penalty); + } + llist_del(&conn->entry); talloc_free(conn); } -- cgit v1.2.3