aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-06-01 17:00:59 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-01-12 03:28:14 +0100
commitf6769df0cb01b70fdb523c62937cc4c466405b7e (patch)
tree9f569868bcac2490c0cfa0a16cc37768305c1426 /src
parent2482975a203f4c3355d16a26deca99cd020199af (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.
Diffstat (limited to 'src')
-rw-r--r--src/libbsc/handover_decision.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libbsc/handover_decision.c b/src/libbsc/handover_decision.c
index 15463b0f5..dfe12ed33 100644
--- a/src/libbsc/handover_decision.c
+++ b/src/libbsc/handover_decision.c
@@ -99,6 +99,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);
@@ -177,6 +184,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++;