summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/src/libbsc/abis_om2000.c15
-rw-r--r--openbsc/src/libbsc/bsc_vty.c47
-rw-r--r--openbsc/src/libcommon/gsm_data_shared.c44
3 files changed, 50 insertions, 56 deletions
diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c
index 6c987d8..cc42411 100644
--- a/openbsc/src/libbsc/abis_om2000.c
+++ b/openbsc/src/libbsc/abis_om2000.c
@@ -2179,22 +2179,23 @@ static void om2k_bts_s_wait_con(struct osmo_fsm_inst *fi, uint32_t event, void *
struct gsm_bts *bts = obfp->bts;
OSMO_ASSERT(event == OM2K_BTS_EVT_CON_DONE);
- /* TF can take a long time to initialize, wait for 10min */
- osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TF, 600, 0);
- om2k_mo_fsm_start(fi, OM2K_BTS_EVT_TF_DONE, bts->c0,
- &bts->rbs2000.tf.om2k_mo);
+
+ osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_IS,
+ BTS_FSM_TIMEOUT, 0);
+ om2k_mo_fsm_start(fi, OM2K_BTS_EVT_IS_DONE, bts->c0,
+ &bts->rbs2000.is.om2k_mo);
}
-static void om2k_bts_s_wait_tf(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+static void om2k_bts_s_wait_is(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct om2k_bts_fsm_priv *obfp = fi->priv;
struct gsm_bts_trx *trx;
- OSMO_ASSERT(event == OM2K_BTS_EVT_TF_DONE);
+ OSMO_ASSERT(event == OM2K_BTS_EVT_IS_DONE);
osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TRX,
BTS_FSM_TIMEOUT, 0);
- obfp->next_trx_nr = 0;
+ obfp->next_trx_nr = 1;
trx = gsm_bts_trx_num(obfp->bts, obfp->next_trx_nr++);
om2k_trx_fsm_start(fi, trx, OM2K_BTS_EVT_TRX_DONE);
}
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 73acebd..33a6921 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -883,29 +883,31 @@ DEFUN(show_trx,
}
if (argc >= 2) {
trx_nr = atoi(argv[1]);
- if (trx_nr >= bts->num_trx) {
+ trx = gsm_bts_trx_num(bts, trx_nr);
+ if (!trx) {
vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
VTY_NEWLINE);
return CMD_WARNING;
}
- trx = gsm_bts_trx_num(bts, trx_nr);
trx_dump_vty(vty, trx);
return CMD_SUCCESS;
}
if (bts) {
/* print all TRX in this BTS */
- for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
+ for (trx_nr = 0; 255; trx_nr++) {
trx = gsm_bts_trx_num(bts, trx_nr);
- trx_dump_vty(vty, trx);
+ if (trx)
+ trx_dump_vty(vty, trx);
}
return CMD_SUCCESS;
}
for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
bts = gsm_bts_num(net, bts_nr);
- for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
+ for (trx_nr = 0; trx_nr < 255; trx_nr++) {
trx = gsm_bts_trx_num(bts, trx_nr);
- trx_dump_vty(vty, trx);
+ if (trx)
+ trx_dump_vty(vty, trx);
}
}
@@ -954,12 +956,12 @@ DEFUN(show_ts,
}
if (argc >= 2) {
trx_nr = atoi(argv[1]);
- if (trx_nr >= bts->num_trx) {
+ trx = gsm_bts_trx_num(bts, trx_nr);
+ if (!trx) {
vty_out(vty, "%% can't find TRX '%s'%s", argv[1],
VTY_NEWLINE);
return CMD_WARNING;
}
- trx = gsm_bts_trx_num(bts, trx_nr);
}
if (argc >= 3) {
ts_nr = atoi(argv[2]);
@@ -982,8 +984,10 @@ DEFUN(show_ts,
}
} else if (bts) {
/* Iterate over all TRX in this BTS, TS in each TRX */
- for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
+ for (trx_nr = 0; trx_nr < 255; trx_nr++) {
trx = gsm_bts_trx_num(bts, trx_nr);
+ if (!trx)
+ continue;
for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
ts = &trx->ts[ts_nr];
ts_dump_vty(vty, ts);
@@ -993,8 +997,10 @@ DEFUN(show_ts,
/* Iterate over all BTS, TRX in each BTS, TS in each TRX */
for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
bts = gsm_bts_num(net, bts_nr);
- for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
+ for (trx_nr = 0; trx_nr < 255; trx_nr++) {
trx = gsm_bts_trx_num(bts, trx_nr);
+ if (!trx)
+ continue;
for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
ts = &trx->ts[ts_nr];
ts_dump_vty(vty, ts);
@@ -1216,9 +1222,10 @@ static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty,
{
int trx_nr;
- for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
+ for (trx_nr = 0; trx_nr < 255; trx_nr++) {
struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr);
- dump_lchan_trx(trx, vty, dump_cb);
+ if (trx)
+ dump_lchan_trx(trx, vty, dump_cb);
}
return CMD_SUCCESS;
@@ -1249,13 +1256,12 @@ static int lchan_summary(struct vty *vty, int argc, const char **argv,
}
if (argc >= 2) {
trx_nr = atoi(argv[1]);
- if (trx_nr >= bts->num_trx) {
+ trx = gsm_bts_trx_num(bts, trx_nr);
+ if (!trx) {
vty_out(vty, "%% can't find TRX %s%s", argv[1],
VTY_NEWLINE);
return CMD_WARNING;
}
- trx = gsm_bts_trx_num(bts, trx_nr);
-
if (argc == 2)
return dump_lchan_trx(trx, vty, dump_cb);
}
@@ -3363,16 +3369,11 @@ DEFUN(cfg_trx,
struct gsm_bts *bts = vty->index;
struct gsm_bts_trx *trx;
- if (trx_nr > bts->num_trx) {
- vty_out(vty, "%% The next unused TRX number in this BTS is %u%s",
- bts->num_trx, VTY_NEWLINE);
- return CMD_WARNING;
- } else if (trx_nr == bts->num_trx) {
+ trx = gsm_bts_trx_num(bts, trx_nr);
+ if (!trx) {
/* we need to allocate a new one */
trx = gsm_bts_trx_alloc(bts);
- } else
- trx = gsm_bts_trx_num(bts, trx_nr);
-
+ }
if (!trx)
return CMD_WARNING;
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index 387af70..c79c44b 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -155,6 +155,7 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
trx->bts = bts;
trx->nr = bts->num_trx++;
+ trx->nr = 1; /* HACK */
trx->mo.nm_state.administrative = NM_STATE_UNLOCKED;
gsm_mo_init(&trx->mo, bts, NM_OC_RADIO_CARRIER,
@@ -198,7 +199,7 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
}
}
- if (trx->nr != 0)
+ if (trx->nr != 1)
trx->nominal_power = bts->c0->nominal_power;
llist_add_tail(&trx->list, &bts->trx_list);
@@ -313,9 +314,6 @@ struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num)
{
struct gsm_bts_trx *trx;
- if (num >= bts->num_trx)
- return NULL;
-
llist_for_each_entry(trx, &bts->trx_list, list) {
if (trx->nr == num)
return trx;
@@ -418,24 +416,21 @@ gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
mo = &bts->mo;
break;
case NM_OC_RADIO_CARRIER:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
mo = &trx->mo;
break;
case NM_OC_BASEB_TRANSC:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
mo = &trx->bb_transc.mo;
break;
case NM_OC_CHANNEL:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
if (obj_inst->ts_nr >= TRX_NR_TS)
return NULL;
mo = &trx->ts[obj_inst->ts_nr].mo;
@@ -449,15 +444,15 @@ gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
mo = &bts->bs11.cclk.mo;
break;
case BS11_OBJ_BBSIG:
- if (obj_inst->ts_nr > bts->num_trx)
- return NULL;
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
mo = &trx->bs11.bbsig.mo;
break;
case BS11_OBJ_PA:
- if (obj_inst->ts_nr > bts->num_trx)
- return NULL;
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
mo = &trx->bs11.pa.mo;
break;
default:
@@ -514,24 +509,21 @@ gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
obj = bts;
break;
case NM_OC_RADIO_CARRIER:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
obj = trx;
break;
case NM_OC_BASEB_TRANSC:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
obj = &trx->bb_transc;
break;
case NM_OC_CHANNEL:
- if (obj_inst->trx_nr >= bts->num_trx) {
- return NULL;
- }
trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+ if (!trx)
+ return NULL;
if (obj_inst->ts_nr >= TRX_NR_TS)
return NULL;
obj = &trx->ts[obj_inst->ts_nr];