[PATCH] openbsc[master]: bsc: count the usage of codec by setting the lchan active

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Aug 30 09:41:41 UTC 2016


Review at  https://gerrit.osmocom.org/794

bsc: count the usage of codec by setting the lchan active

we count the codec when the channel was successful setted up

Change-Id: Ifc8a406a11dce16b9e7f3310841e470545550a2c
---
M openbsc/include/openbsc/gsm_data.h
M openbsc/src/libbsc/abis_rsl.c
2 files changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/94/794/1

diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index bfb7a60..2f09af1 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -166,6 +166,9 @@
 	BSC_CTR_CHAN_RLL_ERR,
 	BSC_CTR_BTS_OML_FAIL,
 	BSC_CTR_BTS_RSL_FAIL,
+	BSC_CTR_CODEC_AMR,
+	BSC_CTR_CODEC_EFR,
+	BSC_CTR_CODEC_V1,
 };
 
 static const struct rate_ctr_desc bsc_ctr_description[] = {
@@ -184,6 +187,9 @@
 	[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] = 			{"bts.codec_amr", "Count the usage of amr 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] = 			{"bts.codec_hfr", "Count the usage of hr or fr codec by channel mode requested."},
 };
 
 enum {
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 4c8448e..71a15aa 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -82,6 +82,21 @@
 	lchan_free(lchan);
 }
 
+static void count_codecs(struct gsm_bts *bts, int chan_mode)
+{
+	switch (chan_mode) {
+	case GSM48_CMODE_SPEECH_AMR:
+		rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_AMR]);
+		break;
+	case GSM48_CMODE_SPEECH_EFR:
+		rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_EFR]);
+		break;
+	case GSM48_CMODE_SPEECH_V1:
+		rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_CODEC_V1]);
+		break;
+	}
+}
+
 static uint8_t mdisc_by_msgtype(uint8_t msg_type)
 {
 	/* mask off the transparent bit ? */
@@ -1164,6 +1179,7 @@
 		lchan->rqd_ta = 0;
 	}
 
+	count_codecs(msg->trx->bts, lchan->tch_mode);
 	send_lchan_signal(S_LCHAN_ACTIVATE_ACK, lchan, NULL);
 
 	return 0;
@@ -1472,6 +1488,7 @@
 		rc = rsl_rx_rf_chan_rel_ack(msg->lchan);
 		break;
 	case RSL_MT_MODE_MODIFY_ACK:
+		count_codecs(msg->trx->bts, msg->lchan->tch_mode);
 		DEBUGP(DRSL, "%s CHANNEL MODE MODIFY ACK\n", ts_name);
 		break;
 	case RSL_MT_MODE_MODIFY_NACK:

-- 
To view, visit https://gerrit.osmocom.org/794
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc8a406a11dce16b9e7f3310841e470545550a2c
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>



More information about the gerrit-log mailing list