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
This commit is contained in:
Vadim Yanitskiy 2021-11-05 17:13:52 +03:00 committed by laforge
parent b9fcb85a29
commit efc0d5bf57
1 changed files with 5 additions and 2 deletions

View File

@ -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 */
}