Fix TSC/BSIC handling bug and remove bts->tsc
This fixes a bug in the following circumstances: * BSIC is set to 0 in the config file * No TSC is explicitly specified at the BST level in the config file In this case, we ended up using BSIC=0 and TSC=7, as TSC=7 is our default initialization value. The TSC of the CCCH/BCCH must always be the BCC, which is the lower 3 bits of the BSIC. Having configuration options for both the BSIC _and_ the TSC at the BTS level therefore makes no sense, as it only adds ways in which users can configure non-oprational configurations. So we remove the bts->tsc member, and keep only the ts->tsc members that allow us to configure a timeslot-specific TSC that's different from the BTS TSC (= BCC).
This commit is contained in:
parent
ae2c18c57b
commit
a2bbc5ec0e
|
@ -437,7 +437,7 @@ void subscr_con_free(struct gsm_subscriber_connection *conn);
|
|||
|
||||
struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net,
|
||||
enum gsm_bts_type type,
|
||||
uint8_t tsc, uint8_t bsic);
|
||||
uint8_t bsic);
|
||||
|
||||
void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
|
||||
uint8_t e1_ts, uint8_t e1_ts_ss);
|
||||
|
|
|
@ -50,7 +50,6 @@ enum gsm_chreq_reason_t {
|
|||
#define TS_MAX_LCHAN 8
|
||||
|
||||
#define HARDCODED_ARFCN 123
|
||||
#define HARDCODED_TSC 7
|
||||
#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
|
||||
|
||||
/* for multi-drop config */
|
||||
|
@ -569,9 +568,8 @@ struct gsm_bts {
|
|||
uint16_t cell_identity;
|
||||
/* location area code of this BTS */
|
||||
uint16_t location_area_code;
|
||||
/* Training Sequence Code */
|
||||
uint8_t tsc;
|
||||
/* Base Station Identification Code (BSIC) */
|
||||
/* Base Station Identification Code (BSIC), lower 3 bits is BCC,
|
||||
* which is used as TSC for the CCCH */
|
||||
uint8_t bsic;
|
||||
/* type of BTS */
|
||||
enum gsm_bts_type type;
|
||||
|
@ -798,7 +796,7 @@ static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
|
|||
if (ts->tsc != -1)
|
||||
return ts->tsc;
|
||||
else
|
||||
return ts->trx->bts->tsc;
|
||||
return ts->trx->bts->bsic & 7;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -987,7 +987,7 @@ int main(int argc, char **argv)
|
|||
if (!bsc_gsmnet)
|
||||
exit(1);
|
||||
|
||||
bts = gsm_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_NANOBTS, HARDCODED_TSC,
|
||||
bts = gsm_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_NANOBTS,
|
||||
HARDCODED_BSIC);
|
||||
/* ip.access supports up to 4 chained TRX */
|
||||
gsm_bts_trx_alloc(bts);
|
||||
|
|
|
@ -280,10 +280,10 @@ static void bootstrap_rsl(struct gsm_bts_trx *trx)
|
|||
unsigned int i;
|
||||
|
||||
LOGP(DRSL, LOGL_NOTICE, "bootstrapping RSL for BTS/TRX (%u/%u) "
|
||||
"on ARFCN %u using MCC=%u MNC=%u LAC=%u CID=%u BSIC=%u TSC=%u\n",
|
||||
"on ARFCN %u using MCC=%u MNC=%u LAC=%u CID=%u BSIC=%u\n",
|
||||
trx->bts->nr, trx->nr, trx->arfcn, bsc_gsmnet->country_code,
|
||||
bsc_gsmnet->network_code, trx->bts->location_area_code,
|
||||
trx->bts->cell_identity, trx->bts->bsic, trx->bts->tsc);
|
||||
trx->bts->cell_identity, trx->bts->bsic);
|
||||
|
||||
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
|
||||
rsl_nokia_si_begin(trx);
|
||||
|
|
|
@ -253,10 +253,10 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
|
|||
struct pchan_load pl;
|
||||
|
||||
vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
|
||||
"BSIC %u, TSC %u and %u TRX%s",
|
||||
"BSIC %u and %u TRX%s",
|
||||
bts->nr, btstype2str(bts->type), gsm_band_name(bts->band),
|
||||
bts->cell_identity,
|
||||
bts->location_area_code, bts->bsic, bts->tsc,
|
||||
bts->location_area_code, bts->bsic,
|
||||
bts->num_trx, VTY_NEWLINE);
|
||||
vty_out(vty, "Description: %s%s",
|
||||
bts->description ? bts->description : "(null)", VTY_NEWLINE);
|
||||
|
@ -374,7 +374,7 @@ static void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link
|
|||
static void config_write_ts_single(struct vty *vty, struct gsm_bts_trx_ts *ts)
|
||||
{
|
||||
vty_out(vty, " timeslot %u%s", ts->nr, VTY_NEWLINE);
|
||||
if (ts->tsc != -1 && ts->tsc != ts->trx->bts->tsc)
|
||||
if (ts->tsc != -1)
|
||||
vty_out(vty, " training_sequence_code %u%s", ts->tsc, VTY_NEWLINE);
|
||||
if (ts->pchan != GSM_PCHAN_NONE)
|
||||
vty_out(vty, " phys_chan_config %s%s",
|
||||
|
@ -550,9 +550,6 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
|
|||
vty_out(vty, " location_area_code %u%s", bts->location_area_code,
|
||||
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",
|
||||
|
@ -1617,7 +1614,7 @@ DEFUN(cfg_bts,
|
|||
} else if (bts_nr == gsmnet->num_bts) {
|
||||
/* allocate a new one */
|
||||
bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN,
|
||||
HARDCODED_TSC, HARDCODED_BSIC);
|
||||
HARDCODED_BSIC);
|
||||
} else
|
||||
bts = gsm_bts_num(gsmnet, bts_nr);
|
||||
|
||||
|
@ -1712,23 +1709,12 @@ DEFUN(cfg_bts_lac,
|
|||
}
|
||||
|
||||
|
||||
DEFUN(cfg_bts_tsc,
|
||||
/* compatibility wrapper for old config files */
|
||||
DEFUN_HIDDEN(cfg_bts_tsc,
|
||||
cfg_bts_tsc_cmd,
|
||||
"training_sequence_code <0-7>",
|
||||
"Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n")
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1748,11 +1734,6 @@ 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type)
|
|||
}
|
||||
|
||||
struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_type type,
|
||||
uint8_t tsc, uint8_t bsic)
|
||||
uint8_t bsic)
|
||||
{
|
||||
struct gsm_bts_model *model = bts_model_find(type);
|
||||
struct gsm_bts *bts;
|
||||
|
@ -310,7 +310,6 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ
|
|||
bts->nr = net->num_bts++;
|
||||
bts->type = type;
|
||||
bts->model = model;
|
||||
bts->tsc = tsc;
|
||||
bts->bsic = bsic;
|
||||
|
||||
bts->neigh_list_manual_mode = 0;
|
||||
|
|
|
@ -898,7 +898,7 @@ int main(int argc, char **argv)
|
|||
fprintf(stderr, "Unable to allocate gsm network\n");
|
||||
exit(1);
|
||||
}
|
||||
g_bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_BS11, HARDCODED_TSC,
|
||||
g_bts = gsm_bts_alloc_register(gsmnet, GSM_BTS_TYPE_BS11,
|
||||
HARDCODED_BSIC);
|
||||
|
||||
/* Override existing OML callback handler to set our own. */
|
||||
|
|
Loading…
Reference in New Issue