diff options
author | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2020-05-11 00:30:11 +0300 |
---|---|---|
committer | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2020-05-16 20:47:37 +0300 |
commit | c73130d57298dec9dec2254c0275e7a381ab84c4 (patch) | |
tree | b1f02c57910398a7d7aa80ff114ebc3a15ca6412 /src | |
parent | e0fd48c5ead4224dcfe2a245b1d4093c5a78bf81 (diff) |
stats: Add counters and gauges for BORKEN lchans/TS
Now we can monitor the situation with the BORKEN lchans and TS in our
BTS's over time.
Change-Id: I427bbe1613a0e92bff432a7d76592fe50f620ebe
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bsc/bsc_vty.c | 5 | ||||
-rw-r--r-- | src/osmo-bsc/gsm_data.c | 2 | ||||
-rw-r--r-- | src/osmo-bsc/lchan_fsm.c | 32 | ||||
-rw-r--r-- | src/osmo-bsc/timeslot_fsm.c | 57 |
4 files changed, 90 insertions, 6 deletions
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 30f685faa..d699cf7ba 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -5018,9 +5018,10 @@ DEFUN_HIDDEN(lchan_set_borken, lchan_set_borken_cmd, return CMD_WARNING; } } else { - if (lchan->fi->state == LCHAN_ST_BORKEN) + if (lchan->fi->state == LCHAN_ST_BORKEN) { + rate_ctr_inc(&lchan->ts->trx->bts->bts_ctrs->ctr[BTS_CTR_LCHAN_BORKEN_EV_VTY]); osmo_fsm_inst_state_chg(lchan->fi, LCHAN_ST_UNUSED, 0, 0); - else { + } else { vty_out(vty, "%% lchan is in state %s, only lchans that are in state %s may be moved to state %s manually%s", osmo_fsm_state_name(lchan->fi->fsm, lchan->fi->state), diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 2847f388f..c34f06cb1 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -392,6 +392,8 @@ static const struct osmo_stat_item_desc bts_stat_desc[] = { { "rach_access", "RACH slots with access bursts in them", "%", 16, 0 }, { "oml_connected", "Number of OML links connected", "", 16, 0 }, { "rsl_connected", "Number of RSL links connected", "", 16, 0 }, + { "lchan_borken", "Number of lchans in the BORKEN state", "", 16, 0 }, + { "ts_borken", "Number of timeslots in the BORKEN state", "", 16, 0 }, }; static const struct osmo_stat_item_group_desc bts_statg_desc = { diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index fc8cd3fd8..ad37e9e07 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -1071,6 +1071,28 @@ static void lchan_fsm_wait_rf_release_ack(struct osmo_fsm_inst *fi, uint32_t eve static void lchan_fsm_borken_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct gsm_lchan *lchan = lchan_fi_lchan(fi); + enum bts_counter_id ctr; + switch (prev_state) { + case LCHAN_ST_UNUSED: + ctr = BTS_CTR_LCHAN_BORKEN_FROM_UNUSED; + break; + case LCHAN_ST_WAIT_ACTIV_ACK: + ctr = BTS_CTR_LCHAN_BORKEN_FROM_WAIT_ACTIV_ACK; + break; + case LCHAN_ST_WAIT_RF_RELEASE_ACK: + ctr = BTS_CTR_LCHAN_BORKEN_FROM_WAIT_RF_RELEASE_ACK; + break; + case LCHAN_ST_BORKEN: + ctr = BTS_CTR_LCHAN_BORKEN_FROM_BORKEN; + break; + default: + ctr = BTS_CTR_LCHAN_BORKEN_FROM_UNKNOWN; + } + rate_ctr_inc(&lchan->ts->trx->bts->bts_ctrs->ctr[ctr]); + if (prev_state != LCHAN_ST_BORKEN) + osmo_stat_item_inc(lchan->ts->trx->bts->bts_statg->items[BTS_STAT_LCHAN_BORKEN], 1); + + /* The actual action besides all the beancounting above */ lchan_reset(lchan); } @@ -1081,6 +1103,8 @@ static void lchan_fsm_borken(struct osmo_fsm_inst *fi, uint32_t event, void *dat case LCHAN_EV_RSL_CHAN_ACTIV_ACK: /* A late Chan Activ ACK? Release. */ + rate_ctr_inc(&lchan->ts->trx->bts->bts_ctrs->ctr[BTS_CTR_LCHAN_BORKEN_EV_CHAN_ACTIV_ACK]); + osmo_stat_item_dec(lchan->ts->trx->bts->bts_statg->items[BTS_STAT_LCHAN_BORKEN], 1); lchan->release.in_error = true; lchan->release.rsl_error_cause = RSL_ERR_INTERWORKING; lchan_fsm_state_chg(LCHAN_ST_WAIT_RF_RELEASE_ACK); @@ -1088,11 +1112,15 @@ static void lchan_fsm_borken(struct osmo_fsm_inst *fi, uint32_t event, void *dat case LCHAN_EV_RSL_CHAN_ACTIV_NACK: /* A late Chan Activ NACK? Ok then, unused. */ + rate_ctr_inc(&lchan->ts->trx->bts->bts_ctrs->ctr[BTS_CTR_LCHAN_BORKEN_EV_CHAN_ACTIV_NACK]); + osmo_stat_item_dec(lchan->ts->trx->bts->bts_statg->items[BTS_STAT_LCHAN_BORKEN], 1); lchan_fsm_state_chg(LCHAN_ST_UNUSED); return; case LCHAN_EV_RSL_RF_CHAN_REL_ACK: /* A late Release ACK? */ + rate_ctr_inc(&lchan->ts->trx->bts->bts_ctrs->ctr[BTS_CTR_LCHAN_BORKEN_EV_RF_CHAN_REL_ACK]); + osmo_stat_item_dec(lchan->ts->trx->bts->bts_statg->items[BTS_STAT_LCHAN_BORKEN], 1); lchan->release.in_error = true; lchan->release.rsl_error_cause = RSL_ERR_INTERWORKING; lchan_fsm_state_chg(LCHAN_ST_WAIT_AFTER_ERROR); @@ -1384,6 +1412,10 @@ exit_release_handler: void lchan_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) { struct gsm_lchan *lchan = lchan_fi_lchan(fi); + if (lchan->fi->state == LCHAN_ST_BORKEN) { + rate_ctr_inc(&lchan->ts->trx->bts->bts_ctrs->ctr[BTS_CTR_LCHAN_BORKEN_EV_CLEANUP]); + osmo_stat_item_dec(lchan->ts->trx->bts->bts_statg->items[BTS_STAT_LCHAN_BORKEN], 1); + } lchan_reset(lchan); if (lchan->last_error) { talloc_free(lchan->last_error); diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c index f8adfb6c7..5bf182ea2 100644 --- a/src/osmo-bsc/timeslot_fsm.c +++ b/src/osmo-bsc/timeslot_fsm.c @@ -654,6 +654,40 @@ static void ts_fsm_in_use(struct osmo_fsm_inst *fi, uint32_t event, void *data) } } +static void ts_fsm_borken_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gsm_bts_trx_ts *ts = ts_fi_ts(fi); + enum bts_counter_id ctr; + switch (prev_state) { + case TS_ST_NOT_INITIALIZED: + ctr = BTS_CTR_TS_BORKEN_FROM_NOT_INITIALIZED; + break; + case TS_ST_UNUSED: + ctr = BTS_CTR_TS_BORKEN_FROM_UNUSED; + break; + case TS_ST_WAIT_PDCH_ACT: + ctr = BTS_CTR_TS_BORKEN_FROM_WAIT_PDCH_ACT; + break; + case TS_ST_PDCH: + ctr = BTS_CTR_TS_BORKEN_FROM_PDCH; + break; + case TS_ST_WAIT_PDCH_DEACT: + ctr = BTS_CTR_TS_BORKEN_FROM_WAIT_PDCH_DEACT; + break; + case TS_ST_IN_USE: + ctr = BTS_CTR_TS_BORKEN_FROM_IN_USE; + break; + case TS_ST_BORKEN: + ctr = BTS_CTR_TS_BORKEN_FROM_BORKEN; + break; + default: + ctr = BTS_CTR_TS_BORKEN_FROM_UNKNOWN; + } + rate_ctr_inc(&ts->trx->bts->bts_ctrs->ctr[ctr]); + if (prev_state != LCHAN_ST_BORKEN) + osmo_stat_item_inc(ts->trx->bts->bts_statg->items[BTS_STAT_TS_BORKEN], 1); +} + static void ts_fsm_borken(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { @@ -669,10 +703,14 @@ static void ts_fsm_borken(struct osmo_fsm_inst *fi, uint32_t event, void *data) } case TS_EV_PDCH_ACT_ACK: - /* Late PDCH activation ACK is not a crime. - * Just go into the PDCH mode as normal. */ - osmo_fsm_inst_state_chg(fi, TS_ST_PDCH, 0, 0); - return; + { + struct gsm_bts_trx_ts *ts = ts_fi_ts(fi); + /* Late PDCH activation ACK is not a crime. + * Just go into the PDCH mode as normal. */ + osmo_stat_item_dec(ts->trx->bts->bts_statg->items[BTS_STAT_TS_BORKEN], 1); + osmo_fsm_inst_state_chg(fi, TS_ST_PDCH, 0, 0); + return; + } default: OSMO_ASSERT(false); @@ -725,6 +763,15 @@ 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_CLEANUP]); + osmo_stat_item_dec(ts->trx->bts->bts_statg->items[BTS_STAT_TS_BORKEN], 1); + } +} + #define S(x) (1 << (x)) static const struct osmo_fsm_state ts_fsm_states[] = { @@ -822,6 +869,7 @@ static const struct osmo_fsm_state ts_fsm_states[] = { }, [TS_ST_BORKEN] = { .name = "BORKEN", + .onenter = ts_fsm_borken_onenter, .action = ts_fsm_borken, .in_event_mask = 0 | S(TS_EV_LCHAN_REQUESTED) @@ -862,6 +910,7 @@ static struct osmo_fsm ts_fsm = { | S(TS_EV_RSL_DOWN) , .allstate_action = ts_fsm_allstate, + .cleanup = ts_fsm_cleanup, }; /* Return true if any lchans are waiting for this timeslot to become a specific PCHAN. If target_pchan is |