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 code was successfully tested with osmobts-trx and UmTRX with two
transceivers.
The user of e1inp_ipa_bts_rsl_connect() and e1inp_line_bind_ops()
(which is osmo-bts) must be upgraded after applying the patch.
---
include/osmocom/abis/e1_input.h | 3 ++-
src/input/ipaccess.c | 16 ++++++++++------
tests/e1inp_ipa_bts_test.c | 2 +-
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 0abf0b8..2a9890c 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -258,7 +258,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 9722b2f..86ddd3a 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -838,6 +838,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);
+ struct ipaccess_unit *unit_data;
LOGP(DLINP, LOGL_NOTICE, "received ID get\n");
if (!link->line->ops->sign_link_up) {
@@ -847,7 +848,9 @@ static int ipaccess_bts_read_cb(struct ipa_client_conn *link, struct
msgb *msg)
ret = -EINVAL;
goto err;
}
- rmsg = ipa_bts_id_resp(link->line->ops->cfg.ipa.dev,
+ unit_data = (struct ipaccess_unit *)
+ link->line->ops->cfg.ipa.dev;
+ rmsg = ipa_bts_id_resp(&unit_data[link->ofd->priv_nr-1],
data + 1, len - 1);
ret = ipaccess_send(link->ofd->fd, rmsg->data,
rmsg->len);
@@ -869,7 +872,7 @@ static int ipaccess_bts_read_cb(struct ipa_client_conn *link, struct
msgb *msg)
}
msgb_free(rmsg);
- sign_link = link->line->ops->sign_link_up(msg,
+ sign_link = link->line->ops->sign_link_up(unit_data,
link->line,
link->ofd->priv_nr);
if (sign_link == NULL) {
@@ -885,7 +888,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);
@@ -1016,13 +1019,14 @@ 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_id)
{
struct ipa_client_conn *rsl_link;
rsl_link = ipa_client_conn_create(tall_ipa_ctx,
- &line->ts[E1INP_SIGN_RSL-1],
- E1INP_SIGN_RSL,
+ &line->ts[E1INP_SIGN_RSL+trx_id-1],
+ E1INP_SIGN_RSL+trx_id,
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
--------------030007020209040104000503
Content-Type: text/x-diff;
name="osmo-bts_Support-for-multiple-RSL-connections.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="osmo-bts_Support-for-multiple-RSL-connections.patch"