bts: st_op_enabled_on_enter(): resume C0 power reduction

If power saving is enabled for a BTS, it should remain enabled even
if the BTS is restarted for whatever reason.  This persistence can be
achieved by re-sending the configured power reduction value whenever
the BTS NM FSM enters the ENABLED state again (i.e. reconnects).

Separate gsm_bts_send_c0_power_red() from gsm_bts_set_c0_power_red()
and call the former from st_op_enabled_on_enter().  All we need to do
is to send the value that was configured before, per-timeslot power
reduction limits remain and need not to be updated.

Take a chance to move logging from BTS specific to the generic code.

Change-Id: Ic3f8a2ab0ffd049a8ed84361a3a588c1e1b23ac6
Related: SYS#6435
This commit is contained in:
Vadim Yanitskiy 2023-04-28 01:40:31 +07:00
parent 05e2deb49c
commit 16922c5017
4 changed files with 23 additions and 10 deletions

View File

@ -822,6 +822,7 @@ void gsm_bts_all_ts_dispatch(struct gsm_bts *bts, uint32_t ts_ev, void *data);
int gsm_bts_set_system_infos(struct gsm_bts *bts);
int gsm_bts_send_c0_power_red(const struct gsm_bts *bts, const uint8_t red);
int gsm_bts_set_c0_power_red(struct gsm_bts *bts, const uint8_t red);
void gsm_bts_stats_reset(struct gsm_bts *bts);

View File

@ -978,21 +978,30 @@ int gsm_bts_set_system_infos(struct gsm_bts *bts)
return 0;
}
/* Send the given C0 power reduction value to the BTS */
int gsm_bts_send_c0_power_red(const struct gsm_bts *bts, const uint8_t red)
{
if (!osmo_bts_has_feature(&bts->features, BTS_FEAT_BCCH_POWER_RED))
return -ENOTSUP;
if (bts->model->power_ctrl_send_c0_power_red == NULL)
return -ENOTSUP;
return bts->model->power_ctrl_send_c0_power_red(bts, red);
}
/* Send the given C0 power reduction value to the BTS and update the internal state */
int gsm_bts_set_c0_power_red(struct gsm_bts *bts, const uint8_t red)
{
struct gsm_bts_trx *c0 = bts->c0;
unsigned int tn;
int rc;
if (!osmo_bts_has_feature(&bts->features, BTS_FEAT_BCCH_POWER_RED))
return -ENOTSUP;
if (bts->model->power_ctrl_send_c0_power_red == NULL)
return -ENOTSUP;
rc = bts->model->power_ctrl_send_c0_power_red(bts, red);
rc = gsm_bts_send_c0_power_red(bts, red);
if (rc != 0)
return rc;
LOG_BTS(bts, DRSL, LOGL_NOTICE, "%sabling BCCH carrier power reduction "
"operation mode (maximum %u dB)\n", red ? "En" : "Dis", red);
/* Timeslot 0 is always transmitting BCCH/CCCH */
c0->ts[0].c0_max_power_red_db = 0;

View File

@ -168,10 +168,6 @@ static int power_ctrl_send_c0_power_red(const struct gsm_bts *bts, const uint8_t
if (msg == NULL)
return -ENOMEM;
LOGP(DRSL, LOGL_NOTICE, "%sabling BCCH carrier power reduction "
"operation mode for BTS%u (maximum %u dB)\n",
red ? "En" : "Dis", bts->nr, red);
/* Abuse the standard BS POWER CONTROL message by specifying 'Common Channel'
* in the Protocol Discriminator field and 'BCCH' in the Channel Number IE. */
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));

View File

@ -286,6 +286,13 @@ static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state
bts->mo.get_attr_rep_received = false;
bts->mo.set_attr_sent = false;
bts->mo.set_attr_ack_received = false;
/* Resume power saving on the BCCH carrier, if was enabled */
if (bts->c0_max_power_red_db > 0) {
LOG_BTS(bts, DRSL, LOGL_NOTICE, "Resuming BCCH carrier power reduction "
"operation mode (maximum %u dB)\n", bts->c0_max_power_red_db);
gsm_bts_send_c0_power_red(bts, bts->c0_max_power_red_db);
}
}
static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)