diff options
author | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2020-06-06 00:08:16 +0300 |
---|---|---|
committer | Kirill Zakharenko <earwin@gmail.com> | 2020-06-06 02:22:34 +0300 |
commit | a985c16ad7192f14e1dfe15d61d9e8b1cfa2daf6 (patch) | |
tree | 0fab46ef58bf918b6a714ca245de5c99d20f6f4e | |
parent | 4409c9002e87a5d7488ff1d51eb9ad4ef859a9d7 (diff) |
stats: Fis a case where borken TS counters are not reduced on OML/RSL disconnect.
Change-Id: I49880d5cc26dda0bf5a1f7f5d6dbad1b0faa4fb4
-rw-r--r-- | src/osmo-bsc/timeslot_fsm.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c index 4816dafb5..541cfd97e 100644 --- a/src/osmo-bsc/timeslot_fsm.c +++ b/src/osmo-bsc/timeslot_fsm.c @@ -750,14 +750,25 @@ static int ts_fsm_timer_cb(struct osmo_fsm_inst *fi) } } +static void _count_borken_on_teardown(struct osmo_fsm_inst *fi) +{ + struct gsm_bts_trx_ts *ts = ts_fi_ts(fi); + if (ts->fi->state == TS_ST_BORKEN) { + rate_ctr_inc(&ts->trx->bts->bts_ctrs->ctr[BTS_CTR_TS_BORKEN_EV_TEARDOWN]); + osmo_stat_item_dec(ts->trx->bts->bts_statg->items[BTS_STAT_TS_BORKEN], 1); + } +} + static void ts_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct gsm_bts_trx_ts *ts = ts_fi_ts(fi); switch (event) { case TS_EV_OML_DOWN: ts->is_oml_ready = false; - if (fi->state != TS_ST_NOT_INITIALIZED) + if (fi->state != TS_ST_NOT_INITIALIZED) { + _count_borken_on_teardown(fi); osmo_fsm_inst_state_chg(fi, TS_ST_NOT_INITIALIZED, 0, 0); + } OSMO_ASSERT(fi->state == TS_ST_NOT_INITIALIZED); ts_terminate_lchan_fsms(ts); ts->pchan_is = ts->pchan_on_init = GSM_PCHAN_NONE; @@ -766,8 +777,10 @@ static void ts_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data case TS_EV_RSL_DOWN: ts->is_rsl_ready = false; - if (fi->state != TS_ST_NOT_INITIALIZED) + if (fi->state != TS_ST_NOT_INITIALIZED) { + _count_borken_on_teardown(fi); osmo_fsm_inst_state_chg(fi, TS_ST_NOT_INITIALIZED, 0, 0); + } OSMO_ASSERT(fi->state == TS_ST_NOT_INITIALIZED); ts->pchan_is = GSM_PCHAN_NONE; ts_lchans_dispatch(ts, -1, LCHAN_EV_TS_ERROR); @@ -780,11 +793,7 @@ static void ts_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data static void ts_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) { - struct gsm_bts_trx_ts *ts = ts_fi_ts(fi); - if (ts->fi->state == TS_ST_BORKEN) { - rate_ctr_inc(&ts->trx->bts->bts_ctrs->ctr[BTS_CTR_TS_BORKEN_EV_TEARDOWN]); - osmo_stat_item_dec(ts->trx->bts->bts_statg->items[BTS_STAT_TS_BORKEN], 1); - } + _count_borken_on_teardown(fi); } #define S(x) (1 << (x)) |