aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--openbsc/include/openbsc/e1_input.h2
-rw-r--r--openbsc/src/ipaccess/network_listen.c11
-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
-rw-r--r--openbsc/src/libbsc/abis_nm.c62
-rw-r--r--openbsc/src/libbsc/abis_om2000.c25
-rw-r--r--openbsc/src/libbsc/abis_rsl.c88
-rw-r--r--openbsc/src/libbsc/bsc_api.c2
-rw-r--r--openbsc/src/libbsc/bts_hsl_femtocell.c8
-rw-r--r--openbsc/src/libbsc/bts_ipaccess_nanobts.c3
-rw-r--r--openbsc/src/libbsc/bts_nokia_site.c8
-rw-r--r--openbsc/src/libbsc/gsm_04_08_utils.c2
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c19
-rw-r--r--openbsc/src/utils/rs232.c2
15 files changed, 181 insertions, 132 deletions
diff --git a/openbsc/include/openbsc/e1_input.h b/openbsc/include/openbsc/e1_input.h
index f201c4fb1..4a375ed82 100644
--- a/openbsc/include/openbsc/e1_input.h
+++ b/openbsc/include/openbsc/e1_input.h
@@ -195,4 +195,6 @@ void e1inp_init(void);
int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml);
+int abis_sendmsg(struct msgb *msg);
+
#endif /* _E1_INPUT_H */
diff --git a/openbsc/src/ipaccess/network_listen.c b/openbsc/src/ipaccess/network_listen.c
index a719903dd..71b49eaaf 100644
--- a/openbsc/src/ipaccess/network_listen.c
+++ b/openbsc/src/ipaccess/network_listen.c
@@ -37,6 +37,7 @@
#include <openbsc/abis_nm.h>
#include <openbsc/signal.h>
#include <openbsc/debug.h>
+#include <openbsc/e1_input.h>
#define WHITELIST_MAX_SIZE ((NUM_ARFCNS*2)+2+1)
@@ -129,6 +130,7 @@ static int test_rep(void *_msg)
uint16_t test_rep_len, ferr_list_len;
struct ipacc_ferr_elem *ife;
struct ipac_bcch_info binfo;
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
int i, rc;
DEBUGP(DNM, "TEST REPORT: ");
@@ -168,7 +170,7 @@ static int test_rep(void *_msg)
uint16_t arfcn = cu & 0x3ff;
uint8_t rxlev = cu >> 10;
DEBUGP(DNM, "==> ARFCN %4u, RxLev %2u\n", arfcn, rxlev);
- rxlev_stat_input(&msg->trx->ipaccess.rxlev_stat,
+ rxlev_stat_input(&sign_link->trx->ipaccess.rxlev_stat,
arfcn, rxlev);
}
break;
@@ -219,13 +221,14 @@ static int test_rep(void *_msg)
case NM_IPACC_TESTRES_STOPPED:
case NM_IPACC_TESTRES_TIMEOUT:
case NM_IPACC_TESTRES_NO_CHANS:
- msg->trx->ipaccess.test_state = IPAC_TEST_S_IDLE;
+ sign_link->trx->ipaccess.test_state = IPAC_TEST_S_IDLE;
/* Send signal to notify higher layers of test completion */
DEBUGP(DNM, "dispatching S_IPAC_NWL_COMPLETE signal\n");
- osmo_signal_dispatch(SS_IPAC_NWL, S_IPAC_NWL_COMPLETE, msg->trx);
+ osmo_signal_dispatch(SS_IPAC_NWL, S_IPAC_NWL_COMPLETE,
+ sign_link->trx);
break;
case NM_IPACC_TESTRES_PARTIAL:
- msg->trx->ipaccess.test_state = IPAC_TEST_S_PARTIAL;
+ sign_link->trx->ipaccess.test_state = IPAC_TEST_S_PARTIAL;
break;
}
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;
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index 49e86ba2c..a41414a98 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -43,6 +43,7 @@
#include <openbsc/abis_nm.h>
#include <openbsc/misdn.h>
#include <openbsc/signal.h>
+#include <openbsc/e1_input.h>
#define OM_ALLOC_SIZE 1024
#define OM_HEADROOM_SIZE 128
@@ -116,7 +117,7 @@ static struct msgb *nm_msgb_alloc(void)
/* Send a OML NM Message from BSC to BTS */
static int abis_nm_queue_msg(struct gsm_bts *bts, struct msgb *msg)
{
- msg->trx = bts->c0;
+ msg->dst = bts->oml_link;
/* queue OML messages */
if (llist_empty(&bts->abis_queue) && !bts->abis_nm_pend) {
@@ -186,7 +187,8 @@ static int abis_nm_rx_statechg_rep(struct msgb *mb)
{
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
- struct gsm_bts *bts = mb->trx->bts;
+ struct e1inp_sign_link *sign_link = mb->dst;
+ struct gsm_bts *bts = sign_link->trx->bts;
struct tlv_parsed tp;
struct gsm_nm_state *nm_state, new_state;
@@ -260,13 +262,14 @@ static int rx_fail_evt_rep(struct msgb *mb)
{
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ struct e1inp_sign_link *sign_link = mb->dst;
struct tlv_parsed tp;
const uint8_t *p_val;
char *p_text;
LOGPC(DNM, LOGL_ERROR, "Failure Event Report ");
- abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+ abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE))
LOGPC(DNM, LOGL_ERROR, "Type=%s ",
@@ -391,6 +394,7 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb)
{
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ struct e1inp_sign_link *sign_link = mb->dst;
struct tlv_parsed tp;
const uint8_t *sw_config;
int ret, sw_config_len, sw_descr_len;
@@ -401,13 +405,13 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb)
DEBUGP(DNM, "Software Activate Request, ACKing and Activating\n");
- ret = abis_nm_sw_act_req_ack(mb->trx->bts, foh->obj_class,
+ ret = abis_nm_sw_act_req_ack(sign_link->trx->bts, foh->obj_class,
foh->obj_inst.bts_nr,
foh->obj_inst.trx_nr,
foh->obj_inst.ts_nr, 0,
foh->data, oh->length-sizeof(*foh));
- abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+ abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
sw_config = TLVP_VAL(&tp, NM_ATT_SW_CONFIG);
sw_config_len = TLVP_LEN(&tp, NM_ATT_SW_CONFIG);
if (!TLVP_PRESENT(&tp, NM_ATT_SW_CONFIG)) {
@@ -422,7 +426,7 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb)
if (sw_descr_len < 0)
return -EINVAL;
- return ipacc_sw_activate(mb->trx->bts, foh->obj_class,
+ return ipacc_sw_activate(sign_link->trx->bts, foh->obj_class,
foh->obj_inst.bts_nr,
foh->obj_inst.trx_nr,
foh->obj_inst.ts_nr,
@@ -434,26 +438,28 @@ static int abis_nm_rx_chg_adm_state_ack(struct msgb *mb)
{
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ struct e1inp_sign_link *sign_link = mb->dst;
struct tlv_parsed tp;
uint8_t adm_state;
- abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+ abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
if (!TLVP_PRESENT(&tp, NM_ATT_ADM_STATE))
return -EINVAL;
adm_state = *TLVP_VAL(&tp, NM_ATT_ADM_STATE);
- return update_admstate(mb->trx->bts, foh->obj_class, &foh->obj_inst, adm_state);
+ return update_admstate(sign_link->trx->bts, foh->obj_class, &foh->obj_inst, adm_state);
}
static int abis_nm_rx_lmt_event(struct msgb *mb)
{
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ struct e1inp_sign_link *sign_link = mb->dst;
struct tlv_parsed tp;
DEBUGP(DNM, "LMT Event ");
- abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+ abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
if (TLVP_PRESENT(&tp, NM_ATT_BS11_LMT_LOGON_SESSION) &&
TLVP_LEN(&tp, NM_ATT_BS11_LMT_LOGON_SESSION) >= 1) {
uint8_t onoff = *TLVP_VAL(&tp, NM_ATT_BS11_LMT_LOGON_SESSION);
@@ -496,6 +502,7 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
{
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ struct e1inp_sign_link *sign_link = mb->dst;
uint8_t mt = foh->msg_type;
int ret = 0;
@@ -514,7 +521,7 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
DEBUGPC(DNM, "%s NACK ", abis_nm_nack_name(mt));
- abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+ abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
if (TLVP_PRESENT(&tp, NM_ATT_NACK_CAUSES))
DEBUGPC(DNM, "CAUSE=%s\n",
abis_nm_nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
@@ -524,7 +531,7 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
nack_data.msg = mb;
nack_data.mt = mt;
osmo_signal_dispatch(SS_NM, S_NM_NACK, &nack_data);
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
return 0;
}
#if 0
@@ -565,13 +572,13 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
break;
case NM_MT_SET_BTS_ATTR_ACK:
/* The HSL wants an OPSTART _after_ the SI has been set */
- if (mb->trx->bts->type == GSM_BTS_TYPE_HSL_FEMTO) {
- abis_nm_opstart(mb->trx->bts, NM_OC_BTS, 255, 255, 255);
+ if (sign_link->trx->bts->type == GSM_BTS_TYPE_HSL_FEMTO) {
+ abis_nm_opstart(sign_link->trx->bts, NM_OC_BTS, 255, 255, 255);
}
break;
}
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
return ret;
}
@@ -580,12 +587,13 @@ static int abis_nm_rx_ipacc(struct msgb *mb);
static int abis_nm_rcvmsg_manuf(struct msgb *mb)
{
int rc;
- int bts_type = mb->trx->bts->type;
+ struct e1inp_sign_link *sign_link = mb->dst;
+ int bts_type = sign_link->trx->bts->type;
switch (bts_type) {
case GSM_BTS_TYPE_NANOBTS:
rc = abis_nm_rx_ipacc(mb);
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
default:
LOGP(DNM, LOGL_ERROR, "don't know how to parse OML for this "
@@ -1006,6 +1014,7 @@ static int sw_fill_window(struct abis_nm_sw *sw)
static int abis_nm_rcvmsg_sw(struct msgb *mb)
{
struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ struct e1inp_sign_link *sign_link = mb->dst;
int rc = -1;
struct abis_nm_sw *sw = &g_sw;
enum sw_state old_state = sw->state;
@@ -1023,7 +1032,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
sw->cb_data, NULL);
rc = sw_fill_window(sw);
sw->state = SW_STATE_WAIT_SEGACK;
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
case NM_MT_LOAD_INIT_NACK:
if (sw->forced) {
@@ -1044,7 +1053,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
sw->cb_data, NULL);
sw->state = SW_STATE_ERROR;
}
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
}
break;
@@ -1065,7 +1074,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
sw->state = SW_STATE_WAIT_ENDACK;
rc = sw_load_end(sw);
}
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
case NM_MT_LOAD_ABORT:
if (sw->cbfn)
@@ -1087,7 +1096,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
NM_MT_LOAD_END_ACK, mb,
sw->cb_data, NULL);
rc = 0;
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
case NM_MT_LOAD_END_NACK:
if (sw->forced) {
@@ -1107,7 +1116,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
NM_MT_LOAD_END_NACK, mb,
sw->cb_data, NULL);
}
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
}
case SW_STATE_WAIT_ACTACK:
@@ -1121,7 +1130,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
sw->cbfn(GSM_HOOK_NM_SWLOAD,
NM_MT_ACTIVATE_SW_ACK, mb,
sw->cb_data, NULL);
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
case NM_MT_ACTIVATE_SW_NACK:
DEBUGP(DNM, "Activate Software NACK\n");
@@ -1131,7 +1140,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb)
sw->cbfn(GSM_HOOK_NM_SWLOAD,
NM_MT_ACTIVATE_SW_NACK, mb,
sw->cb_data, NULL);
- abis_nm_queue_send_next(mb->trx->bts);
+ abis_nm_queue_send_next(sign_link->trx->bts);
break;
}
case SW_STATE_NONE:
@@ -2281,6 +2290,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
uint8_t idstrlen = oh->data[0];
struct tlv_parsed tp;
struct ipacc_ack_signal_data signal;
+ struct e1inp_sign_link *sign_link = msg->dst;
if (strncmp((char *)&oh->data[1], ipaccess_magic, idstrlen)) {
LOGP(DNM, LOGL_ERROR, "id string is not com.ipaccess !?!\n");
@@ -2288,7 +2298,7 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
}
foh = (struct abis_om_fom_hdr *) (oh->data + 1 + idstrlen);
- abis_nm_tlv_parse(&tp, msg->trx->bts, foh->data, oh->length-sizeof(*foh));
+ abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
abis_nm_debugp_foh(DNM, foh);
@@ -2365,12 +2375,12 @@ static int abis_nm_rx_ipacc(struct msgb *msg)
case NM_MT_IPACC_RSL_CONNECT_NACK:
case NM_MT_IPACC_SET_NVATTR_NACK:
case NM_MT_IPACC_GET_NVATTR_NACK:
- signal.trx = gsm_bts_trx_by_nr(msg->trx->bts, foh->obj_inst.trx_nr);
+ signal.trx = gsm_bts_trx_by_nr(sign_link->trx->bts, foh->obj_inst.trx_nr);
signal.msg_type = foh->msg_type;
osmo_signal_dispatch(SS_NM, S_NM_IPACC_NACK, &signal);
break;
case NM_MT_IPACC_SET_NVATTR_ACK:
- signal.trx = gsm_bts_trx_by_nr(msg->trx->bts, foh->obj_inst.trx_nr);
+ signal.trx = gsm_bts_trx_by_nr(sign_link->trx->bts, foh->obj_inst.trx_nr);
signal.msg_type = foh->msg_type;
osmo_signal_dispatch(SS_NM, S_NM_IPACC_ACK, &signal);
break;
diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c
index b636e7375..a4a3f23bf 100644
--- a/openbsc/src/libbsc/abis_om2000.c
+++ b/openbsc/src/libbsc/abis_om2000.c
@@ -799,6 +799,7 @@ static void signal_op_state(struct gsm_bts *bts, struct abis_om2k_mo *mo)
static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg;
struct abis_om2k_hdr *o2h;
int to_trx_oml;
@@ -814,8 +815,8 @@ static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
case OM2K_MO_CLS_RX:
/* Route through per-TRX OML Link to the appropriate TRX */
to_trx_oml = 1;
- msg->trx = gsm_bts_trx_by_nr(bts, o2h->mo.inst);
- if (!msg->trx) {
+ sign_link->trx = gsm_bts_trx_by_nr(bts, o2h->mo.inst);
+ if (!sign_link->trx) {
LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to "
"non-existing TRX\n", om2k_mo_name(&o2h->mo));
return -ENODEV;
@@ -824,8 +825,8 @@ static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
case OM2K_MO_CLS_TS:
/* Route through per-TRX OML Link to the appropriate TRX */
to_trx_oml = 1;
- msg->trx = gsm_bts_trx_by_nr(bts, o2h->mo.assoc_so);
- if (!msg->trx) {
+ sign_link->trx = gsm_bts_trx_by_nr(bts, o2h->mo.assoc_so);
+ if (!sign_link->trx) {
LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to "
"non-existing TRX\n", om2k_mo_name(&o2h->mo));
return -ENODEV;
@@ -833,7 +834,7 @@ static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
break;
default:
/* Route through the IXU/DXU OML Link */
- msg->trx = bts->c0;
+ sign_link->trx = bts->c0;
to_trx_oml = 0;
break;
}
@@ -1263,6 +1264,7 @@ struct iwd_type {
static int om2k_rx_negot_req(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
struct abis_om2k_hdr *o2h = msgb_l2(msg);
struct iwd_type iwd_types[16];
uint8_t num_iwd_types = o2h->data[2];
@@ -1316,29 +1318,31 @@ static int om2k_rx_negot_req(struct msgb *msg)
out_buf[0] = out_num_types;
- return abis_om2k_tx_negot_req_ack(msg->trx->bts, &o2h->mo, out_buf, out_cur - out_buf);
+ return abis_om2k_tx_negot_req_ack(sign_link->trx->bts, &o2h->mo, out_buf, out_cur - out_buf);
}
static int om2k_rx_start_res(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
struct abis_om2k_hdr *o2h = msgb_l2(msg);
int rc;
- rc = abis_om2k_tx_simple(msg->trx->bts, &o2h->mo, OM2K_MSGT_START_RES_ACK);
- rc = abis_om2k_tx_op_info(msg->trx->bts, &o2h->mo, 1);
+ rc = abis_om2k_tx_simple(sign_link->trx->bts, &o2h->mo, OM2K_MSGT_START_RES_ACK);
+ rc = abis_om2k_tx_op_info(sign_link->trx->bts, &o2h->mo, 1);
return rc;
}
static int om2k_rx_op_info_ack(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
struct abis_om2k_hdr *o2h = msgb_l2(msg);
/* This Acknowledgement does not contain the actual operational state,
* so we signal whatever state we saved when we sent the Op Info
* request */
- signal_op_state(msg->trx->bts, &o2h->mo);
+ signal_op_state(sign_link->trx->bts, &o2h->mo);
return 0;
}
@@ -1463,7 +1467,8 @@ static int process_mo_state(struct gsm_bts *bts, struct msgb *msg)
int abis_om2k_rcvmsg(struct msgb *msg)
{
- struct gsm_bts *bts = msg->trx->bts;
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
+ struct gsm_bts *bts = sign_link->trx->bts;
struct abis_om2k_hdr *o2h = msgb_l2(msg);
struct abis_om_hdr *oh = &o2h->om;
uint16_t msg_type = ntohs(o2h->msg_type);
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index cb2c9bcc5..86452686d 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -38,8 +38,8 @@
#include <openbsc/signal.h>
#include <openbsc/meas_rep.h>
#include <openbsc/rtp_proxy.h>
+#include <openbsc/e1_input.h>
#include <osmocom/gsm/rsl.h>
-
#include <osmocom/core/talloc.h>
#define RSL_ALLOC_SIZE 1024
@@ -215,7 +215,7 @@ int rsl_bcch_info(struct gsm_bts_trx *trx, uint8_t type,
msgb_tv_put(msg, RSL_IE_SYSINFO_TYPE, type);
msgb_tlv_put(msg, RSL_IE_FULL_BCCH_INFO, len, data);
- msg->trx = trx;
+ msg->dst = trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -233,7 +233,7 @@ int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type,
msgb_tv_put(msg, RSL_IE_SYSINFO_TYPE, type);
msgb_tl16v_put(msg, RSL_IE_L3_INFO, len, data);
- msg->trx = trx;
+ msg->dst = trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -252,7 +252,7 @@ int rsl_sacch_info_modify(struct gsm_lchan *lchan, uint8_t type,
msgb_tv_put(msg, RSL_IE_SYSINFO_TYPE, type);
msgb_tl16v_put(msg, RSL_IE_L3_INFO, len, data);
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -279,7 +279,7 @@ int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db)
msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power);
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -308,7 +308,7 @@ int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm)
msgb_tv_put(msg, RSL_IE_MS_POWER, lchan->ms_power);
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -407,7 +407,7 @@ int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr,
msgb_tv_put(msg, RSL_IE_MS_POWER, ms_power);
msgb_tv_put(msg, RSL_IE_TIMING_ADVANCE, ta);
- msg->trx = trx;
+ msg->dst = trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -486,7 +486,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type,
msgb_tlv_put(msg, RSL_IE_MR_CONFIG, sizeof(lchan->mr_conf),
(uint8_t *) &lchan->mr_conf);
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -525,7 +525,7 @@ int rsl_chan_mode_modify_req(struct gsm_lchan *lchan)
(uint8_t *) &lchan->mr_conf);
}
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -557,7 +557,7 @@ int rsl_encryption_cmd(struct msgb *msg)
init_dchan_hdr(dh, RSL_MT_ENCR_CMD);
dh->chan_nr = chan_nr;
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -573,7 +573,7 @@ int rsl_deact_sacch(struct gsm_lchan *lchan)
dh->chan_nr = gsm_lchan2chan_nr(lchan);
msg->lchan = lchan;
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
DEBUGP(DRSL, "%s DEACTivate SACCH CMD\n", gsm_lchan_name(lchan));
@@ -615,7 +615,7 @@ static int rsl_rf_chan_release(struct gsm_lchan *lchan, int error)
dh->chan_nr = gsm_lchan2chan_nr(lchan);
msg->lchan = lchan;
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
DEBUGP(DRSL, "%s RF Channel Release CMD due error %d\n", gsm_lchan_name(lchan), error);
@@ -625,11 +625,13 @@ static int rsl_rf_chan_release(struct gsm_lchan *lchan, int error)
* be a problem when we have reassigned the channel to someone else and then can
* not figure out who used this channel.
*/
+ struct e1inp_sign_link *sign_link = msg->dst;
+
rsl_lchan_set_state(lchan, LCHAN_S_REL_ERR);
lchan->error_timer.data = lchan;
lchan->error_timer.cb = error_timeout_cb;
osmo_timer_schedule(&lchan->error_timer,
- msg->trx->bts->network->T3111 + 2, 0);
+ sign_link->trx->bts->network->T3111 + 2, 0);
}
/* Start another timer or assume the BTS sends a ACK/NACK? */
@@ -683,7 +685,7 @@ int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len,
msgb_tlv_put(msg, RSL_IE_MS_IDENTITY, len-2, ms_ident+2);
msgb_tv_put(msg, RSL_IE_CHAN_NEEDED, chan_needed);
- msg->trx = bts->c0;
+ msg->dst = bts->c0->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -727,7 +729,7 @@ int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val)
break;
}
- msg->trx = bts->c0;
+ msg->dst = bts->c0->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -747,7 +749,7 @@ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci)
DEBUGP(DRSL, "%s TX Siemens MRPCI 0x%02x\n",
gsm_lchan_name(lchan), *(uint8_t *)mrpci);
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -765,7 +767,7 @@ int rsl_data_request(struct msgb *msg, uint8_t link_id)
rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, gsm_lchan2chan_nr(msg->lchan),
link_id, 1);
- msg->trx = msg->lchan->ts->trx;
+ msg->dst = msg->lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -778,7 +780,7 @@ int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id)
msg = rsl_rll_simple(RSL_MT_EST_REQ, gsm_lchan2chan_nr(lchan),
link_id, 0);
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -800,7 +802,7 @@ int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id, uint8_t reason
/* FIXME: start some timer in case we don't receive a REL ACK ? */
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -998,9 +1000,11 @@ static int rsl_rx_meas_res(struct msgb *msg)
*TLVP_VAL(&tp, RSL_IE_MS_TIMING_OFFSET);
if (TLVP_PRESENT(&tp, RSL_IE_L1_INFO)) {
+ struct e1inp_sign_link *sign_link = msg->dst;
+
val = TLVP_VAL(&tp, RSL_IE_L1_INFO);
mr->flags |= MEAS_REP_F_MS_L1;
- mr->ms_l1.pwr = ms_pwr_dbm(msg->trx->bts->band, val[0] >> 3);
+ mr->ms_l1.pwr = ms_pwr_dbm(sign_link->trx->bts->band, val[0] >> 3);
if (val[0] & 0x04)
mr->flags |= MEAS_REP_F_FPC;
mr->ms_l1.ta = val[1];
@@ -1045,8 +1049,9 @@ static int abis_rsl_rx_dchan(struct msgb *msg)
struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
int rc = 0;
char *ts_name;
+ struct e1inp_sign_link *sign_link = msg->dst;
- msg->lchan = lchan_lookup(msg->trx, rslh->chan_nr);
+ msg->lchan = lchan_lookup(sign_link->trx, rslh->chan_nr);
ts_name = gsm_lchan_name(msg->lchan);
switch (rslh->c.msg_type) {
@@ -1113,8 +1118,9 @@ static int rsl_rx_error_rep(struct msgb *msg)
{
struct abis_rsl_common_hdr *rslh = msgb_l2(msg);
struct tlv_parsed tp;
+ struct e1inp_sign_link *sign_link = msg->dst;
- LOGP(DRSL, LOGL_ERROR, "%s ERROR REPORT ", gsm_trx_name(msg->trx));
+ LOGP(DRSL, LOGL_ERROR, "%s ERROR REPORT ", gsm_trx_name(sign_link->trx));
rsl_tlv_parse(&tp, rslh->data, msgb_l2len(msg)-sizeof(*rslh));
@@ -1130,6 +1136,7 @@ static int rsl_rx_error_rep(struct msgb *msg)
static int abis_rsl_rx_trx(struct msgb *msg)
{
struct abis_rsl_common_hdr *rslh = msgb_l2(msg);
+ struct e1inp_sign_link *sign_link = msg->dst;
int rc = 0;
switch (rslh->msg_type) {
@@ -1138,12 +1145,12 @@ static int abis_rsl_rx_trx(struct msgb *msg)
break;
case RSL_MT_RF_RES_IND:
/* interference on idle channels of TRX */
- //DEBUGP(DRSL, "%s RF Resource Indication\n", gsm_trx_name(msg->trx));
+ //DEBUGP(DRSL, "%s RF Resource Indication\n", gsm_trx_name(sign_link->trx));
break;
case RSL_MT_OVERLOAD:
/* indicate CCCH / ACCH / processor overload */
LOGP(DRSL, LOGL_ERROR, "%s CCCH/ACCH/CPU Overload\n",
- gsm_trx_name(msg->trx));
+ gsm_trx_name(sign_link->trx));
break;
case 0x42: /* Nokia specific: SI End ACK */
LOGP(DRSL, LOGL_INFO, "Nokia SI End ACK\n");
@@ -1153,7 +1160,7 @@ static int abis_rsl_rx_trx(struct msgb *msg)
break;
default:
LOGP(DRSL, LOGL_NOTICE, "%s Unknown Abis RSL TRX message "
- "type 0x%02x\n", gsm_trx_name(msg->trx), rslh->msg_type);
+ "type 0x%02x\n", gsm_trx_name(sign_link->trx), rslh->msg_type);
return -EINVAL;
}
return rc;
@@ -1219,7 +1226,8 @@ static int rsl_send_imm_ass_rej(struct gsm_bts *bts,
/* MS has requested a channel on the RACH */
static int rsl_rx_chan_rqd(struct msgb *msg)
{
- struct gsm_bts *bts = msg->trx->bts;
+ struct e1inp_sign_link *sign_link = msg->dst;
+ struct gsm_bts *bts = sign_link->trx->bts;
struct abis_rsl_dchan_hdr *rqd_hdr = msgb_l2(msg);
struct gsm48_req_ref *rqd_ref;
enum gsm_chan_t lctype;
@@ -1346,6 +1354,7 @@ static int rsl_send_imm_assignment(struct gsm_lchan *lchan)
/* MS has requested a channel on the RACH */
static int rsl_rx_ccch_load(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = msg->dst;
struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
uint16_t pg_buf_space;
uint16_t rach_slot_count = -1;
@@ -1355,11 +1364,11 @@ static int rsl_rx_ccch_load(struct msgb *msg)
switch (rslh->data[0]) {
case RSL_IE_PAGING_LOAD:
pg_buf_space = rslh->data[1] << 8 | rslh->data[2];
- if (is_ipaccess_bts(msg->trx->bts) && pg_buf_space == 0xffff) {
+ if (is_ipaccess_bts(sign_link->trx->bts) && pg_buf_space == 0xffff) {
/* paging load below configured threshold, use 50 as default */
pg_buf_space = 50;
}
- paging_update_buffer_space(msg->trx->bts, pg_buf_space);
+ paging_update_buffer_space(sign_link->trx->bts, pg_buf_space);
break;
case RSL_IE_RACH_LOAD:
if (msg->data_len >= 7) {
@@ -1377,10 +1386,11 @@ static int rsl_rx_ccch_load(struct msgb *msg)
static int abis_rsl_rx_cchan(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = msg->dst;
struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
int rc = 0;
- msg->lchan = lchan_lookup(msg->trx, rslh->chan_nr);
+ msg->lchan = lchan_lookup(sign_link->trx, rslh->chan_nr);
switch (rslh->c.msg_type) {
case RSL_MT_CHAN_RQD:
@@ -1460,12 +1470,13 @@ static void rsl_handle_release(struct gsm_lchan *lchan)
static int abis_rsl_rx_rll(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = msg->dst;
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
int rc = 0;
char *ts_name;
uint8_t sapi = rllh->link_id & 7;
- msg->lchan = lchan_lookup(msg->trx, rllh->chan_nr);
+ msg->lchan = lchan_lookup(sign_link->trx, rllh->chan_nr);
ts_name = gsm_lchan_name(msg->lchan);
DEBUGP(DRLL, "%s SAPI=%u ", ts_name, sapi);
@@ -1683,7 +1694,7 @@ int rsl_ipacc_crcx(struct gsm_lchan *lchan)
gsm_lchan_name(lchan), lchan->abis_ip.speech_mode,
lchan->abis_ip.rtp_payload);
- msg->trx = lchan->ts->trx;
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -1725,8 +1736,8 @@ int rsl_ipacc_mdcx(struct gsm_lchan *lchan, uint32_t ip, uint16_t port,
msgb_tv_put(msg, RSL_IE_IPAC_RTP_PAYLOAD, lchan->abis_ip.rtp_payload);
if (rtp_payload2)
msgb_tv_put(msg, RSL_IE_IPAC_RTP_PAYLOAD2, rtp_payload2);
-
- msg->trx = lchan->ts->trx;
+
+ msg->dst = lchan->ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -1764,7 +1775,7 @@ int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act)
DEBUGP(DRSL, "%s IPAC_PDCH_%sACT\n", gsm_ts_name(ts),
act ? "" : "DE");
- msg->trx = ts->trx;
+ msg->dst = ts->trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -1829,11 +1840,12 @@ static int abis_rsl_rx_ipacc_dlcx_ind(struct msgb *msg)
static int abis_rsl_rx_ipacc(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = msg->dst;
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
char *ts_name;
int rc = 0;
- msg->lchan = lchan_lookup(msg->trx, rllh->chan_nr);
+ msg->lchan = lchan_lookup(sign_link->trx, rllh->chan_nr);
ts_name = gsm_lchan_name(msg->lchan);
switch (rllh->c.msg_type) {
@@ -1949,7 +1961,7 @@ int rsl_nokia_si_begin(struct gsm_bts_trx *trx)
ch->msg_discr = ABIS_RSL_MDISC_TRX;
ch->msg_type = 0x40; /* Nokia SI Begin */
- msg->trx = trx;
+ msg->dst = trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -1965,7 +1977,7 @@ int rsl_nokia_si_end(struct gsm_bts_trx *trx)
msgb_tv_put(msg, 0xFD, 0x00); /* Nokia Pagemode Info, No paging reorganisation required */
- msg->trx = trx;
+ msg->dst = trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
@@ -1982,7 +1994,7 @@ int rsl_bs_power_control(struct gsm_bts_trx *trx, uint8_t channel, uint8_t reduc
msgb_tv_put(msg, RSL_IE_CHAN_NR, channel);
msgb_tv_put(msg, RSL_IE_BS_POWER, reduction); /* reduction in 2dB steps */
- msg->trx = trx;
+ msg->dst = trx->rsl_link;
return abis_rsl_sendmsg(msg);
}
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index 78fee8894..756337852 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -277,7 +277,7 @@ int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
sapi = link_id & 0x7;
msg->lchan = conn->lchan;
- msg->trx = msg->lchan->ts->trx;
+ msg->dst = msg->lchan->ts->trx->rsl_link;
/* If we are on a TCH and need to submit a SMS (on SAPI=3) we need to use the SACH */
if (allow_sach && sapi != 0) {
diff --git a/openbsc/src/libbsc/bts_hsl_femtocell.c b/openbsc/src/libbsc/bts_hsl_femtocell.c
index f94369356..8463202a3 100644
--- a/openbsc/src/libbsc/bts_hsl_femtocell.c
+++ b/openbsc/src/libbsc/bts_hsl_femtocell.c
@@ -98,20 +98,20 @@ static int hslfemto_bootstrap_om(struct gsm_bts *bts)
msg = hsl_alloc_msgb();
cur = msgb_put(msg, sizeof(l1_msg));
memcpy(msg->data, l1_msg, sizeof(l1_msg));
- msg->trx = bts->c0;
+ msg->dst = bts->c0->rsl_link;
abis_rsl_sendmsg(msg);
#if 1
msg = hsl_alloc_msgb();
cur = msgb_put(msg, sizeof(conn_trau_msg));
memcpy(msg->data, conn_trau_msg, sizeof(conn_trau_msg));
- msg->trx = bts->c0;
+ msg->dst = bts->c0->rsl_link;
abis_rsl_sendmsg(msg);
#endif
msg = hsl_alloc_msgb();
cur = msgb_put(msg, sizeof(conn_trau_msg2));
memcpy(msg->data, conn_trau_msg2, sizeof(conn_trau_msg2));
- msg->trx = bts->c0;
+ msg->dst = bts->c0->rsl_link;
abis_rsl_sendmsg(msg);
*((uint16_t *)oml_arfcn_bsic+10) = htons(bts->c0->arfcn);
@@ -120,7 +120,7 @@ static int hslfemto_bootstrap_om(struct gsm_bts *bts)
msg = hsl_alloc_msgb();
cur = msgb_put(msg, sizeof(oml_arfcn_bsic));
memcpy(msg->data, oml_arfcn_bsic, sizeof(oml_arfcn_bsic));
- msg->trx = bts->c0;
+ msg->dst = bts->c0->rsl_link;
_abis_nm_sendmsg(msg, 0);
/* Delay the OPSTART until after SI have been set via RSL */
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
index e756f2a88..c86b1e1b0 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -373,7 +373,8 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
static int sw_activ_rep(struct msgb *mb)
{
struct abis_om_fom_hdr *foh = msgb_l3(mb);
- struct gsm_bts *bts = mb->trx->bts;
+ struct e1inp_sign_link *sign_link = mb->dst;
+ struct gsm_bts *bts = sign_link->trx->bts;
struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
if (!trx)
diff --git a/openbsc/src/libbsc/bts_nokia_site.c b/openbsc/src/libbsc/bts_nokia_site.c
index b5bc2fec0..8ba01d057 100644
--- a/openbsc/src/libbsc/bts_nokia_site.c
+++ b/openbsc/src/libbsc/bts_nokia_site.c
@@ -1474,7 +1474,8 @@ static void reset_timer_cb(void *_bts)
static int abis_nm_rcvmsg_fom(struct msgb *mb)
{
- struct gsm_bts *bts = mb->trx->bts;
+ struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)mb->dst;
+ struct gsm_bts *bts = sign_link->trx->bts;
struct abis_om_hdr *oh = msgb_l2(mb);
struct abis_om_nokia_hdr *noh = msgb_l3(mb);
uint8_t mt = noh->msg_type;
@@ -1579,7 +1580,8 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
if (bts->nokia.configured != 0) {
/* start TRX (RSL link) */
- struct gsm_e1_subslot *e1_link = &mb->trx->rsl_e1_link;
+ struct gsm_e1_subslot *e1_link =
+ &sign_link->trx->rsl_e1_link;
struct e1inp_line *line;
bts->nokia.configured = 0;
@@ -1590,7 +1592,7 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
LOGP(DINP, LOGL_ERROR,
"TRX (%u/%u) RSL link referring "
"to non-existing E1 line %u\n",
- mb->trx->bts->nr, mb->trx->nr,
+ sign_link->trx->bts->nr, sign_link->trx->nr,
e1_link->e1_nr);
return -ENOMEM;
}
diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c
index 92335f24c..968e62ec6 100644
--- a/openbsc/src/libbsc/gsm_04_08_utils.c
+++ b/openbsc/src/libbsc/gsm_04_08_utils.c
@@ -44,7 +44,7 @@ int ipacc_rtp_direct = 1;
static int gsm48_sendmsg(struct msgb *msg)
{
if (msg->lchan)
- msg->trx = msg->lchan->ts->trx;
+ msg->dst = msg->lchan->ts->trx->rsl_link;
msg->l3h = msg->data;
return rsl_data_request(msg, 0);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index bd452ed99..59baa5a2a 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -49,6 +49,7 @@
#include <openbsc/silent_call.h>
#include <openbsc/bsc_api.h>
#include <openbsc/osmo_msc.h>
+#include <openbsc/e1_input.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/gsm/gsm48.h>
@@ -94,17 +95,22 @@ static int gsm48_conn_sendmsg(struct msgb *msg, struct gsm_subscriber_connection
if (msg->lchan) {
- msg->trx = msg->lchan->ts->trx;
+ struct e1inp_sign_link *sign_link =
+ msg->lchan->ts->trx->rsl_link;
+
+ msg->dst = sign_link;
if ((gh->proto_discr & GSM48_PDISC_MASK) == GSM48_PDISC_CC)
DEBUGP(DCC, "(bts %d trx %d ts %d ti %02x) "
- "Sending '%s' to MS.\n", msg->trx->bts->nr,
- msg->trx->nr, msg->lchan->ts->nr,
+ "Sending '%s' to MS.\n",
+ sign_link->trx->bts->nr,
+ sign_link->trx->nr, msg->lchan->ts->nr,
gh->proto_discr & 0xf0,
gsm48_cc_msg_name(gh->msg_type));
else
DEBUGP(DCC, "(bts %d trx %d ts %d pd %02x) "
- "Sending 0x%02x to MS.\n", msg->trx->bts->nr,
- msg->trx->nr, msg->lchan->ts->nr,
+ "Sending 0x%02x to MS.\n",
+ sign_link->trx->bts->nr,
+ sign_link->trx->nr, msg->lchan->ts->nr,
gh->proto_discr, gh->msg_type);
}
@@ -874,6 +880,7 @@ static int gsm48_rx_mm_serv_req(struct gsm_subscriber_connection *conn, struct m
static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg)
{
+ struct e1inp_sign_link *sign_link = msg->lchan->ts->trx->rsl_link;
struct gsm_bts *bts = msg->lchan->ts->trx->bts;
struct gsm48_hdr *gh = msgb_l3(msg);
struct gsm48_imsi_detach_ind *idi =
@@ -907,7 +914,7 @@ static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg)
}
if (subscr) {
- subscr_update(subscr, msg->trx->bts,
+ subscr_update(subscr, sign_link->trx->bts,
GSM_SUBSCRIBER_UPDATE_DETACHED);
DEBUGP(DMM, "Subscriber: %s\n", subscr_name(subscr));
diff --git a/openbsc/src/utils/rs232.c b/openbsc/src/utils/rs232.c
index 4e35cb06a..01b8c7e33 100644
--- a/openbsc/src/utils/rs232.c
+++ b/openbsc/src/utils/rs232.c
@@ -128,7 +128,7 @@ static int handle_ser_read(struct osmo_fd *bfd)
if (!sh->rx_msg) {
sh->rx_msg = msgb_alloc(SERIAL_ALLOC_SIZE, "RS232 Rx");
sh->rx_msg->l2h = NULL;
- sh->rx_msg->trx = sh->bts->c0;
+ sh->rx_msg->dst = sh->bts->c0->rsl_link;
}
msg = sh->rx_msg;