Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/11320


Change subject: handover_decision_2.c: refactor trigger_*()
......................................................................

handover_decision_2.c: refactor trigger_*()

a) Prepare for triggering handover for any candidate, remote or local.

b) drop redundant arguments.

Change-Id: I5ba8b556703010c8e232b516285a837c999f87ef
---
M src/osmo-bsc/handover_decision_2.c
1 file changed, 18 insertions(+), 17 deletions(-)



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

diff --git a/src/osmo-bsc/handover_decision_2.c 
b/src/osmo-bsc/handover_decision_2.c
index 64fc2dd..457d57a 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -620,8 +620,10 @@
 }

 /* Trigger handover or assignment depending on the target BTS */
-static int trigger_handover_or_assignment(struct gsm_lchan *lchan, struct 
gsm_bts *new_bts, uint8_t requirements)
+static int trigger_local_ho_or_as(struct ho_candidate *c, uint8_t requirements)
 {
+       struct gsm_lchan *lchan = c->lchan;
+       struct gsm_bts *new_bts = c->bts;
        struct handover_out_req req;
        struct gsm_bts *current_bts = lchan->ts->trx->bts;
        int afs_bias = 0;
@@ -699,6 +701,14 @@
        return 0;
 }

+static int trigger_ho(struct ho_candidate *c, uint8_t requirements)
+{
+       if (c->bts)
+               return trigger_local_ho_or_as(c, requirements);
+       else
+               return 0; /* TODO: remote candidates */
+}
+
 /* verbosely log about a handover candidate */
 static inline void debug_candidate(struct ho_candidate *candidate,
                                   int8_t rxlev, int tchf_count, int tchh_count)
@@ -1003,8 +1013,7 @@
                LOGPHOCAND(best_cand, LOGL_INFO, "Best candidate, RX level 
%d%s\n",
                           rxlev2dbm(best_cand->avg),
                           best_applied_afs_bias ? " (applied AHS -> AFS rxlev 
bias)" : "");
-               return trigger_handover_or_assignment(lchan, best_cand->bts,
-                                                     best_cand->requirements & 
REQUIREMENT_B_MASK);
+               return trigger_ho(best_cand, best_cand->requirements & 
REQUIREMENT_B_MASK);
        }

        /* select best candidate that fulfills requirement C: less or equal 
congestion after HO */
@@ -1032,8 +1041,7 @@
                LOGPHOCAND(best_cand, LOGL_INFO, "Best candidate, RX level 
%d%s\n",
                           rxlev2dbm(best_cand->avg),
                           best_applied_afs_bias? " (applied AHS -> AFS rxlev 
bias)" : "");
-               return trigger_handover_or_assignment(lchan, best_cand->bts,
-                                                     best_cand->requirements & 
REQUIREMENT_C_MASK);
+               return trigger_ho(best_cand, best_cand->requirements & 
REQUIREMENT_C_MASK);
        }

        /* we are done in case the MS RXLEV/RXQUAL/TA aren't critical and we're 
avoiding congestion. */
@@ -1069,8 +1077,7 @@
                LOGPHOCAND(best_cand, LOGL_INFO, "Best candidate: RX level 
%d%s\n",
                           rxlev2dbm(best_cand->avg),
                           best_applied_afs_bias ? " (applied AHS -> AFS rxlev 
bias)" : "");
-               return trigger_handover_or_assignment(lchan, best_cand->bts,
-                                                     best_cand->requirements & 
REQUIREMENT_A_MASK);
+               return trigger_ho(best_cand, best_cand->requirements & 
REQUIREMENT_A_MASK);
        }

        /* Damn, all is congested, has too low RXLEV or cannot service the 
voice call due to codec
@@ -1416,8 +1423,7 @@
                LOGPHOCAND(best_cand, LOGL_DEBUG, "Best candidate: RX level 
%d%s\n",
                           rxlev2dbm(best_cand->avg),
                           is_improved ? " (applied AHS->AFS bias)" : "");
-               trigger_handover_or_assignment(best_cand->lchan, best_cand->bts,
-                       best_cand->requirements & REQUIREMENT_B_MASK);
+               trigger_ho(best_cand, best_cand->requirements & 
REQUIREMENT_B_MASK);
 #if 0
                /* if there is still congestion, mark lchan as deleted
                 * and redo this process */
@@ -1485,9 +1491,7 @@
                LOGPHOCAND(worst_cand, LOGL_INFO, "Worst candidate: RX level %d 
from TCH/H -> TCH/F%s\n",
                           rxlev2dbm(worst_cand->avg),
                           is_improved ? " (applied AHS -> AFS rxlev bias)" : 
"");
-               trigger_handover_or_assignment(worst_cand->lchan,
-                       worst_cand->bts,
-                       worst_cand->requirements & REQUIREMENT_B_MASK);
+               trigger_ho(worst_cand, worst_cand->requirements & 
REQUIREMENT_B_MASK);
 #if 0
                /* if there is still congestion, mark lchan as deleted
                 * and redo this process */
@@ -1556,8 +1560,7 @@
                LOGPHOCAND(best_cand, LOGL_INFO, "Best candidate: RX level 
%d%s\n",
                           rxlev2dbm(best_cand->avg),
                           is_improved ? " (applied AHS -> AFS rxlev bias)" : 
"");
-               trigger_handover_or_assignment(best_cand->lchan, best_cand->bts,
-                       best_cand->requirements & REQUIREMENT_C_MASK);
+               trigger_ho(best_cand, best_cand->requirements & 
REQUIREMENT_C_MASK);
 #if 0
                /* if there is still congestion, mark lchan as deleted
                 * and redo this process */
@@ -1630,9 +1633,7 @@
                LOGPHOCAND(worst_cand, LOGL_INFO, "Worst candidate: RX level %d 
from TCH/H -> TCH/F%s\n",
                           rxlev2dbm(worst_cand->avg),
                           is_improved ? " (applied AHS -> AFS rxlev bias)" : 
"");
-               trigger_handover_or_assignment(worst_cand->lchan,
-                       worst_cand->bts,
-                       worst_cand->requirements & REQUIREMENT_C_MASK);
+               trigger_ho(worst_cand, worst_cand->requirements & 
REQUIREMENT_C_MASK);
 #if 0
                /* if there is still congestion, mark lchan as deleted
                 * and redo this process */

--
To view, visit https://gerrit.osmocom.org/11320
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ba8b556703010c8e232b516285a837c999f87ef
Gerrit-Change-Number: 11320
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to