fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/25734 )

Change subject: gsm_lchan_interf_meas_calc_avg(): adapt to the order of 
boundaries
......................................................................

gsm_lchan_interf_meas_calc_avg(): adapt to the order of boundaries

The order of interference level boundaries is not clearly defined by
3GPP, so we should support both ascending and descending variants.

Change-Id: I88d841d8d835bde8392c7b606b28c9070b7adc6e
Related: SYS#5313
---
M src/common/lchan.c
1 file changed, 12 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/src/common/lchan.c b/src/common/lchan.c
index ec1b175..fe5efd5 100644
--- a/src/common/lchan.c
+++ b/src/common/lchan.c
@@ -468,9 +468,18 @@
         * 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 */
+       if (bts->interference.boundary[0] < bts->interference.boundary[5]) {
+               /* Ascending order (band=1 indicates lowest interference) */
+               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 */
+               }
+       } else {
+               /* Descending order (band=1 indicates highest interference) */
+               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 */
+               }
        }

        LOGPLCHAN(lchan, DL1C, LOGL_DEBUG,

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25734
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I88d841d8d835bde8392c7b606b28c9070b7adc6e
Gerrit-Change-Number: 25734
Gerrit-PatchSet: 6
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-CC: neels <[email protected]>
Gerrit-MessageType: merged

Reply via email to