From efc0d5bf57b8521b5585a36311233fe2355772dd Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Fri, 5 Nov 2021 17:13:52 +0300 Subject: [PATCH] gsm_lchan_interf_meas_calc_avg(): fix band calculation This patch makes osmo-bts bahave similar to ip.access nanoBTS. Change-Id: I1bcc6d6ba154f82aef95d05fb9af0eab490923c9 Related: SYS#5313 --- src/common/lchan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/lchan.c b/src/common/lchan.c index 29fd24700..ec1b1753e 100644 --- a/src/common/lchan.c +++ b/src/common/lchan.c @@ -464,8 +464,11 @@ void gsm_lchan_interf_meas_calc_avg(struct gsm_lchan *lchan) /* Calculate the average of all collected samples */ meas_avg = meas_sum / (int) meas_num; - /* Determine the band using interference boundaries from BSC */ - for (b = 0; b < ARRAY_SIZE(bts->interference.boundary); b++) { + /* 3GPP TS 48.008 defines 5 interference bands, and 6 interference level + * boundaries (0, X1, ... X5). It's not clear how to handle values + * exceeding the outer boundaries (0 or X5), because bands 0 and 6 do + * not exist (sigh). Let's map such values to closest bands 1 and 5. */ + for (b = 1; b < ARRAY_SIZE(bts->interference.boundary) - 1; b++) { if (meas_avg >= bts->interference.boundary[b]) break; /* Current 'b' is the band value */ }