From c4e836838dc7a18971132569c6bb9291aa2c6d65 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 15 Sep 2023 13:28:01 +0200 Subject: [PATCH] Move trx->rsl_link to trx->bb_transc.rsl.link The RSL link is configured/set up by the BBTRANSC NM object, hence move it to the appropiate substruct. Related: OS#5253 Change-Id: I62937cbd81c27274b9f5f70d454d5319a6898c7b --- include/osmo-bts/bts_trx.h | 3 +-- src/common/abis.c | 14 +++++++------- src/common/nm_bb_transc_fsm.c | 2 +- src/common/nm_radio_carrier_fsm.c | 2 +- src/common/rsl.c | 4 ++-- src/common/vty.c | 2 +- src/osmo-bts-trx/trx_vty.c | 2 +- tests/handover/handover_test.c | 26 +++++++++++++------------- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/include/osmo-bts/bts_trx.h b/include/osmo-bts/bts_trx.h index 3ea017e4d..a098c3e5f 100644 --- a/include/osmo-bts/bts_trx.h +++ b/include/osmo-bts/bts_trx.h @@ -9,6 +9,7 @@ struct gsm_bts_bb_trx { struct { struct osmo_sockaddr_str rem_addrstr; uint8_t tei; + struct e1inp_sign_link *link; } rsl; }; @@ -22,8 +23,6 @@ struct gsm_bts_trx { uint8_t nr; /* human readable name / description */ char *description; - /* how do we talk RSL with this TRX? */ - struct e1inp_sign_link *rsl_link; /* NM Radio Carrier and Baseband Transciever */ struct gsm_abis_mo mo; diff --git a/src/common/abis.c b/src/common/abis.c index 9677c1fcd..18e6c6329 100644 --- a/src/common/abis.c +++ b/src/common/abis.c @@ -225,9 +225,9 @@ static void abis_link_connected(struct osmo_fsm_inst *fi, uint32_t event, void * /* Then iterate over the RSL signalling links */ llist_for_each_entry(trx, &bts->trx_list, list) { - if (trx->rsl_link) { - e1inp_sign_link_destroy(trx->rsl_link); - trx->rsl_link = NULL; + if (trx->bb_transc.rsl.link) { + e1inp_sign_link_destroy(trx->bb_transc.rsl.link); + trx->bb_transc.rsl.link = NULL; if (trx == trx->bts->c0) load_timer_stop(trx->bts); } else { @@ -364,7 +364,7 @@ int abis_bts_rsl_sendmsg(struct msgb *msg) /* osmo-bts uses msg->trx internally, but libosmo-abis uses * the signalling link at msg->dst */ - msg->dst = msg->trx->rsl_link; + msg->dst = msg->trx->bb_transc.rsl.link; return abis_sendmsg(msg); } @@ -404,10 +404,10 @@ static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line, break; } e1inp_ts_config_sign(sign_ts, line); - trx->rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, - trx, trx->bb_transc.rsl.tei, 0); + trx->bb_transc.rsl.link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, + trx, trx->bb_transc.rsl.tei, 0); trx_link_estab(trx); - return trx->rsl_link; + return trx->bb_transc.rsl.link; } return NULL; } diff --git a/src/common/nm_bb_transc_fsm.c b/src/common/nm_bb_transc_fsm.c index 1dd2c859b..12493e42a 100644 --- a/src/common/nm_bb_transc_fsm.c +++ b/src/common/nm_bb_transc_fsm.c @@ -173,7 +173,7 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi if (trx->bts->variant != BTS_OSMO_OMLDUMMY) { /* In OMLDUMMY, phy=NULL */ struct phy_instance *pinst = trx_phy_instance(trx); phy_state_connected = phy_link_state_get(pinst->phy_link) == PHY_LINK_CONNECTED; - rsl_link_connected = !!trx->rsl_link; + rsl_link_connected = !!trx->bb_transc.rsl.link; } else { phy_state_connected = true; rsl_link_connected = true; diff --git a/src/common/nm_radio_carrier_fsm.c b/src/common/nm_radio_carrier_fsm.c index 4431eb577..0e37c871e 100644 --- a/src/common/nm_radio_carrier_fsm.c +++ b/src/common/nm_radio_carrier_fsm.c @@ -153,7 +153,7 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi if (trx->bts->variant != BTS_OSMO_OMLDUMMY) { /* In OMLDUMMY, phy=NULL */ struct phy_instance *pinst = trx_phy_instance(trx); phy_state_connected = phy_link_state_get(pinst->phy_link) == PHY_LINK_CONNECTED; - rsl_link_connected = !!trx->rsl_link; + rsl_link_connected = !!trx->bb_transc.rsl.link; } else { phy_state_connected = true; rsl_link_connected = true; diff --git a/src/common/rsl.c b/src/common/rsl.c index 52317655c..f11ec0e09 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -2911,7 +2911,7 @@ static int tx_ipac_XXcx_nack(struct gsm_lchan *lchan, uint8_t cause, static char *get_rsl_local_ip(struct gsm_bts_trx *trx) { - struct e1inp_ts *ts = trx->rsl_link->ts; + struct e1inp_ts *ts = trx->bb_transc.rsl.link->ts; struct sockaddr_storage ss; socklen_t sa_len = sizeof(ss); static char hostbuf[256]; @@ -3054,7 +3054,7 @@ static int rsl_rx_ipac_XXcx(struct msgb *msg) * address */ if (connect_ip == 0) { struct e1inp_sign_link *sign_link = - lchan->ts->trx->rsl_link; + lchan->ts->trx->bb_transc.rsl.link; ia.s_addr = htonl(get_signlink_remote_ip(sign_link)); } else diff --git a/src/common/vty.c b/src/common/vty.c index 47e0ecd2e..f14cc92fc 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -1659,7 +1659,7 @@ static void trx_dump_vty(struct vty *vty, const struct gsm_bts_trx *trx) vty_out(vty, " NM State: "); net_dump_nmstate(vty, &trx->mo.nm_state); - vty_out(vty, " RSL State: %s%s", trx->rsl_link? "connected" : "disconnected", VTY_NEWLINE); + vty_out(vty, " RSL State: %s%s", trx->bb_transc.rsl.link ? "connected" : "disconnected", VTY_NEWLINE); vty_out(vty, " Baseband Transceiver NM State: "); net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state); vty_out(vty, " IPA stream ID: 0x%02x%s", trx->bb_transc.rsl.tei, VTY_NEWLINE); diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c index 9cc980523..998e9cbb9 100644 --- a/src/osmo-bts-trx/trx_vty.c +++ b/src/osmo-bts-trx/trx_vty.c @@ -90,7 +90,7 @@ DEFUN(show_transceiver, show_transceiver_cmd, "show transceiver", vty_out(vty, " bsic : undefined%s", VTY_NEWLINE); /* trx->ts[tn].priv is NULL in absence of the A-bis connection */ - if (trx->rsl_link == NULL) + if (trx->bb_transc.rsl.link == NULL) continue; for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) { diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index 3c4697128..f1235f536 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -99,9 +99,9 @@ int main(int argc, char **argv) OSMO_ASSERT(line); sign_ts = e1inp_line_ipa_rsl_ts(line, 0); e1inp_ts_config_sign(sign_ts, line); - trx->rsl_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, NULL, 0, 0); - OSMO_ASSERT(trx->rsl_link); - trx->rsl_link->trx = trx; + trx->bb_transc.rsl.link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_RSL, NULL, 0, 0); + OSMO_ASSERT(trx->bb_transc.rsl.link); + trx->bb_transc.rsl.link->trx = trx; fprintf(stderr, "test 1: without timeout\n"); @@ -114,9 +114,9 @@ int main(int argc, char **argv) lchan->ho.active = HANDOVER_ENABLED; lchan->ho.ref = 23; l1sap_chan_act(lchan->ts->trx, 0x0a); - OSMO_ASSERT(msgb_dequeue(&trx->rsl_link->tx_list)); - OSMO_ASSERT(msgb_dequeue(&trx->rsl_link->tx_list)); - OSMO_ASSERT(!msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); + OSMO_ASSERT(msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); + OSMO_ASSERT(!msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); /* send access burst with wrong ref */ memset(&nl1sap, 0, sizeof(nl1sap)); @@ -129,7 +129,7 @@ int main(int argc, char **argv) /* expect no action */ OSMO_ASSERT(modify_count == 0); - OSMO_ASSERT(!msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(!msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); /* send access burst with correct ref */ nl1sap.u.rach_ind.ra = 23; @@ -140,10 +140,10 @@ int main(int argc, char **argv) expect_phys_info(&trx->ts[2].lchan[0].lapdm_ch.lapdm_dcch); /* expect exactly one HO.DET */ - OSMO_ASSERT(msg = msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(msg = msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); rslh = msgb_l2(msg); OSMO_ASSERT(rslh->c.msg_type == RSL_MT_HANDO_DET); - OSMO_ASSERT(!msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(!msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); /* expect T3105 running */ OSMO_ASSERT(osmo_timer_pending(&trx->ts[2].lchan[0].ho.t3105)) @@ -171,10 +171,10 @@ int main(int argc, char **argv) expect_phys_info(&trx->ts[2].lchan[0].lapdm_ch.lapdm_dcch); /* expect exactly one HO.DET */ - OSMO_ASSERT(msg = msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(msg = msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); rslh = msgb_l2(msg); OSMO_ASSERT(rslh->c.msg_type == RSL_MT_HANDO_DET); - OSMO_ASSERT(!msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(!msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); for (i = 0; i < bts->ny1 - 1; i++) { /* expect T3105 running */ @@ -196,10 +196,10 @@ int main(int argc, char **argv) OSMO_ASSERT(!osmo_timer_pending(&trx->ts[2].lchan[0].ho.t3105)) /* expect exactly one CONN.FAIL */ - OSMO_ASSERT(msg = msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(msg = msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); rslh = msgb_l2(msg); OSMO_ASSERT(rslh->c.msg_type == RSL_MT_CONN_FAIL); - OSMO_ASSERT(!msgb_dequeue(&trx->rsl_link->tx_list)); + OSMO_ASSERT(!msgb_dequeue(&trx->bb_transc.rsl.link->tx_list)); #if 0 while (!quit) {