aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/handover_decision_2.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-01-28 15:28:51 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2021-02-02 21:53:53 +0100
commitb4364a4adc5322181b2d0975290fc6a9d7f88aed (patch)
tree20e7f41c07c2f80c600575bd0a20268220f26ced /src/osmo-bsc/handover_decision_2.c
parent1475aac8ed1b7e6dca09dbd5d75a9c0e77289846 (diff)
hodec2: fix intra-cell congestion balancing with source lchan on dyn TS
Diffstat (limited to 'src/osmo-bsc/handover_decision_2.c')
-rw-r--r--src/osmo-bsc/handover_decision_2.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c
index 0bfae9ba2..2cb7a54f3 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -682,7 +682,18 @@ static void check_requirements(struct ho_candidate *c)
current_overbooked = load_above_congestion(c->current.free_tch, c->current.min_free_tch);
if (requirement & REQUIREMENT_A_TCHF) {
bool ok;
- int32_t target_overbooked = load_above_congestion(c->target.free_tchf - 1, c->target.min_free_tchf);
+ int32_t target_overbooked;
+ int target_free_tchf_after_ho;
+
+ /* To evaluate whether a handover improves or worsens congestion on TCH/F, first figure out how many
+ * TCH/F lchans will be occupied on the target after the handover. If the target is a different cell,
+ * then we obviously reduce by one TCH/F. If source and target cell are the same (re-assignment), then
+ * the source lchan may also free a TCH/F at the same time. Add up all of these effects to figure out
+ * the congestion percentages before and after handover. */
+ target_free_tchf_after_ho = c->target.free_tchf - 1;
+ if (c->current.bts == c->target.bts)
+ target_free_tchf_after_ho += c->current.lchan_frees_tchf;
+ target_overbooked = load_above_congestion(target_free_tchf_after_ho, c->target.min_free_tchf);
LOGPHOLCHANTOBTS(c->current.lchan, c->target.bts, LOGL_DEBUG,
"current overbooked = %s%%, TCH/F target overbooked after HO = %s%%\n",
osmo_int_to_float_str_c(OTC_SELECT, current_overbooked, LOAD_PRECISION - 2),
@@ -718,7 +729,18 @@ static void check_requirements(struct ho_candidate *c)
}
if (requirement & REQUIREMENT_A_TCHH) {
bool ok;
- int32_t target_overbooked = load_above_congestion(c->target.free_tchh - 1, c->target.min_free_tchh);
+ int32_t target_overbooked;
+ int target_free_tchh_after_ho;
+
+ /* To evaluate whether a handover improves or worsens congestion on TCH/H, first figure out how many
+ * TCH/H lchans will be occupied on the target after the handover. If the target is a different cell,
+ * then we obviously reduce by one TCH/H. If source and target cell are the same (re-assignment), then
+ * the source lchan may also free one or two TCH/H at the same time. Add up all of these effects to
+ * figure out the congestion percentages before and after handover. */
+ target_free_tchh_after_ho = c->target.free_tchh - 1;
+ if (c->current.bts == c->target.bts)
+ target_free_tchh_after_ho += c->current.lchan_frees_tchh;
+ target_overbooked = load_above_congestion(target_free_tchh_after_ho, c->target.min_free_tchh);
LOGPHOLCHANTOBTS(c->current.lchan, c->target.bts, LOGL_DEBUG,
"current overbooked = %s%%, TCH/H target overbooked after HO = %s%%\n",
osmo_int_to_float_str_c(OTC_SELECT, current_overbooked, LOAD_PRECISION - 2),