aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/gsm_data.h57
-rw-r--r--include/osmocom/bsc/gsm_data_shared.h2
-rw-r--r--src/libbsc/abis_rsl.c18
-rw-r--r--src/libbsc/bsc_init.c4
-rw-r--r--src/libbsc/bsc_vty.c25
-rw-r--r--src/libcommon/gsm_data_shared.c8
-rw-r--r--src/osmo-bsc_nat/Makefile.am1
7 files changed, 69 insertions, 46 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 1ca3bc967..cc0848398 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -185,10 +185,43 @@ struct gsm_subscriber_connection {
#include "gsm_data_shared.h"
+enum {
+ BTS_CTR_CHREQ_TOTAL,
+ BTS_CTR_CHREQ_NO_CHANNEL,
+ BTS_CTR_CHAN_RF_FAIL,
+ BTS_CTR_CHAN_RLL_ERR,
+ BTS_CTR_BTS_OML_FAIL,
+ BTS_CTR_BTS_RSL_FAIL,
+ BTS_CTR_CODEC_AMR_F,
+ BTS_CTR_CODEC_AMR_H,
+ BTS_CTR_CODEC_EFR,
+ BTS_CTR_CODEC_V1_FR,
+ BTS_CTR_CODEC_V1_HR,
+};
+
+static const struct rate_ctr_desc bts_ctr_description[] = {
+ [BTS_CTR_CHREQ_TOTAL] = {"chreq.total", "Received channel requests."},
+ [BTS_CTR_CHREQ_NO_CHANNEL] = {"chreq.no_channel", "Sent to MS no channel available."},
+ [BTS_CTR_CHAN_RF_FAIL] = {"chan.rf_fail", "Received a RF failure indication from BTS."},
+ [BTS_CTR_CHAN_RLL_ERR] = {"chan.rll_err", "Received a RLL failure with T200 cause from BTS."},
+ [BTS_CTR_BTS_OML_FAIL] = {"oml_fail", "Received a TEI down on a OML link."},
+ [BTS_CTR_BTS_RSL_FAIL] = {"rsl_fail", "Received a TEI down on a OML link."},
+ [BTS_CTR_CODEC_AMR_F] = {"codec_amr_f", "Count the usage of AMR/F codec by channel mode requested."},
+ [BTS_CTR_CODEC_AMR_H] = {"codec_amr_h", "Count the usage of AMR/H codec by channel mode requested."},
+ [BTS_CTR_CODEC_EFR] = {"codec_efr", "Count the usage of EFR codec by channel mode requested."},
+ [BTS_CTR_CODEC_V1_FR] = {"codec_fr", "Count the usage of FR codec by channel mode requested."},
+ [BTS_CTR_CODEC_V1_HR] = {"codec_hr", "Count the usage of HR codec by channel mode requested."},
+};
+
+static const struct rate_ctr_group_desc bts_ctrg_desc = {
+ "bts",
+ "base transceiver station",
+ OSMO_STATS_CLASS_GLOBAL,
+ ARRAY_SIZE(bts_ctr_description),
+ bts_ctr_description,
+};
enum {
- BSC_CTR_CHREQ_TOTAL,
- BSC_CTR_CHREQ_NO_CHANNEL,
BSC_CTR_HANDOVER_ATTEMPTED,
BSC_CTR_HANDOVER_NO_CHANNEL,
BSC_CTR_HANDOVER_TIMEOUT,
@@ -198,20 +231,9 @@ enum {
BSC_CTR_PAGING_DETACHED,
BSC_CTR_PAGING_COMPLETED,
BSC_CTR_PAGING_EXPIRED,
- BSC_CTR_CHAN_RF_FAIL,
- BSC_CTR_CHAN_RLL_ERR,
- BSC_CTR_BTS_OML_FAIL,
- BSC_CTR_BTS_RSL_FAIL,
- BSC_CTR_CODEC_AMR_F,
- BSC_CTR_CODEC_AMR_H,
- BSC_CTR_CODEC_EFR,
- BSC_CTR_CODEC_V1_FR,
- BSC_CTR_CODEC_V1_HR,
};
static const struct rate_ctr_desc bsc_ctr_description[] = {
- [BSC_CTR_CHREQ_TOTAL] = {"chreq.total", "Received channel requests."},
- [BSC_CTR_CHREQ_NO_CHANNEL] = {"chreq.no_channel", "Sent to MS no channel available."},
[BSC_CTR_HANDOVER_ATTEMPTED] = {"handover.attempted", "Received handover attempts."},
[BSC_CTR_HANDOVER_NO_CHANNEL] = {"handover.no_channel", "Sent no channel available responses."},
[BSC_CTR_HANDOVER_TIMEOUT] = {"handover.timeout", "Count the amount of timeouts of timer T3103."},
@@ -221,15 +243,6 @@ static const struct rate_ctr_desc bsc_ctr_description[] = {
[BSC_CTR_PAGING_DETACHED] = {"paging.detached", "Counts the amount of paging attempts which couldn't sent out any paging request because no responsible bts found."},
[BSC_CTR_PAGING_COMPLETED] = {"paging.completed", "Paging successful completed."},
[BSC_CTR_PAGING_EXPIRED] = {"paging.expired", "Paging Request expired because of timeout T3113."},
- [BSC_CTR_CHAN_RF_FAIL] = {"chan.rf_fail", "Received a RF failure indication from BTS."},
- [BSC_CTR_CHAN_RLL_ERR] = {"chan.rll_err", "Received a RLL failure with T200 cause from BTS."},
- [BSC_CTR_BTS_OML_FAIL] = {"bts.oml_fail", "Received a TEI down on a OML link."},
- [BSC_CTR_BTS_RSL_FAIL] = {"bts.rsl_fail", "Received a TEI down on a OML link."},
- [BSC_CTR_CODEC_AMR_F] = {"bts.codec_amr_f", "Count the usage of AMR/F codec by channel mode requested."},
- [BSC_CTR_CODEC_AMR_H] = {"bts.codec_amr_h", "Count the usage of AMR/H codec by channel mode requested."},
- [BSC_CTR_CODEC_EFR] = {"bts.codec_efr", "Count the usage of EFR codec by channel mode requested."},
- [BSC_CTR_CODEC_V1_FR] = {"bts.codec_fr", "Count the usage of FR codec by channel mode requested."},
- [BSC_CTR_CODEC_V1_HR] = {"bts.codec_hr", "Count the usage of HR codec by channel mode requested."},
};
enum {
diff --git a/include/osmocom/bsc/gsm_data_shared.h b/include/osmocom/bsc/gsm_data_shared.h
index d7514ca39..e762c24d4 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -807,6 +807,8 @@ struct gsm_bts {
/* PCU socket state */
char *pcu_sock_path;
struct pcu_sock_state *pcu_state;
+
+ struct rate_ctr_group *bts_ctrs;
};
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 996860285..fbaaf099f 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -91,10 +91,10 @@ static void count_codecs(struct gsm_bts *bts, struct gsm_lchan *lchan)
if (lchan->type == GSM_LCHAN_TCH_H) {
switch (lchan->tch_mode) {
case GSM48_CMODE_SPEECH_AMR:
- rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_AMR_H]);
+ rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CODEC_AMR_H]);
break;
case GSM48_CMODE_SPEECH_V1:
- rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_V1_HR]);
+ rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CODEC_V1_HR]);
break;
default:
break;
@@ -102,13 +102,13 @@ static void count_codecs(struct gsm_bts *bts, struct gsm_lchan *lchan)
} else if (lchan->type == GSM_LCHAN_TCH_F) {
switch (lchan->tch_mode) {
case GSM48_CMODE_SPEECH_AMR:
- rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_AMR_F]);
+ rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CODEC_AMR_F]);
break;
case GSM48_CMODE_SPEECH_V1:
- rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_V1_FR]);
+ rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CODEC_V1_FR]);
break;
case GSM48_CMODE_SPEECH_EFR:
- rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_EFR]);
+ rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CODEC_EFR]);
break;
default:
break;
@@ -1366,7 +1366,7 @@ static int rsl_rx_conn_fail(struct msgb *msg)
TLVP_LEN(&tp, RSL_IE_CAUSE));
LOGPC(DRSL, LOGL_NOTICE, "\n");
- rate_ctr_inc(&msg->lchan->ts->trx->bts->network->bsc_ctrs->ctr[BSC_CTR_CHAN_RF_FAIL]);
+ rate_ctr_inc(&msg->lchan->ts->trx->bts->bts_ctrs->ctr[BTS_CTR_CHAN_RF_FAIL]);
return rsl_rf_chan_release_err(msg->lchan);
}
@@ -1872,7 +1872,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
* request reference RA */
lctype = get_ctype_by_chreq(bts->network, rqd_ref->ra);
- rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL]);
+ rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CHREQ_TOTAL]);
/*
* We want LOCATION UPDATES to succeed and will assign a TCH
@@ -1885,7 +1885,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
if (!lchan) {
LOGP(DRSL, LOGL_NOTICE, "BTS %d CHAN RQD: no resources for %s 0x%x\n",
msg->lchan->ts->trx->bts->nr, gsm_lchant_name(lctype), rqd_ref->ra);
- rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CHREQ_NO_CHANNEL]);
+ rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_CHREQ_NO_CHANNEL]);
/* FIXME gather multiple CHAN RQD and reject up to 4 at the same time */
if (bts->network->T3122)
rsl_send_imm_ass_rej(bts, 1, rqd_ref, bts->network->T3122 & 0xff);
@@ -2082,7 +2082,7 @@ static int rsl_rx_rll_err_ind(struct msgb *msg)
rll_indication(msg->lchan, rllh->link_id, BSC_RLLR_IND_ERR_IND);
if (rlm_cause == RLL_CAUSE_T200_EXPIRED) {
- rate_ctr_inc(&msg->lchan->ts->trx->bts->network->bsc_ctrs->ctr[BSC_CTR_CHAN_RLL_ERR]);
+ rate_ctr_inc(&msg->lchan->ts->trx->bts->bts_ctrs->ctr[BTS_CTR_CHAN_RLL_ERR]);
return rsl_rf_chan_release_err(msg->lchan);
}
diff --git a/src/libbsc/bsc_init.c b/src/libbsc/bsc_init.c
index 18742009f..2fb384262 100644
--- a/src/libbsc/bsc_init.c
+++ b/src/libbsc/bsc_init.c
@@ -399,9 +399,9 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
LOGP(DLMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", isd->link_type, trx);
if (isd->link_type == E1INP_SIGN_OML)
- rate_ctr_inc(&trx->bts->network->bsc_ctrs->ctr[BSC_CTR_BTS_OML_FAIL]);
+ rate_ctr_inc(&trx->bts->bts_ctrs->ctr[BTS_CTR_BTS_OML_FAIL]);
else if (isd->link_type == E1INP_SIGN_RSL)
- rate_ctr_inc(&trx->bts->network->bsc_ctrs->ctr[BSC_CTR_BTS_RSL_FAIL]);
+ rate_ctr_inc(&trx->bts->bts_ctrs->ctr[BTS_CTR_BTS_RSL_FAIL]);
/*
* free all allocated channels. change the nm_state so the
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 3f3935cbe..42b71650a 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -321,6 +321,19 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
bts_chan_load(&pl, bts);
vty_out(vty, " Current Channel Load:%s", VTY_NEWLINE);
dump_pchan_load_vty(vty, " ", &pl);
+
+ vty_out(vty, "Channel Requests : %"PRIu64" total, %"PRIu64" no channel%s",
+ bts->bts_ctrs->ctr[BTS_CTR_CHREQ_TOTAL].current,
+ bts->bts_ctrs->ctr[BTS_CTR_CHREQ_NO_CHANNEL].current,
+ VTY_NEWLINE);
+ vty_out(vty, "Channel Failures : %"PRIu64" rf_failures, %"PRIu64" rll failures%s",
+ bts->bts_ctrs->ctr[BTS_CTR_CHAN_RF_FAIL].current,
+ bts->bts_ctrs->ctr[BTS_CTR_CHAN_RLL_ERR].current,
+ VTY_NEWLINE);
+ vty_out(vty, "BTS failures : %"PRIu64" OML, %"PRIu64" RSL%s",
+ bts->bts_ctrs->ctr[BTS_CTR_BTS_OML_FAIL].current,
+ bts->bts_ctrs->ctr[BTS_CTR_BTS_RSL_FAIL].current,
+ VTY_NEWLINE);
}
DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
@@ -3781,23 +3794,11 @@ DEFUN(cfg_ts_e1_subslot,
void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
{
- vty_out(vty, "Channel Requests : %"PRIu64" total, %"PRIu64" no channel%s",
- net->bsc_ctrs->ctr[BSC_CTR_CHREQ_TOTAL].current,
- net->bsc_ctrs->ctr[BSC_CTR_CHREQ_NO_CHANNEL].current,
- VTY_NEWLINE);
- vty_out(vty, "Channel Failures : %"PRIu64" rf_failures, %"PRIu64" rll failures%s",
- net->bsc_ctrs->ctr[BSC_CTR_CHAN_RF_FAIL].current,
- net->bsc_ctrs->ctr[BSC_CTR_CHAN_RLL_ERR].current,
- VTY_NEWLINE);
vty_out(vty, "Paging : %"PRIu64" attempted, %"PRIu64" complete, %"PRIu64" expired%s",
net->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED].current,
net->bsc_ctrs->ctr[BSC_CTR_PAGING_COMPLETED].current,
net->bsc_ctrs->ctr[BSC_CTR_PAGING_EXPIRED].current,
VTY_NEWLINE);
- vty_out(vty, "BTS failures : %"PRIu64" OML, %"PRIu64" RSL%s",
- net->bsc_ctrs->ctr[BSC_CTR_BTS_OML_FAIL].current,
- net->bsc_ctrs->ctr[BSC_CTR_BTS_RSL_FAIL].current,
- VTY_NEWLINE);
}
DEFUN(drop_bts,
diff --git a/src/libcommon/gsm_data_shared.c b/src/libcommon/gsm_data_shared.c
index e4ae339fc..2f7e7e353 100644
--- a/src/libcommon/gsm_data_shared.c
+++ b/src/libcommon/gsm_data_shared.c
@@ -346,9 +346,17 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
memcpy(&bts->gprs.cell.rlc_cfg, &rlc_cfg_default,
sizeof(bts->gprs.cell.rlc_cfg));
+ /* init statistics */
+ bts->bts_ctrs = rate_ctr_group_alloc(bts, &bts_ctrg_desc, 0);
+ if (!bts->bts_ctrs) {
+ talloc_free(bts);
+ return NULL;
+ }
+
/* create our primary TRX */
bts->c0 = gsm_bts_trx_alloc(bts);
if (!bts->c0) {
+ talloc_free(bts->bts_ctrs);
talloc_free(bts);
return NULL;
}
diff --git a/src/osmo-bsc_nat/Makefile.am b/src/osmo-bsc_nat/Makefile.am
index 23c2b6757..dd20ddb76 100644
--- a/src/osmo-bsc_nat/Makefile.am
+++ b/src/osmo-bsc_nat/Makefile.am
@@ -50,7 +50,6 @@ osmo_bsc_nat_LDADD = \
$(LIBOSMOVTY_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOSIGTRAN_LIBS) \
- $(LIBOSMOLEGACYMGCP_LIBS) \
$(LIBCRYPTO_LIBS) \
$(LIBRARY_GSM) \
-lrt \