[PATCH] ABIS: Support for multiple RSL connections

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/OpenBSC@lists.osmocom.org/.

Andreas Eversberg jolly at eversberg.eu
Mon Jan 20 12:08:21 UTC 2014


---
 include/osmo-bts/abis.h   |  2 +-
 src/common/abis.c         | 57 ++++++++++++++++++++++++++++++++++-------------
 src/common/oml.c          |  7 +++---
 src/osmo-bts-sysmo/main.c |  2 +-
 4 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/include/osmo-bts/abis.h b/include/osmo-bts/abis.h
index fb0fbd7..ceda736 100644
--- a/include/osmo-bts/abis.h
+++ b/include/osmo-bts/abis.h
@@ -17,7 +17,7 @@ enum {
 };
 
 struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host,
-			     const char *model_name);
+			     const char *model_name, int num_trx);
 
 
 int abis_oml_sendmsg(struct msgb *msg);
diff --git a/src/common/abis.c b/src/common/abis.c
index 37e82f3..4c4699d 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -34,6 +34,7 @@
 #include <osmocom/core/timer.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/signal.h>
+#include <osmocom/core/talloc.h>
 #include <osmocom/abis/abis.h>
 #include <osmocom/abis/e1_input.h>
 #include <osmocom/abis/ipaccess.h>
@@ -68,6 +69,8 @@ static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line,
 					    enum e1inp_sign_type type)
 {
 	struct e1inp_sign_link *sign_link = NULL;
+	struct gsm_bts_trx *trx;
+	uint8_t trx_id;
 
 	switch (type) {
 	case E1INP_SIGN_OML:
@@ -79,17 +82,22 @@ static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line,
 		sign_link->trx = g_bts->c0;
 		bts_link_estab(g_bts);
 		break;
-	case E1INP_SIGN_RSL:
-		LOGP(DABIS, LOGL_INFO, "RSL Signalling link up\n");
-		e1inp_ts_config_sign(&line->ts[E1INP_SIGN_RSL-1], line);
-		sign_link = g_bts->c0->rsl_link =
-			e1inp_sign_link_create(&line->ts[E1INP_SIGN_RSL-1],
-						E1INP_SIGN_RSL, NULL, 0, 0);
-		/* FIXME: This assumes there is only one TRX! */
-		sign_link->trx = g_bts->c0;
-		trx_link_estab(sign_link->trx);
-		break;
 	default:
+		trx_id = type - E1INP_SIGN_RSL;
+		LOGP(DABIS, LOGL_INFO, "RSL Signalling link for TRX %d up\n",
+			trx_id);
+		trx = gsm_bts_trx_num(g_bts, trx_id);
+		if (!trx) {
+			LOGP(DABIS, LOGL_ERROR, "TRX ID %d does not exits\n",
+				trx_id);
+			break;
+		}
+		e1inp_ts_config_sign(&line->ts[type-1], line);
+		sign_link = trx->rsl_link =
+			e1inp_sign_link_create(&line->ts[type-1],
+						E1INP_SIGN_RSL, NULL, 0, 0);
+		sign_link->trx = trx;
+		trx_link_estab(trx);
 		break;
 	}
 
@@ -98,12 +106,16 @@ static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line,
 
 static void sign_link_down(struct e1inp_line *line)
 {
+	struct gsm_bts_trx *trx;
+
 	LOGP(DABIS, LOGL_ERROR, "Signalling link down\n");
 
-	if (g_bts->c0->rsl_link) {
-		e1inp_sign_link_destroy(g_bts->c0->rsl_link);
-		g_bts->c0->rsl_link = NULL;
-		trx_link_estab(g_bts->c0);
+	llist_for_each_entry(trx, &g_bts->trx_list, list) {
+		if (trx->rsl_link) {
+			e1inp_sign_link_destroy(trx->rsl_link);
+			trx->rsl_link = NULL;
+			trx_link_estab(trx);
+		}
 	}
 
 	if (g_bts->oml_link)
@@ -212,7 +224,6 @@ static struct e1inp_line_ops line_ops = {
 	.cfg = {
 		.ipa = {
 			.role	= E1INP_LINE_R_BTS,
-			.dev	= &bts_dev_info,
 		},
 	},
 	.sign_link_up	= sign_link_up,
@@ -224,9 +235,11 @@ static struct e1inp_line_ops line_ops = {
  * global initialization as well as the actual opening of the A-bis link
  * */
 struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host,
-			     const char *model_name)
+			     const char *model_name, int num_trx)
 {
 	struct e1inp_line *line;
+	struct ipaccess_unit *units;
+	int i;
 
 	g_bts = bts;
 
@@ -236,6 +249,13 @@ struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host,
 
 	osmo_signal_register_handler(SS_L_INPUT, &inp_s_cbfn, bts);
 
+	/* allocate list of ipaccess dev info (OML and each RSL connection) */
+	units = talloc_zero_array(tall_bts_ctx, struct ipaccess_unit,
+	        num_trx+1);
+	if (!units)
+		return NULL;
+	line_ops.cfg.ipa.dev = units;
+
 	/* patch in various data from VTY and othe sources */
 	line_ops.cfg.ipa.addr = dst_host;
 	get_mac_addr("eth0", bts_dev_info.mac_addr);
@@ -250,6 +270,11 @@ struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host,
 	if (!line)
 		return NULL;
 	e1inp_line_bind_ops(line, &line_ops);
+	memcpy(&units[0], &bts_dev_info, sizeof(*units));
+	for (i = 0; i < num_trx; i++) {
+		memcpy(&units[i+1], &bts_dev_info, sizeof(*units));
+		units[i+1].trx_id = i;
+	}
 
 	/* This is what currently starts both the outbound OML and RSL
 	 * connections, which is wrong.
diff --git a/src/common/oml.c b/src/common/oml.c
index bf174b5..acde230 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1018,10 +1018,11 @@ static int rx_oml_ipa_rsl_connect(struct gsm_bts_trx *trx, struct msgb *msg,
 	}
 
 	in.s_addr = htonl(ip);
-	LOGP(DOML, LOGL_INFO, "Rx IPA RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n", 
-		inet_ntoa(in), port, stream_id);
+	LOGP(DOML, LOGL_INFO, "Rx IPA RSL CONNECT TRX=%d IP=%s PORT=%u "
+		"STREAM=0x%02x\n", trx->nr, inet_ntoa(in), port, stream_id);
 
-	rc = e1inp_ipa_bts_rsl_connect(oml_link->ts->line, inet_ntoa(in), port);
+	rc = e1inp_ipa_bts_rsl_connect(oml_link->ts->line, inet_ntoa(in), port,
+		trx->nr);
 	if (rc < 0) {
 		LOGP(DOML, LOGL_ERROR, "Error in abis_open(RSL): %d\n", rc);
 		return oml_fom_ack_nack(msg, NM_NACK_CANT_PERFORM);
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 74ee47f..f85748f 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -365,7 +365,7 @@ int main(int argc, char **argv)
 		exit(1);
 	}
 
-	line = abis_open(bts, btsb->bsc_oml_host, "sysmoBTS");
+	line = abis_open(bts, btsb->bsc_oml_host, "sysmoBTS", 1);
 	if (!line) {
 		fprintf(stderr, "unable to connect to BSC\n");
 		exit(1);
-- 
1.8.1.5


--------------030007020209040104000503--




More information about the OpenBSC mailing list