[MERGED] openbsc[master]: bts: extend bts_chan_load to allow counting tch only

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Sep 23 02:43:12 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: bts: extend bts_chan_load to allow counting tch only
......................................................................


bts: extend bts_chan_load to allow counting tch only

Change-Id: I86f1d502649747b6b9aefcb39081b14110e8f494
---
M openbsc/include/openbsc/chan_alloc.h
M openbsc/src/libbsc/bsc_ctrl_commands.c
M openbsc/src/libbsc/bsc_vty.c
M openbsc/src/libbsc/chan_alloc.c
M openbsc/src/libbsc/paging.c
5 files changed, 30 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/include/openbsc/chan_alloc.h b/openbsc/include/openbsc/chan_alloc.h
index 78242e5..d919b51 100644
--- a/openbsc/include/openbsc/chan_alloc.h
+++ b/openbsc/include/openbsc/chan_alloc.h
@@ -46,7 +46,7 @@
 	struct load_counter pchan[_GSM_PCHAN_MAX];
 };
 
-void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts);
+void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts, int only_count_tch);
 void network_chan_load(struct pchan_load *pl, struct gsm_network *net);
 
 int trx_is_usable(struct gsm_bts_trx *trx);
diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c
index 7e84797..3f4fee2 100644
--- a/openbsc/src/libbsc/bsc_ctrl_commands.c
+++ b/openbsc/src/libbsc/bsc_ctrl_commands.c
@@ -239,7 +239,7 @@
 
 	bts = cmd->node;
 	memset(&pl, 0, sizeof(pl));
-	bts_chan_load(&pl, bts);
+	bts_chan_load(&pl, bts, 0);
 
 	cmd->reply = talloc_strdup(cmd, "");
 
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 5c95e85..01eec23 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -329,7 +329,7 @@
 
 	/* FIXME: chan_desc */
 	memset(&pl, 0, sizeof(pl));
-	bts_chan_load(&pl, bts);
+	bts_chan_load(&pl, bts, 0);
 	vty_out(vty, "  Current Channel Load:%s", VTY_NEWLINE);
 	dump_pchan_load_vty(vty, "    ", &pl);
 }
diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index 7b0c3e6..03d44e0 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -514,7 +514,28 @@
 	return NULL;
 }
 
-void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
+static int chan_is_tch(struct gsm_bts_trx_ts *ts)
+{
+	switch (ts->pchan) {
+		case GSM_PCHAN_TCH_F:
+		case GSM_PCHAN_TCH_H:
+			return 1;
+		case GSM_PCHAN_TCH_F_PDCH:
+		case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+			if (ts->dyn.pchan_is == GSM_PCHAN_TCH_F ||
+					ts->dyn.pchan_is == GSM_PCHAN_TCH_H)
+				return 1;
+			else
+				return 0;
+		default:
+			return 0;
+	}
+}
+
+
+
+void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts,
+		   int only_count_tch)
 {
 	struct gsm_bts_trx *trx;
 
@@ -534,6 +555,9 @@
 
 			/* skip administratively deactivated timeslots */
 			if (!nm_is_running(&ts->mo.nm_state))
+				continue;
+
+			if (only_count_tch && !chan_is_tch(ts))
 				continue;
 
 			subslots = ts_subslots(ts);
@@ -561,6 +585,5 @@
 	memset(pl, 0, sizeof(*pl));
 
 	llist_for_each_entry(bts, &net->bts_list, list)
-		bts_chan_load(pl, bts);
+		bts_chan_load(pl, bts, 0);
 }
-
diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c
index fcb4deb..e3795b3 100644
--- a/openbsc/src/libbsc/paging.c
+++ b/openbsc/src/libbsc/paging.c
@@ -119,7 +119,7 @@
 	int count;
 
 	memset(&pl, 0, sizeof(pl));
-	bts_chan_load(&pl, bts);
+	bts_chan_load(&pl, bts, 0);
 
 	switch (rsl_type) {
 	case RSL_CHANNEED_TCH_F:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I86f1d502649747b6b9aefcb39081b14110e8f494
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list