[PATCH] Support for multiple RSL connections with ABIS/ipaccess (BTS side)

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
Tue Jan 21 13:54:41 UTC 2014


In order to support multiple TRX, multiple RSL connections can be
establised. e1inp_ipa_bts_rsl_connect() requires an additional parameter
to set the TRX number.

The ts[] array (member of struct e1inp_line) refers to OML and RSL.
ts[0] refers to OML link, ts[1] to RSL link of first TRX, ts[2] to
RSL link of second TRX (if exists) and so on.

The code was successfully tested with osmobts-trx and UmTRX with two
transceivers.

The user of e1inp_ipa_bts_rsl_connect() (which is osmo-bts) must be
upgraded after applying the patch.

src/common/oml.c
-	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);
---
 include/osmocom/abis/e1_input.h |  3 ++-
 src/input/ipaccess.c            | 30 +++++++++++++++++++++++-------
 tests/e1inp_ipa_bts_test.c      |  2 +-
 3 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 9b77893..7fbffe9 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -265,7 +265,8 @@ struct subch_mux *e1inp_get_mux(uint8_t e1_nr, uint8_t ts_nr);
 /* on an IPA BTS, the BTS needs to establish the RSL connection much
  * later than the OML connection. */
 int e1inp_ipa_bts_rsl_connect(struct e1inp_line *line,
-			      const char *rem_addr, uint16_t rem_port);
+			      const char *rem_addr, uint16_t rem_port,
+			      uint8_t trx_id);
 
 void e1inp_sign_link_destroy(struct e1inp_sign_link *link);
 int e1inp_line_update(struct e1inp_line *line);
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 07b47b2..4091d09 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -774,7 +774,7 @@ err_line:
 #define IPA_STRING_MAX 64
 
 static struct msgb *
-ipa_bts_id_resp(struct ipaccess_unit *dev, uint8_t *data, int len)
+ipa_bts_id_resp(struct ipaccess_unit *dev, uint8_t *data, int len, int trx_nr)
 {
 	struct msgb *nmsg;
 	char str[IPA_STRING_MAX];
@@ -795,7 +795,7 @@ ipa_bts_id_resp(struct ipaccess_unit *dev, uint8_t *data, int len)
 		switch (data[1]) {
 		case IPAC_IDTAG_UNIT:
 			snprintf(str, sizeof(str), "%u/%u/%u",
-				dev->site_id, dev->bts_id, dev->trx_id);
+				dev->site_id, dev->bts_id, trx_nr);
 			break;
 		case IPAC_IDTAG_MACADDR:
 			snprintf(str, sizeof(str),
@@ -895,6 +895,7 @@ static int ipaccess_bts_read_cb(struct ipa_client_conn *link, struct msgb *msg)
 			struct e1inp_sign_link *sign_link;
 			uint8_t *data = msgb_l2(msg);
 			int len = msgb_l2len(msg);
+			int trx_nr = 0;
 
 			LOGP(DLINP, LOGL_NOTICE, "received ID get\n");
 			if (!link->line->ops->sign_link_up) {
@@ -904,8 +905,10 @@ static int ipaccess_bts_read_cb(struct ipa_client_conn *link, struct msgb *msg)
 				ret = -EINVAL;
 				goto err;
 			}
+			if (link->ofd->priv_nr >= E1INP_SIGN_RSL)
+				trx_nr = link->ofd->priv_nr - E1INP_SIGN_RSL;
 			rmsg = ipa_bts_id_resp(link->line->ops->cfg.ipa.dev,
-						data + 1, len - 1);
+						data + 1, len - 1, trx_nr);
 			ret = ipaccess_send(link->ofd->fd, rmsg->data,
 						rmsg->len);
 			if (ret != rmsg->len) {
@@ -942,7 +945,7 @@ static int ipaccess_bts_read_cb(struct ipa_client_conn *link, struct msgb *msg)
 	} else if (link->port == IPA_TCP_PORT_OML)
 		e1i_ts = &link->line->ts[0];
 	else if (link->port == IPA_TCP_PORT_RSL)
-		e1i_ts = &link->line->ts[1];
+		e1i_ts = &link->line->ts[link->ofd->priv_nr-1];
 
 	OSMO_ASSERT(e1i_ts != NULL);
 
@@ -1073,13 +1076,26 @@ static int ipaccess_line_update(struct e1inp_line *line)
 }
 
 int e1inp_ipa_bts_rsl_connect(struct e1inp_line *line,
-			      const char *rem_addr, uint16_t rem_port)
+			      const char *rem_addr, uint16_t rem_port,
+			      uint8_t trx_nr)
 {
 	struct ipa_client_conn *rsl_link;
 
+	if (E1INP_SIGN_RSL+trx_nr-1 >= NUM_E1_TS) {
+		LOGP(DLINP, LOGL_ERROR, "cannot create RSL BTS link: "
+			"trx_nr (%d) out of range\n", trx_nr);
+		return -EINVAL;
+	}
+	if (line->ts[E1INP_SIGN_RSL+trx_nr-1].type != E1INP_TS_TYPE_SIGN) {
+		LOGP(DLINP, LOGL_ERROR, "cannot create RSL BTS link: "
+			"trx_nr (%d) does not refer to a signalling link\n",
+			trx_nr);
+		return -EINVAL;
+	}
+
 	rsl_link = ipa_client_conn_create(tall_ipa_ctx,
-					  &line->ts[E1INP_SIGN_RSL-1],
-					  E1INP_SIGN_RSL,
+					  &line->ts[E1INP_SIGN_RSL+trx_nr-1],
+					  E1INP_SIGN_RSL+trx_nr,
 					  rem_addr, rem_port,
 					  ipaccess_bts_updown_cb,
 					  ipaccess_bts_read_cb,
diff --git a/tests/e1inp_ipa_bts_test.c b/tests/e1inp_ipa_bts_test.c
index 02a4cb3..a43dba3 100644
--- a/tests/e1inp_ipa_bts_test.c
+++ b/tests/e1inp_ipa_bts_test.c
@@ -70,7 +70,7 @@ sign_link_up(void *unit, struct e1inp_line *line, enum e1inp_sign_type type)
 			/* Now we can send OML messages to the BSC. */
 			bts_state = BTS_TEST_OML_SIGN_LINK_UP;
 		}
-		e1inp_ipa_bts_rsl_connect(line, "127.0.0.1", IPA_TCP_PORT_RSL);
+		e1inp_ipa_bts_rsl_connect(line, "127.0.0.1", IPA_TCP_PORT_RSL, 0);
 		break;
 	case E1INP_SIGN_RSL:
 		LOGP(DBTSTEST, LOGL_NOTICE, "RSL link up request received.\n");
-- 
1.8.1.5


--------------050208090707040108050104--




More information about the OpenBSC mailing list