[MERGED] openbsc[master]: mscsplit: move subscriber conns list into struct gsm_network

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Sep 26 00:34:23 UTC 2016


Neels Hofmeyr has submitted this change and it was merged.

Change subject: mscsplit: move subscriber conns list into struct gsm_network
......................................................................


mscsplit: move subscriber conns list into struct gsm_network

Replace the global sub_connections llist with gsm_network.subscr_conns.
Initialize and apply where applicable.

Remove bsc_api_sub_connections(), callers now access gsm_network->subscr_conns
directly.

This allows using the subscr_conns from libmsc without having to link libbsc.

Change-Id: Ice2a7ca04910bcfaaff22539abe68a6349e8631c
---
M openbsc/include/openbsc/bsc_api.h
M openbsc/include/openbsc/gsm_data.h
M openbsc/src/libbsc/bsc_api.c
M openbsc/src/libbsc/net_init.c
M openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
5 files changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved



diff --git a/openbsc/include/openbsc/bsc_api.h b/openbsc/include/openbsc/bsc_api.h
index a3d12f2..3a93119 100644
--- a/openbsc/include/openbsc/bsc_api.h
+++ b/openbsc/include/openbsc/bsc_api.h
@@ -52,6 +52,4 @@
 		 unsigned int mi_len, uint8_t *mi, int chan_type);
 int gsm0808_clear(struct gsm_subscriber_connection *conn);
 
-struct llist_head *bsc_api_sub_connections(struct gsm_network *net);
-
 #endif
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 9317717..07db02f 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -345,6 +345,9 @@
 	/* Allow or disallow TCH/F on dynamic TCH/F_TCH/H_PDCH; OS#1778 */
 	bool dyn_ts_allow_tch_f;
 	/* TODO: vty for this; related: OS#1781 */
+
+	/* all active subscriber connections. */
+	struct llist_head subscr_conns;
 };
 
 struct osmo_esme;
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index 8c830a3..f42598a 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -39,7 +39,6 @@
 
 #define GSM0808_T10_VALUE    6, 0
 
-static LLIST_HEAD(sub_connections);
 
 static void rll_ind_cb(struct gsm_lchan *, uint8_t, void *, enum bsc_rllr_ind);
 static void send_sapi_reject(struct gsm_subscriber_connection *conn, int link_id);
@@ -242,15 +241,16 @@
 struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan)
 {
 	struct gsm_subscriber_connection *conn;
+	struct gsm_network *net = lchan->ts->trx->bts->network;
 
-	conn = talloc_zero(lchan->ts->trx->bts->network, struct gsm_subscriber_connection);
+	conn = talloc_zero(net, struct gsm_subscriber_connection);
 	if (!conn)
 		return NULL;
 
 	conn->lchan = lchan;
 	conn->bts = lchan->ts->trx->bts;
 	lchan->conn = conn;
-	llist_add_tail(&conn->entry, &sub_connections);
+	llist_add_tail(&conn->entry, &net->subscr_conns);
 	return conn;
 }
 
@@ -876,7 +876,3 @@
 	osmo_signal_register_handler(SS_LCHAN, bsc_handle_lchan_signal, NULL);
 }
 
-struct llist_head *bsc_api_sub_connections(struct gsm_network *net)
-{
-	return &sub_connections;
-}
diff --git a/openbsc/src/libbsc/net_init.c b/openbsc/src/libbsc/net_init.c
index 65419ae..e01ba80 100644
--- a/openbsc/src/libbsc/net_init.c
+++ b/openbsc/src/libbsc/net_init.c
@@ -79,6 +79,7 @@
 	INIT_LLIST_HEAD(&net->trans_list);
 	INIT_LLIST_HEAD(&net->upqueue);
 	INIT_LLIST_HEAD(&net->bts_list);
+	INIT_LLIST_HEAD(&net->subscr_conns);
 
 	/* init statistics */
 	net->bsc_ctrs = rate_ctr_group_alloc(net, &bsc_ctrg_desc, 0);
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
index 72f80ed..3010b55 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -583,7 +583,7 @@
 	alert = atoi(alert_str);
 
 	net = cmd->node;
-	llist_for_each_entry(conn, bsc_api_sub_connections(net), entry) {
+	llist_for_each_entry(conn, &net->subscr_conns, entry) {
 		if (!conn->sccp_con)
 			continue;
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ice2a7ca04910bcfaaff22539abe68a6349e8631c
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list