phy_link: Introduce bts_model_phy_link_close() and use it in bts-trx
This step is required while turning off the BTS without killing the process. Right now only osmo-bts-trx supports this feature, so this function is only available and used by osmo-bts-trx. Later on, when the feature is support more generally, we can move call to this function to common place like bts_shutdown_fsm or alike. Change-Id: I3253112700a31b85db82dc7ccadec8542bac745e
This commit is contained in:
parent
192390c797
commit
dfedf2cb76
|
@ -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 | abis_open() | Start of the A-bis connection to BSC
|
||||||
| common | phy_links_open() | Iterate over list of configured PHY links
|
| 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_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 | write_pid_file() | Generate the pid file
|
||||||
| common | osmo_daemonize() | Fork as daemon in background (if configured)
|
| common | osmo_daemonize() | Fork as daemon in background (if configured)
|
||||||
| common | bts_main() | Run main loop until global variable quit >= 2
|
| common | bts_main() | Run main loop until global variable quit >= 2
|
||||||
|
|
|
@ -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_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 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)
|
#define LOGPPHI(pinst, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_instance_name(pinst), ##args)
|
||||||
|
|
|
@ -1341,6 +1341,23 @@ cleanup:
|
||||||
return -1;
|
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 */
|
/*! determine if the TRX for given handle is powered up */
|
||||||
int trx_if_powered(struct trx_l1h *l1h)
|
int trx_if_powered(struct trx_l1h *l1h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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:
|
case TRX_PROV_EV_POWEROFF_CNF:
|
||||||
rc = (uint16_t)(intptr_t)data;
|
rc = (uint16_t)(intptr_t)data;
|
||||||
if (plink->state != PHY_LINK_SHUTDOWN) {
|
if (plink->state != PHY_LINK_SHUTDOWN) {
|
||||||
trx_sched_clock_stopped(pinst->trx->bts);
|
bts_model_phy_link_close(plink);
|
||||||
phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
|
|
||||||
|
|
||||||
/* Notify TRX close on all TRX associated with this phy */
|
/* Notify TRX close on all TRX associated with this phy */
|
||||||
llist_for_each_entry(pinst, &plink->instances, list) {
|
llist_for_each_entry(pinst, &plink->instances, list) {
|
||||||
bts_model_trx_close_cb(pinst->trx, rc);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -661,7 +660,7 @@ static struct osmo_fsm_state trx_prov_fsm_states[] = {
|
||||||
.in_event_mask =
|
.in_event_mask =
|
||||||
X(TRX_PROV_EV_POWEROFF_CNF),
|
X(TRX_PROV_EV_POWEROFF_CNF),
|
||||||
.out_state_mask =
|
.out_state_mask =
|
||||||
X(TRX_PROV_ST_OPEN_POWEROFF),
|
X(TRX_PROV_ST_CLOSED),
|
||||||
.name = "OPEN_WAIT_POWEROFF_CNF",
|
.name = "OPEN_WAIT_POWEROFF_CNF",
|
||||||
.action = st_open_wait_poweroff_cnf,
|
.action = st_open_wait_poweroff_cnf,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue