aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-06-01 17:00:59 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2013-07-29 12:44:26 +0200
commitd2909f968412c5f1e3e05f56223884d92a4e0cf7 (patch)
tree29d96229beee3b6e60860f896a416bb8a4faba79
parent63b8eafbd5cb91ee29e4104465229f20af517a59 (diff)
HO: Count neighbor measurements and reduce window of neigh_meas_avg
Always start with a counter of 0 for a new measurement report. If the neigh_meas_avg is caluclated over the given window, the window is reduced, if there are less measurement reports received so far.
-rw-r--r--openbsc/src/libbsc/handover_decision.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/handover_decision.c b/openbsc/src/libbsc/handover_decision.c
index a66354423..5f9a2c3af 100644
--- a/openbsc/src/libbsc/handover_decision.c
+++ b/openbsc/src/libbsc/handover_decision.c
@@ -76,6 +76,13 @@ static int neigh_meas_avg(struct neigh_meas_proc *nmp, int window)
unsigned int i, idx;
int avg = 0;
+ /* reduce window to the actual number of existing measurements */
+ if (window < nmp->rxlev_cnt)
+ window = nmp->rxlev_cnt;
+ /* this should never happen */
+ if (window == 0)
+ return 0;
+
idx = calc_initial_idx(ARRAY_SIZE(nmp->rxlev),
nmp->rxlev_cnt % ARRAY_SIZE(nmp->rxlev),
window);
@@ -154,6 +161,7 @@ static void process_meas_neigh(struct gsm_meas_rep *mr)
nmp->arfcn = mrc->arfcn;
nmp->bsic = mrc->bsic;
+ nmp->rxlev_cnt = 0;
idx = nmp->rxlev_cnt % ARRAY_SIZE(nmp->rxlev);
nmp->rxlev[idx] = mrc->rxlev;
nmp->rxlev_cnt++;