From 903aaea6689cc08c0e33fb05659c808a5e5f754f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 19 Jan 2014 17:10:50 +0100 Subject: Do not expect all BTSs support TSC != BCC We introduce a new feature indicating if the given BTS model supports a TSC that is different from the BCC (lower 3 bits of BSIC). --- openbsc/src/libbsc/bsc_vty.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'openbsc/src/libbsc/bsc_vty.c') diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 3b85892e0..b906c2ee3 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -491,8 +491,10 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); vty_out(vty, " location_area_code %u%s", bts->location_area_code, VTY_NEWLINE); - vty_out(vty, " training_sequence_code %u%s", bts->tsc, VTY_NEWLINE); vty_out(vty, " base_station_id_code %u%s", bts->bsic, VTY_NEWLINE); + if (bts->tsc != (bts->bsic & 7)) + vty_out(vty, " training_sequence_code %u%s", bts->tsc, + VTY_NEWLINE); if (bts->tz.override != 0) { if (bts->tz.dst) vty_out(vty, " timezone %d %d %d%s", @@ -1634,6 +1636,13 @@ DEFUN(cfg_bts_tsc, struct gsm_bts *bts = vty->index; int tsc = atoi(argv[0]); + if (!gsm_bts_has_feature(bts, BTS_FEAT_MULTI_TSC)) { + vty_out(vty, "%% This BTS does not support a TSC != BCC, " + "falling back to BCC%s", VTY_NEWLINE); + bts->tsc = bts->bsic & 7; + return CMD_WARNING; + } + bts->tsc = tsc; return CMD_SUCCESS; @@ -1655,6 +1664,11 @@ DEFUN(cfg_bts_bsic, } bts->bsic = bsic; + /* automatically re-configuer the TSC if we change the BCC + * which is the lower 3 bits of the BSIC */ + if (!gsm_bts_has_feature(bts, BTS_FEAT_MULTI_TSC)) + bts->tsc = bts->bsic & 7; + return CMD_SUCCESS; } @@ -2977,6 +2991,13 @@ DEFUN(cfg_ts_tsc, { struct gsm_bts_trx_ts *ts = vty->index; + if (!gsm_bts_has_feature(ts->trx->bts, BTS_FEAT_MULTI_TSC)) { + vty_out(vty, "%% This BTS does not support a TSC != BCC, " + "falling back to BCC%s", VTY_NEWLINE); + ts->tsc = -1; + return CMD_WARNING; + } + ts->tsc = atoi(argv[0]); return CMD_SUCCESS; -- cgit v1.2.3