aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-11-24 15:14:03 +0100
committerneels <nhofmeyr@sysmocom.de>2021-11-24 19:22:34 +0000
commit88f3c0520295ae014a0e750fb49e09e70799be36 (patch)
tree14010a9df5ade3767f67dc5b0898e82b6c7ff2ad
parent80afda444e15871adc809f87c73aa242c1635ad5 (diff)
hodec2: fix segv for inter-BSC ho target
-rw-r--r--src/osmo-bsc/handover_decision_2.c50
1 files changed, 31 insertions, 19 deletions
diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c
index 6730f26ae..14bc2d4b0 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -1027,27 +1027,39 @@ static void candidate_set_free_tch(struct ho_candidate *c)
break;
}
- chan_counts_for_bts(&bts_counts, c->target.bts);
- c->target.free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F];
- c->target.min_free_tchf = ho_get_hodec2_tchf_min_slots(c->target.bts->ho);
- c->target.free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H];
- c->target.min_free_tchh = ho_get_hodec2_tchh_min_slots(c->target.bts->ho);
-
- /* Would the next TCH/F lchan occupy a dynamic timeslot that currently counts for free TCH/H timeslots? */
- next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_F, false);
- if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN)
- c->target.next_tchf_reduces_tchh = 2;
- else
- c->target.next_tchf_reduces_tchh = 0;
+ /* For inter-BSC handover, the target BTS is in a different BSC and hence NULL here. */
+ if (c->target.bts) {
+ chan_counts_for_bts(&bts_counts, c->target.bts);
+ c->target.free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F];
+ c->target.min_free_tchf = ho_get_hodec2_tchf_min_slots(c->target.bts->ho);
+ c->target.free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H];
+ c->target.min_free_tchh = ho_get_hodec2_tchh_min_slots(c->target.bts->ho);
+
+ /* Would the next TCH/F lchan occupy a dynamic timeslot that currently counts for free TCH/H timeslots?
+ */
+ next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_F, false);
+ if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN)
+ c->target.next_tchf_reduces_tchh = 2;
+ else
+ c->target.next_tchf_reduces_tchh = 0;
+
+ /* Would the next TCH/H lchan occupy a dynamic timeslot that currently counts for free TCH/F timeslots?
+ * Note that a dyn TS already in TCH/H mode (half occupied) would not reduce free TCH/F. */
+ next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_H, false);
+ if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN
+ && next_lchan->ts->pchan_is != GSM_PCHAN_TCH_H)
+ c->target.next_tchh_reduces_tchf = 1;
+ else
+ c->target.next_tchh_reduces_tchf = 0;
+ } else {
- /* Would the next TCH/H lchan occupy a dynamic timeslot that currently counts for free TCH/F timeslots?
- * Note that a dyn TS already in TCH/H mode (half occupied) would not reduce free TCH/F. */
- next_lchan = lchan_avail_by_type(c->target.bts, GSM_LCHAN_TCH_H, false);
- if (next_lchan && next_lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN
- && next_lchan->ts->pchan_is != GSM_PCHAN_TCH_H)
- c->target.next_tchh_reduces_tchf = 1;
- else
+ c->target.free_tchf = 0;
+ c->target.min_free_tchf = 0;
c->target.next_tchh_reduces_tchf = 0;
+ c->target.free_tchh = 0;
+ c->target.min_free_tchh = 0;
+ c->target.next_tchf_reduces_tchh = 0;
+ }
}
/* add candidate for re-assignment within the current cell */