summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libabis
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-08-17 22:43:54 +0200
committerHarald Welte <laforge@gnumonks.org>2011-08-19 22:38:33 +0200
commit7abecfcfc9ef94c1367cd88ac858b79d20f75db0 (patch)
treeb9df6f561a169ec9ca174217ac6b0a7eafda0686 /openbsc/src/libabis
parentc45a8045a645d64782ab2afbce79732d3f9d12a1 (diff)
src: use new msg->dst pointer instead of deprecated msg->trx
This patch modifies openBSC code to use msg->dst which stores the pointer to the signalling link structure instead of the pointer to the transceiver structure. This patch prepares the introduction of libosmo-abis.
Diffstat (limited to 'openbsc/src/libabis')
-rw-r--r--openbsc/src/libabis/e1_input.c61
-rw-r--r--openbsc/src/libabis/input/hsl.c10
-rw-r--r--openbsc/src/libabis/input/ipaccess.c10
3 files changed, 44 insertions, 37 deletions
diff --git a/openbsc/src/libabis/e1_input.c b/openbsc/src/libabis/e1_input.c
index a6661b785..eab418a24 100644
--- a/openbsc/src/libabis/e1_input.c
+++ b/openbsc/src/libabis/e1_input.c
@@ -246,27 +246,21 @@ static int subch_cb(struct subch_demux *dmx, int ch, uint8_t *data, int len,
return trau_mux_input(&src_ss, data, len);
}
-int abis_rsl_sendmsg(struct msgb *msg)
+int abis_sendmsg(struct msgb *msg)
{
- struct e1inp_sign_link *sign_link;
+ struct e1inp_sign_link *sign_link = msg->dst;
struct e1inp_driver *e1inp_driver;
struct e1inp_ts *e1i_ts;
msg->l2h = msg->data;
- if (!msg->trx) {
- LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->trx == NULL: %s\n",
+ /* don't know how to route this message. */
+ if (sign_link == NULL) {
+ LOGP(DLINP, LOGL_ERROR, "abis_sendmsg: msg->dst == NULL: %s\n",
osmo_hexdump(msg->data, msg->len));
talloc_free(msg);
return -EINVAL;
- } else if (!msg->trx->rsl_link) {
- LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->trx->rsl_link == NULL: %s\n",
- osmo_hexdump(msg->data, msg->len));
- talloc_free(msg);
- return -EIO;
}
-
- sign_link = msg->trx->rsl_link;
e1i_ts = sign_link->ts;
if (!osmo_timer_pending(&e1i_ts->sign.tx_timer)) {
/* notify the driver we have something to write */
@@ -281,27 +275,20 @@ int abis_rsl_sendmsg(struct msgb *msg)
return 0;
}
-int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml)
+int abis_rsl_sendmsg(struct msgb *msg)
{
- struct e1inp_sign_link *sign_link;
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
struct e1inp_driver *e1inp_driver;
struct e1inp_ts *e1i_ts;
msg->l2h = msg->data;
- if (!msg->trx || !msg->trx->bts || !msg->trx->bts->oml_link) {
- LOGP(DNM, LOGL_ERROR, "nm_sendmsg: msg->trx == NULL\n");
+ if (!sign_link) {
+ LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->dst == NULL: %s\n",
+ osmo_hexdump(msg->data, msg->len));
+ talloc_free(msg);
return -EINVAL;
}
-
- /* Check for TRX-specific OML link first */
- if (to_trx_oml) {
- if (!msg->trx->oml_link)
- return -ENODEV;
- sign_link = msg->trx->oml_link;
- } else
- sign_link = msg->trx->bts->oml_link;
-
e1i_ts = sign_link->ts;
if (!osmo_timer_pending(&e1i_ts->sign.tx_timer)) {
/* notify the driver we have something to write */
@@ -316,6 +303,26 @@ int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml)
return 0;
}
+int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml)
+{
+ struct e1inp_sign_link *sign_link = msg->dst;
+
+ msg->l2h = msg->data;
+
+ if (!msg->dst) {
+ LOGP(DNM, LOGL_ERROR, "_abis_nm_sendmsg: msg->dst == NULL\n");
+ return -EINVAL;
+ }
+
+ /* Check for TRX-specific OML link first */
+ if (to_trx_oml) {
+ if (!sign_link->trx->oml_link)
+ return -ENODEV;
+ msg->dst = sign_link->trx->oml_link;
+ }
+ return abis_sendmsg(msg);
+}
+
/* Timeslot */
/* configure and initialize one e1inp_ts */
@@ -527,12 +534,12 @@ int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
log_set_context(BSC_CTX_BTS, link->trx->bts);
switch (link->type) {
case E1INP_SIGN_OML:
- msg->trx = link->trx;
- bts = msg->trx->bts;
+ msg->dst = link;
+ bts = link->trx->bts;
ret = bts->model->oml_rcvmsg(msg);
break;
case E1INP_SIGN_RSL:
- msg->trx = link->trx;
+ msg->dst = link;
ret = abis_rsl_rcvmsg(msg);
break;
default:
diff --git a/openbsc/src/libabis/input/hsl.c b/openbsc/src/libabis/input/hsl.c
index c98a22cb4..7f2e75d62 100644
--- a/openbsc/src/libabis/input/hsl.c
+++ b/openbsc/src/libabis/input/hsl.c
@@ -250,20 +250,20 @@ static int handle_ts1_read(struct osmo_fd *bfd)
msgb_free(msg);
return -EIO;
}
- msg->trx = link->trx;
+ msg->dst = link;
switch (link->type) {
case E1INP_SIGN_RSL:
- if (!(msg->trx->bts->ip_access.flags & (RSL_UP << msg->trx->nr))) {
+ if (!(link->trx->bts->ip_access.flags & (RSL_UP << link->trx->nr))) {
e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
- msg->trx->bts->ip_access.flags |= (RSL_UP << msg->trx->nr);
+ link->trx->bts->ip_access.flags |= (RSL_UP << link->trx->nr);
}
ret = abis_rsl_rcvmsg(msg);
break;
case E1INP_SIGN_OML:
- if (!(msg->trx->bts->ip_access.flags & OML_UP)) {
+ if (!(link->trx->bts->ip_access.flags & OML_UP)) {
e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
- msg->trx->bts->ip_access.flags |= OML_UP;
+ link->trx->bts->ip_access.flags |= OML_UP;
}
ret = abis_nm_rcvmsg(msg);
break;
diff --git a/openbsc/src/libabis/input/ipaccess.c b/openbsc/src/libabis/input/ipaccess.c
index cc2a7a055..2d6764e25 100644
--- a/openbsc/src/libabis/input/ipaccess.c
+++ b/openbsc/src/libabis/input/ipaccess.c
@@ -532,20 +532,20 @@ static int handle_ts1_read(struct osmo_fd *bfd)
msgb_free(msg);
return -EIO;
}
- msg->trx = link->trx;
+ msg->dst = link;
switch (link->type) {
case E1INP_SIGN_RSL:
- if (!(msg->trx->bts->ip_access.flags & (RSL_UP << msg->trx->nr))) {
+ if (!(link->trx->bts->ip_access.flags & (RSL_UP << link->trx->nr))) {
e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
- msg->trx->bts->ip_access.flags |= (RSL_UP << msg->trx->nr);
+ link->trx->bts->ip_access.flags |= (RSL_UP << link->trx->nr);
}
ret = abis_rsl_rcvmsg(msg);
break;
case E1INP_SIGN_OML:
- if (!(msg->trx->bts->ip_access.flags & OML_UP)) {
+ if (!(link->trx->bts->ip_access.flags & OML_UP)) {
e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
- msg->trx->bts->ip_access.flags |= OML_UP;
+ link->trx->bts->ip_access.flags |= OML_UP;
}
ret = abis_nm_rcvmsg(msg);
break;