aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-10-22 03:23:58 +0300
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-11-04 16:05:33 +0300
commit9833a4e198364000505554f0b14dda5451056030 (patch)
treeffc0be3a3b0fe4576093938d8c04379f1485f933
parentfbd9aaca6609ef87d8dcc5c9143e638848e0227d (diff)
[overpower] Turn it on and off depending on DL RxQual
-rw-r--r--include/osmo-bts/lchan.h3
-rw-r--r--src/common/measurement.c41
-rw-r--r--src/common/rsl.c14
-rw-r--r--src/common/scheduler.c2
4 files changed, 57 insertions, 3 deletions
diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h
index 754dc7cb..3aaa75ab 100644
--- a/include/osmo-bts/lchan.h
+++ b/include/osmo-bts/lchan.h
@@ -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;
diff --git a/src/common/measurement.c b/src/common/measurement.c
index 8f33eaae..4341be71 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -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);
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 5d069c23..4c84f219 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -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? */
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index ba5c18ac..d8048b50 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -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)) {