aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2022-12-19 15:07:27 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2022-12-20 15:21:46 +0100
commit08f337abec8640e63ab6260fa28f5a792071408b (patch)
treed07f23db7d7ebc93c76549b1d59919235bd0536b
parentc8e2b021a9f41008c168cca4160102b58f00d842 (diff)
shutdown_fsm: Add power_ramp_force() to jump straight to the tgt powerdaniel/abis-timeout
Both power_ramp_start() and power_ramp_force() are now small macros around _power_ramp_start() The new behavior is: * ramp down power when stopping bts through Ctrl-C * the other shutdown causes skip power ramping This will cause the bts to reconnect faster when the oml link is dropped and power ramping is enabled. Change-Id: Ida1d7bbf094958b9142af306dbf84206729a609e Related: SYS#6237
-rw-r--r--include/osmo-bts/bts.h3
-rw-r--r--include/osmo-bts/tx_power.h7
-rw-r--r--src/common/bts_shutdown_fsm.c10
-rw-r--r--src/common/main.c2
-rw-r--r--src/common/tx_power.c10
-rw-r--r--src/osmo-bts-trx/l1_if.c2
6 files changed, 24 insertions, 10 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index b1a594c4..0ecec1e7 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -374,6 +374,7 @@ struct gsm_bts {
struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */
bool shutdown_fi_exit_proc; /* exit process when shutdown_fsm is finished? */
+ bool shutdown_fi_skip_power_ramp; /* Skip power ramping and change power in one step? */
struct osmo_fsm_inst *abis_link_fi; /* FSM instance to manage abis connection during process startup and link failure */
struct osmo_tdef *T_defs; /* Timer defines */
@@ -396,7 +397,7 @@ struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num);
int bts_init(struct gsm_bts *bts);
void bts_shutdown(struct gsm_bts *bts, const char *reason);
-void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc);
+void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc, bool skip_power_ramp);
int bts_link_estab(struct gsm_bts *bts);
diff --git a/include/osmo-bts/tx_power.h b/include/osmo-bts/tx_power.h
index a7f846e8..73134c8b 100644
--- a/include/osmo-bts/tx_power.h
+++ b/include/osmo-bts/tx_power.h
@@ -77,7 +77,12 @@ int get_p_trxout_target_mdBm_lchan(const struct gsm_lchan *lchan);
int get_p_trxout_actual_mdBm(const struct gsm_bts_trx *trx, uint8_t bs_power_red);
int get_p_trxout_actual_mdBm_lchan(const struct gsm_lchan *lchan);
-int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, ramp_compl_cb_t ramp_compl_cb);
+int _power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass_max_power, ramp_compl_cb_t ramp_compl_cb, bool skip_ramping);
+#define power_ramp_start(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb) \
+ _power_ramp_start(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb, false)
+#define power_ramp_force(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb) \
+ _power_ramp_start(trx, p_total_tgt_mdBm, bypass_max_power, ramp_compl_cb, true)
+
void power_ramp_abort(struct gsm_bts_trx *trx);
void power_trx_change_compl(struct gsm_bts_trx *trx, int p_trxout_cur_mdBm);
diff --git a/src/common/bts_shutdown_fsm.c b/src/common/bts_shutdown_fsm.c
index 0c6d80c1..55e0b190 100644
--- a/src/common/bts_shutdown_fsm.c
+++ b/src/common/bts_shutdown_fsm.c
@@ -89,7 +89,10 @@ static void st_wait_ramp_down_compl_on_enter(struct osmo_fsm_inst *fi, uint32_t
llist_for_each_entry(trx, &bts->trx_list, list) {
if (trx->mo.nm_state.operational != NM_OPSTATE_ENABLED)
continue;
- power_ramp_start(trx, to_mdB(BTS_SHUTDOWN_POWER_RAMP_TGT), 1, ramp_down_compl_cb);
+ if (bts->shutdown_fi_skip_power_ramp)
+ power_ramp_force(trx, to_mdB(BTS_SHUTDOWN_POWER_RAMP_TGT), 1, ramp_down_compl_cb);
+ else
+ power_ramp_start(trx, to_mdB(BTS_SHUTDOWN_POWER_RAMP_TGT), 1, ramp_down_compl_cb);
}
}
@@ -250,7 +253,7 @@ bool bts_shutdown_in_progress(const struct gsm_bts *bts)
return fi->state != BTS_SHUTDOWN_ST_NONE;
}
-void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc)
+void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc, bool skip_power_ramp)
{
struct osmo_fsm_inst *fi = bts->shutdown_fi;
if (bts_shutdown_in_progress(bts)) {
@@ -260,6 +263,7 @@ void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc)
return;
}
bts->shutdown_fi_exit_proc = exit_proc;
+ bts->shutdown_fi_skip_power_ramp = skip_power_ramp;
LOGPFSML(fi, LOGL_NOTICE, "Shutting down BTS, exit %u, reason: %s\n",
exit_proc, reason);
osmo_fsm_inst_dispatch(fi, BTS_SHUTDOWN_EV_START, NULL);
@@ -267,7 +271,7 @@ void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc)
void bts_shutdown(struct gsm_bts *bts, const char *reason)
{
- bts_shutdown_ext(bts, reason, true);
+ bts_shutdown_ext(bts, reason, true, true);
}
void bts_model_trx_close_cb(struct gsm_bts_trx *trx, int rc)
diff --git a/src/common/main.c b/src/common/main.c
index 954cc34c..ea6c61e4 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -233,7 +233,7 @@ static void signal_handler(int signum)
oml_tx_failure_event_rep(&g_bts->mo,
NM_SEVER_CRITICAL, OSMO_EVT_CRIT_PROC_STOP,
"BTS: SIGINT received -> shutdown");
- bts_shutdown(g_bts, "SIGINT");
+ bts_shutdown_ext(g_bts, "SIGINT", true, false);
}
quit++;
break;
diff --git a/src/common/tx_power.c b/src/common/tx_power.c
index 03074221..dd646136 100644
--- a/src/common/tx_power.c
+++ b/src/common/tx_power.c
@@ -239,8 +239,7 @@ static void power_ramp_do_step(struct gsm_bts_trx *trx, int first)
osmo_timer_schedule(&tpp->ramp.step_timer, tpp->ramp.step_interval_sec, 0);
}
-
-int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, ramp_compl_cb_t ramp_compl_cb)
+int _power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, ramp_compl_cb_t ramp_compl_cb, bool skip_ramping)
{
struct trx_power_params *tpp = &trx->power_params;
@@ -265,7 +264,12 @@ int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass,
tpp->p_total_tgt_mdBm = p_total_tgt_mdBm;
tpp->ramp.compl_cb = ramp_compl_cb;
- if (we_are_ramping_up(trx)) {
+ if (skip_ramping) {
+ /* Jump straight to the target power */
+ tpp->p_total_cur_mdBm = p_total_tgt_mdBm;
+ tpp->ramp.attenuation_mdB = 0;
+ power_ramp_timer_cb(trx);
+ } else if (we_are_ramping_up(trx)) {
if (tpp->p_total_tgt_mdBm <= tpp->ramp.max_initial_pout_mdBm) {
LOGPTRX(trx, DL1C, LOGL_INFO,
"target_power (%d mdBm) is below or equal to 'power ramp max-initial' power (%d mdBm)\n",
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 8c364c3c..ae4fe70a 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -195,7 +195,7 @@ void bts_model_abis_close(struct gsm_bts *bts)
{
/* Go into shutdown state deactivating transceivers until Abis link
* becomes up again */
- bts_shutdown_ext(bts, "Abis close", false);
+ bts_shutdown_ext(bts, "Abis close", false, true);
}
int bts_model_adjst_ms_pwr(struct gsm_lchan *lchan)