aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/e1_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src/libbsc/e1_config.c')
-rw-r--r--openbsc/src/libbsc/e1_config.c125
1 files changed, 66 insertions, 59 deletions
diff --git a/openbsc/src/libbsc/e1_config.c b/openbsc/src/libbsc/e1_config.c
index bd6ebba9d..cda131845 100644
--- a/openbsc/src/libbsc/e1_config.c
+++ b/openbsc/src/libbsc/e1_config.c
@@ -24,13 +24,14 @@
#include <netinet/in.h>
#include <openbsc/gsm_data.h>
-#include <openbsc/e1_input.h>
-#include <openbsc/trau_frame.h>
+#include <osmocom/abis/e1_input.h>
+#include <osmocom/abis/trau_frame.h>
#include <openbsc/trau_mux.h>
#include <openbsc/misdn.h>
-#include <openbsc/ipaccess.h>
+#include <osmocom/abis/ipaccess.h>
#include <osmocom/core/talloc.h>
#include <openbsc/debug.h>
+#include <openbsc/abis_rsl.h>
#define SAPI_L2ML 0
#define SAPI_OML 62
@@ -46,17 +47,17 @@ int e1_reconfig_ts(struct gsm_bts_trx_ts *ts)
struct e1inp_line *line;
struct e1inp_ts *e1_ts;
- DEBUGP(DMI, "e1_reconfig_ts(%u,%u,%u)\n", ts->trx->bts->nr, ts->trx->nr, ts->nr);
+ DEBUGP(DLMI, "e1_reconfig_ts(%u,%u,%u)\n", ts->trx->bts->nr, ts->trx->nr, ts->nr);
if (!e1_link->e1_ts) {
- LOGP(DINP, LOGL_ERROR, "TS (%u/%u/%u) without E1 timeslot?\n",
+ LOGP(DLINP, LOGL_ERROR, "TS (%u/%u/%u) without E1 timeslot?\n",
ts->nr, ts->trx->nr, ts->trx->bts->nr);
return 0;
}
- line = e1inp_line_get(e1_link->e1_nr);
+ line = e1inp_line_find(e1_link->e1_nr);
if (!line) {
- LOGP(DINP, LOGL_ERROR, "TS (%u/%u/%u) referring to "
+ LOGP(DLINP, LOGL_ERROR, "TS (%u/%u/%u) referring to "
"non-existing E1 line %u\n", ts->nr, ts->trx->nr,
ts->trx->bts->nr, e1_link->e1_nr);
return -ENOMEM;
@@ -66,7 +67,7 @@ int e1_reconfig_ts(struct gsm_bts_trx_ts *ts)
case GSM_PCHAN_TCH_F:
case GSM_PCHAN_TCH_H:
e1_ts = &line->ts[e1_link->e1_ts-1];
- e1inp_ts_config(e1_ts, line, E1INP_TS_TYPE_TRAU);
+ e1inp_ts_config_trau(e1_ts, line, subch_cb);
subch_demux_activate(&e1_ts->trau.demux, e1_link->e1_ts_ss);
break;
default:
@@ -85,28 +86,28 @@ int e1_reconfig_trx(struct gsm_bts_trx *trx)
int i;
if (!e1_link->e1_ts) {
- LOGP(DINP, LOGL_ERROR, "TRX (%u/%u) RSL link without "
+ LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link without "
"timeslot?\n", trx->bts->nr, trx->nr);
return -EINVAL;
}
/* RSL Link */
- line = e1inp_line_get(e1_link->e1_nr);
+ line = e1inp_line_find(e1_link->e1_nr);
if (!line) {
- LOGP(DINP, LOGL_ERROR, "TRX (%u/%u) RSL link referring "
+ LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link referring "
"to non-existing E1 line %u\n", trx->bts->nr,
trx->nr, e1_link->e1_nr);
return -ENOMEM;
}
sign_ts = &line->ts[e1_link->e1_ts-1];
- e1inp_ts_config(sign_ts, line, E1INP_TS_TYPE_SIGN);
+ e1inp_ts_config_sign(sign_ts, line);
/* Ericsson RBS have a per-TRX OML link in parallel to RSL */
if (trx->bts->type == GSM_BTS_TYPE_RBS2000) {
struct e1inp_sign_link *oml_link;
oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, trx,
trx->rsl_tei, SAPI_OML);
if (!oml_link) {
- LOGP(DINP, LOGL_ERROR, "TRX (%u/%u) OML link creation "
+ LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) OML link creation "
"failed\n", trx->bts->nr, trx->nr);
return -ENOMEM;
}
@@ -117,7 +118,7 @@ int e1_reconfig_trx(struct gsm_bts_trx *trx)
rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL,
trx, trx->rsl_tei, SAPI_RSL);
if (!rsl_link) {
- LOGP(DINP, LOGL_ERROR, "TRX (%u/%u) RSL link creation "
+ LOGP(DLINP, LOGL_ERROR, "TRX (%u/%u) RSL link creation "
"failed\n", trx->bts->nr, trx->nr);
return -ENOMEM;
}
@@ -131,6 +132,33 @@ int e1_reconfig_trx(struct gsm_bts_trx *trx)
return 0;
}
+/* this is the generic callback for all ISDN-based BTS. */
+static int bts_isdn_sign_link(struct msgb *msg)
+{
+ int ret = -EINVAL;
+ struct e1inp_sign_link *link = msg->dst;
+ struct gsm_bts *bts;
+
+ log_set_context(BSC_CTX_BTS, link->trx->bts);
+ switch (link->type) {
+ case E1INP_SIGN_OML:
+ bts = link->trx->bts;
+ ret = bts->model->oml_rcvmsg(msg);
+ break;
+ case E1INP_SIGN_RSL:
+ ret = abis_rsl_rcvmsg(msg);
+ break;
+ default:
+ LOGP(DLMI, LOGL_ERROR, "unknown link type %u\n", link->type);
+ break;
+ }
+ return ret;
+}
+
+struct e1inp_line_ops bts_isdn_e1inp_line_ops = {
+ .sign_link = bts_isdn_sign_link,
+};
+
int e1_reconfig_bts(struct gsm_bts *bts)
{
struct gsm_e1_subslot *e1_link = &bts->oml_e1_link;
@@ -139,27 +167,40 @@ int e1_reconfig_bts(struct gsm_bts *bts)
struct e1inp_sign_link *oml_link;
struct gsm_bts_trx *trx;
- DEBUGP(DMI, "e1_reconfig_bts(%u)\n", bts->nr);
+ DEBUGP(DLMI, "e1_reconfig_bts(%u)\n", bts->nr);
- if (!e1_link->e1_ts) {
- LOGP(DINP, LOGL_ERROR, "BTS %u OML link without timeslot?\n",
- bts->nr);
+ line = e1inp_line_find(e1_link->e1_nr);
+ if (!line) {
+ LOGP(DLINP, LOGL_ERROR, "BTS %u OML link referring to "
+ "non-existing E1 line %u\n", bts->nr, e1_link->e1_nr);
+ return -ENOMEM;
+ }
+
+ if (!bts->model->e1line_bind_ops) {
+ LOGP(DLINP, LOGL_ERROR, "no callback to bind E1 line operations\n");
return -EINVAL;
}
+ if (!line->ops)
+ bts->model->e1line_bind_ops(line);
+
+ /* skip signal link initialization, this is done later for these BTS. */
+ if (bts->type == GSM_BTS_TYPE_NANOBTS ||
+ bts->type == GSM_BTS_TYPE_HSL_FEMTO)
+ return e1inp_line_update(line);
/* OML link */
- line = e1inp_line_get(e1_link->e1_nr);
- if (!line) {
- LOGP(DINP, LOGL_ERROR, "BTS %u OML link referring to "
- "non-existing E1 line %u\n", bts->nr, e1_link->e1_nr);
- return -ENOMEM;
+ if (!e1_link->e1_ts) {
+ LOGP(DLINP, LOGL_ERROR, "BTS %u OML link without timeslot?\n",
+ bts->nr);
+ return -EINVAL;
}
+
sign_ts = &line->ts[e1_link->e1_ts-1];
- e1inp_ts_config(sign_ts, line, E1INP_TS_TYPE_SIGN);
+ e1inp_ts_config_sign(sign_ts, line);
oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
bts->c0, bts->oml_tei, SAPI_OML);
if (!oml_link) {
- LOGP(DINP, LOGL_ERROR, "BTS %u OML link creation failed\n",
+ LOGP(DLINP, LOGL_ERROR, "BTS %u OML link creation failed\n",
bts->nr);
return -ENOMEM;
}
@@ -260,37 +301,3 @@ int e1_config(struct gsm_bts *bts, int cardnr, int release_l2)
return mi_setup(cardnr, line, release_l2);
}
#endif
-
-/* configure pseudo E1 line in ip.access style and connect to BTS */
-int ia_config_connect(struct gsm_bts *bts, struct sockaddr_in *sin)
-{
- struct e1inp_line *line;
- struct e1inp_ts *sign_ts, *rsl_ts;
- struct e1inp_sign_link *oml_link, *rsl_link;
-
- line = talloc_zero(tall_bsc_ctx, struct e1inp_line);
- if (!line)
- return -ENOMEM;
-
- /* create E1 timeslots for signalling and TRAU frames */
- e1inp_ts_config(&line->ts[1-1], line, E1INP_TS_TYPE_SIGN);
- e1inp_ts_config(&line->ts[2-1], line, E1INP_TS_TYPE_SIGN);
-
- /* create signalling links for TS1 */
- sign_ts = &line->ts[1-1];
- rsl_ts = &line->ts[2-1];
- oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
- bts->c0, 0xff, 0);
- rsl_link = e1inp_sign_link_create(rsl_ts, E1INP_SIGN_RSL,
- bts->c0, 0, 0);
-
- /* create back-links from bts/trx */
- bts->oml_link = oml_link;
- bts->c0->rsl_link = rsl_link;
-
- /* default port at BTS for incoming connections is 3006 */
- if (sin->sin_port == 0)
- sin->sin_port = htons(3006);
-
- return ipaccess_connect(line, sin);
-}