neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/24805 )


Change subject: handover_decision_2.c: add is_low_rxlev()
......................................................................

handover_decision_2.c: add is_low_rxlev()

Remove code dup. Also this will be used another time by an upcoming
patch.

Change-Id: I4aaeb8bc35a142962ac8ca6401a76b0733f7979e
---
M src/osmo-bsc/handover_decision_2.c
1 file changed, 9 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/05/24805/1

diff --git a/src/osmo-bsc/handover_decision_2.c 
b/src/osmo-bsc/handover_decision_2.c
index d4ebc41..97c8b6e 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -250,6 +250,12 @@
                                ho_get_hodec2_rxlev_avg_win(bts->ho));
 }

+static bool is_low_rxlev(int rxlev_current, struct handover_cfg *neigh_cfg)
+{
+       return rxlev_current >= 0
+               && rxlev2dbm(rxlev_current) < 
ho_get_hodec2_min_rxlev(neigh_cfg);
+}
+
 /* obtain averaged rxlev for given neighbor */
 static int neigh_meas_avg(struct neigh_meas_proc *nmp, int window)
 {
@@ -1069,7 +1075,6 @@
                .bsic = nmp->bsic,
        };
        struct ho_candidate c;
-       int min_rxlev;
        struct handover_cfg *neigh_cfg;

        /* skip empty slots */
@@ -1137,12 +1142,11 @@

        /* if the minimum level is not reached.
         * In case of a remote-BSS, use the current BTS' configuration. */
-       min_rxlev = ho_get_hodec2_min_rxlev(neigh_cfg);
-       if (rxlev2dbm(c.target.rxlev) < min_rxlev) {
+       if (is_low_rxlev(c.target.rxlev, neigh_cfg)) {
                LOGPHOCAND(&c, LOGL_DEBUG,
                           "Not a candidate, because RX level (%d dBm) is lower"
                           " than the minimum required RX level (%d dBm)\n",
-                          rxlev2dbm(c.target.rxlev), min_rxlev);
+                          rxlev2dbm(c.target.rxlev), 
ho_get_hodec2_min_rxlev(neigh_cfg));
                return;
        }

@@ -1505,7 +1509,7 @@
        }

        /* Low Level */
-       if (av_rxlev >= 0 && rxlev2dbm(av_rxlev) < 
ho_get_hodec2_min_rxlev(bts->ho)) {
+       if (is_low_rxlev(av_rxlev, bts->ho)) {
                global_ho_reason = HO_REASON_LOW_RXLEVEL;
                LOGPHOLCHAN(lchan, LOGL_NOTICE, "RX level is TOO LOW: %d < 
%d\n",
                            rxlev2dbm(av_rxlev), 
ho_get_hodec2_min_rxlev(bts->ho));

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I4aaeb8bc35a142962ac8ca6401a76b0733f7979e
Gerrit-Change-Number: 24805
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to