aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-11-05 13:25:01 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2019-11-12 14:17:24 +0100
commit000b13ef523f3d5f3b77f649ea129b1e59095381 (patch)
tree320f320c0978a28bd450af2d058293acc83c2acc
parenta9d88af59461f36a92cc6d900b3f9e811e6fdd72 (diff)
rsl: Assign recv pwr to lchan's max ms power
Otherwise older ms_power value will be kept and used as a maximum. From TS 08.58 sec 4.8 "MS power control": """ If power control is supported by BTS and it is to be used, this is indicated by optional parameters in the MS POWER CONTROL message (or the CHANNEL ACTIVATION message). Based on the measurements performed on the uplink, TRX then attempts to keep the power control parameters within the limits set by the MS POWER CONTROL message (or by the CHANNEL ACTIVATION message). """ Change-Id: I0583eef477c33279ee5bfcda80141f365413a276
-rw-r--r--src/common/rsl.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index de51e6f4..e460693c 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <netdb.h>
#include <stdbool.h>
+#include <inttypes.h>
#include <sys/types.h>
#include <arpa/inet.h>
@@ -1623,8 +1624,10 @@ static int rsl_rx_ms_pwr_ctrl(struct msgb *msg)
{
struct abis_rsl_dchan_hdr *dch = msgb_l2(msg);
struct gsm_lchan *lchan = msg->lchan;
+ struct gsm_bts *bts = lchan->ts->trx->bts;
struct tlv_parsed tp;
uint8_t pwr;
+ int max_pwr, curr_pwr;
rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
@@ -1633,9 +1636,9 @@ static int rsl_rx_ms_pwr_ctrl(struct msgb *msg)
return rsl_tx_error_report(msg->trx, RSL_ERR_MAND_IE_ERROR, &dch->chan_nr, NULL, msg);
pwr = *TLVP_VAL(&tp, RSL_IE_MS_POWER) & 0x1F;
- lchan->ms_power_ctrl.current = pwr;
+ lchan->ms_power = pwr;
- LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Rx MS POWER CONTROL %d\n", lchan->ms_power_ctrl.current);
+ LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Rx MS POWER CONTROL %d\n", lchan->ms_power_ctrl.current);
/* 9.3.31 MS Power Parameters (O) */
if (TLVP_PRESENT(&tp, RSL_IE_MS_POWER_PARAM))
@@ -1647,6 +1650,23 @@ static int rsl_rx_ms_pwr_ctrl(struct msgb *msg)
lchan->ms_power_ctrl.fixed = 1;
}
+ /* Only set current to lchan->ms_power if actual value of current
+ in dBm > value in dBm from lchan->ms_power, or if fixed=1. */
+ if (lchan->ms_power_ctrl.fixed) {
+ lchan->ms_power_ctrl.current = lchan->ms_power;
+ } else {
+ max_pwr = ms_pwr_dbm(bts->band, lchan->ms_power);
+ curr_pwr = ms_pwr_dbm(bts->band, lchan->ms_power_ctrl.current);
+ if (max_pwr < 0 || curr_pwr < 0) {
+ LOGPLCHAN(lchan, DRSL, LOGL_ERROR,
+ "Unable to calculate power levels to dBm: %" PRIu8 " -> %d, %" PRIu8 " -> %d\n",
+ lchan->ms_power, max_pwr,
+ lchan->ms_power_ctrl.current, curr_pwr);
+ } else if (curr_pwr > max_pwr) {
+ lchan->ms_power_ctrl.current = lchan->ms_power;
+ }
+ }
+
bts_model_adjst_ms_pwr(lchan);
return 0;