[overpower] Turn it on and off depending on DL RxQual

Change-Id: Iaa812d4661ee17c4cd4a8c4ae4bd3e94c1a2e6cc
Depends: Ia28293a12de0af71f55e701fb65c46e905dae217
Related: SYS#5319
This commit is contained in:
Vadim Yanitskiy 2021-10-22 03:23:58 +03:00
parent fbd9aaca66
commit 9833a4e198
4 changed files with 57 additions and 3 deletions

View File

@ -293,8 +293,9 @@ struct gsm_lchan {
struct gsm_power_ctrl_params ms_dpc_params;
struct gsm_power_ctrl_params bs_dpc_params;
/* Temporary ACCH overpower capabilities */
/* Temporary ACCH overpower capabilities and state */
struct abis_rsl_osmo_temp_ovp_acch_cap top_acch_cap;
bool top_acch_active;
struct msgb *pending_rel_ind_msg;

View File

@ -861,6 +861,43 @@ out:
LOGPLCHAN(lchan, DL1P, LOGL_DEBUG, "DL-FACCH repetition: active => inactive\n");
}
static void acch_overpower_active_decision(struct gsm_lchan *lchan,
const struct gsm48_meas_res *meas_res)
{
const bool old = lchan->top_acch_active;
uint8_t upper, lower, rxqual;
/* ACCH overpower is not allowed => nothing to do */
if (lchan->top_acch_cap.overpower_db == 0)
return;
/* RxQual threshold is disabled => overpower is always on */
if (lchan->top_acch_cap.rxqual == 0)
return;
/* If DTx is active on Downlink, use the '-SUB' */
if (meas_res->dtx_used)
rxqual = meas_res->rxqual_sub;
else /* ... otherwise use the '-FULL' */
rxqual = meas_res->rxqual_full;
upper = lchan->top_acch_cap.rxqual;
if (upper > 2)
lower = upper - 2;
else
lower = 0;
if (rxqual >= upper)
lchan->top_acch_active = true;
else if (rxqual <= lower)
lchan->top_acch_active = false;
if (lchan->top_acch_active != old) {
LOGPLCHAN(lchan, DL1P, LOGL_DEBUG, "Temporary ACCH overpower: %s\n",
lchan->top_acch_active ? "inactive => active"
: "active => inactive");
}
}
static bool data_is_rr_meas_rep(const uint8_t *data)
{
const struct gsm48_hdr *gh = (void *)(data + 5);
@ -954,8 +991,10 @@ void lchan_meas_handle_sacch(struct gsm_lchan *lchan, struct msgb *msg)
}
lchan_ms_ta_ctrl(lchan, ms_ta, lchan->meas.ms_toa256);
lchan_ms_pwr_ctrl(lchan, ms_pwr, ul_rssi, ul_ci_cb);
if (mr && mr->meas_valid == 0) /* 0 = valid */
if (mr && mr->meas_valid == 0) { /* 0 = valid */
lchan_bs_pwr_ctrl(lchan, mr);
acch_overpower_active_decision(lchan, mr);
}
repeated_dl_facch_active_decision(lchan, mr);

View File

@ -1928,6 +1928,13 @@ static int rsl_rx_chan_activ(struct msgb *msg)
if (rc < 0)
return rsl_tx_chan_act_acknack(lchan, -rc);
/* Take the first ACCH overpower decision (if allowed): it can be
* enabled immediately if the RxQual threshold is disabled (0). */
if (lchan->top_acch_cap.overpower_db > 0)
lchan->top_acch_active = !lchan->top_acch_cap.rxqual;
else
lchan->top_acch_active = false;
/* actually activate the channel in the BTS */
rc = l1sap_chan_act(lchan->ts->trx, dch->chan_nr, &tp);
if (rc < 0)
@ -2198,6 +2205,13 @@ static int rsl_rx_mode_modif(struct msgb *msg)
if (rc < 0)
return rsl_tx_mode_modif_nack(lchan, -rc);
/* Immediately disable ACCH overpower if the value is 0 dB,
* or enable if the RxQual threshold becomes disabled (0). */
if (lchan->top_acch_cap.overpower_db == 0)
lchan->top_acch_active = false;
else if (lchan->top_acch_cap.rxqual == 0)
lchan->top_acch_active = true;
l1sap_chan_modify(lchan->ts->trx, dch->chan_nr);
/* FIXME: delay this until L1 says OK? */

View File

@ -1310,7 +1310,7 @@ static void trx_sched_apply_att(const struct gsm_lchan *lchan,
br->att = lchan->bs_power_ctrl.current;
/* Temporary Overpower for SACCH/FACCH bursts */
if (lchan->top_acch_cap.overpower_db == 0)
if (!lchan->top_acch_active)
return;
if ((lchan->top_acch_cap.sacch_enable && desc->link_id == LID_SACCH) ||
(lchan->top_acch_cap.facch_enable && br->flags & TRX_BR_F_FACCH)) {