aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/manuals/chapters/architecture.adoc1
-rw-r--r--include/osmo-bts/phy_link.h1
-rw-r--r--src/osmo-bts-trx/trx_if.c17
-rw-r--r--src/osmo-bts-trx/trx_provision_fsm.c7
4 files changed, 22 insertions, 4 deletions
diff --git a/doc/manuals/chapters/architecture.adoc b/doc/manuals/chapters/architecture.adoc
index a0e66cd0..30eab7a4 100644
--- a/doc/manuals/chapters/architecture.adoc
+++ b/doc/manuals/chapters/architecture.adoc
@@ -88,6 +88,7 @@ order to specify which PHY instance is allocated to this specific TRX.
| common | abis_open() | Start of the A-bis connection to BSC
| common | phy_links_open() | Iterate over list of configured PHY links
| bts-specific | bts_model_phy_link_open() | Open each of the configured PHY links
+| bts-specific | bts_model_phy_link_close() | Close each of the configured PHY links
| common | write_pid_file() | Generate the pid file
| common | osmo_daemonize() | Fork as daemon in background (if configured)
| common | bts_main() | Run main loop until global variable quit >= 2
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index 78fe6b99..ac38c289 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -174,6 +174,7 @@ static inline struct phy_instance *trx_phy_instance(const struct gsm_bts_trx *tr
}
int bts_model_phy_link_open(struct phy_link *plink);
+int bts_model_phy_link_close(struct phy_link *plink);
#define LOGPPHL(plink, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_link_name(plink), ##args)
#define LOGPPHI(pinst, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_instance_name(pinst), ##args)
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 1a920476..f0c87469 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -1341,6 +1341,23 @@ cleanup:
return -1;
}
+/*! close the PHY link using TRX protocol */
+int bts_model_phy_link_close(struct phy_link *plink)
+{
+ bool clock_stopped = false;
+ struct phy_instance *pinst;
+ llist_for_each_entry(pinst, &plink->instances, list) {
+ if (!clock_stopped) {
+ clock_stopped = true;
+ trx_sched_clock_stopped(pinst->trx->bts);
+ }
+ trx_phy_inst_close(pinst);
+ }
+ trx_udp_close(&plink->u.osmotrx.trx_ofd_clk);
+ phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
+ return 0;
+}
+
/*! determine if the TRX for given handle is powered up */
int trx_if_powered(struct trx_l1h *l1h)
{
diff --git a/src/osmo-bts-trx/trx_provision_fsm.c b/src/osmo-bts-trx/trx_provision_fsm.c
index 60410734..7f42b47e 100644
--- a/src/osmo-bts-trx/trx_provision_fsm.c
+++ b/src/osmo-bts-trx/trx_provision_fsm.c
@@ -592,14 +592,13 @@ static void st_open_wait_poweroff_cnf(struct osmo_fsm_inst *fi, uint32_t event,
case TRX_PROV_EV_POWEROFF_CNF:
rc = (uint16_t)(intptr_t)data;
if (plink->state != PHY_LINK_SHUTDOWN) {
- trx_sched_clock_stopped(pinst->trx->bts);
- phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
+ bts_model_phy_link_close(plink);
/* Notify TRX close on all TRX associated with this phy */
llist_for_each_entry(pinst, &plink->instances, list) {
bts_model_trx_close_cb(pinst->trx, rc);
}
- trx_prov_fsm_state_chg(fi, TRX_PROV_ST_OPEN_POWEROFF);
+ trx_prov_fsm_state_chg(fi, TRX_PROV_ST_CLOSED);
}
break;
default:
@@ -661,7 +660,7 @@ static struct osmo_fsm_state trx_prov_fsm_states[] = {
.in_event_mask =
X(TRX_PROV_EV_POWEROFF_CNF),
.out_state_mask =
- X(TRX_PROV_ST_OPEN_POWEROFF),
+ X(TRX_PROV_ST_CLOSED),
.name = "OPEN_WAIT_POWEROFF_CNF",
.action = st_open_wait_poweroff_cnf,
},