aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-11-13 13:17:20 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2019-11-14 16:36:00 +0100
commite717aec2f733ef32608734a771b80d453654f9a0 (patch)
tree76815e8a2e8f0799dd26fde0c64b279eb947ef0f /src/common
parent869091011c01098e0da995c5d68f5a5fbd6c1cbd (diff)
Move and rename gsm_lchan.ms_power field
Make it clear that it contains the maximum MS power level (TS 05.05) and not the one to be used. The one aimed at is in ms_power_ctrl.current. Since it's used in related code, move it inside the ms_power_ctrl struct too. Related: OS#1851 Change-Id: Ib264ec7dac87355cef6415461ed74bd8e9c8ca52
Diffstat (limited to 'src/common')
-rw-r--r--src/common/power_control.c4
-rw-r--r--src/common/rsl.c23
-rw-r--r--src/common/vty.c2
3 files changed, 14 insertions, 15 deletions
diff --git a/src/common/power_control.c b/src/common/power_control.c
index f467cd53..38a7fb77 100644
--- a/src/common/power_control.c
+++ b/src/common/power_control.c
@@ -83,8 +83,8 @@ int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan,
/* Don't ask for smaller ms power level than the one set
* by BSC upon RSL CHAN ACT
*/
- if (new_pwr < lchan->ms_power)
- new_pwr = lchan->ms_power;
+ if (new_pwr < lchan->ms_power_ctrl.max)
+ new_pwr = lchan->ms_power_ctrl.max;
if (lchan->ms_power_ctrl.current != new_pwr) {
lchan->ms_power_ctrl.current = new_pwr;
diff --git a/src/common/rsl.c b/src/common/rsl.c
index f88d2d70..09a9217d 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1002,7 +1002,6 @@ static void clear_lchan_for_pdch_activ(struct gsm_lchan *lchan)
memset(&lchan->encr, 0, sizeof(lchan->encr));
memset(&lchan->ho, 0, sizeof(lchan->ho));
lchan->bs_power = 0;
- lchan->ms_power = 0;
memset(&lchan->ms_power_ctrl, 0, sizeof(lchan->ms_power_ctrl));
lchan->rqd_ta = 0;
copy_sacch_si_to_lchan(lchan);
@@ -1099,8 +1098,8 @@ static int rsl_rx_chan_activ(struct msgb *msg)
gsm_lchans_name(lchan->state));
/* Initialize channel defaults */
- lchan->ms_power = ms_pwr_ctl_lvl(lchan->ts->trx->bts->band, 0);
- lchan->ms_power_ctrl.current = lchan->ms_power;
+ lchan->ms_power_ctrl.max = ms_pwr_ctl_lvl(lchan->ts->trx->bts->band, 0);
+ lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max;
lchan->ms_power_ctrl.fixed = false;
rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
@@ -1151,8 +1150,8 @@ static int rsl_rx_chan_activ(struct msgb *msg)
lchan->bs_power = *TLVP_VAL(&tp, RSL_IE_BS_POWER);
/* 9.3.13 MS Power */
if (TLVP_PRES_LEN(&tp, RSL_IE_MS_POWER, 1)) {
- lchan->ms_power = *TLVP_VAL(&tp, RSL_IE_MS_POWER);
- lchan->ms_power_ctrl.current = lchan->ms_power;
+ lchan->ms_power_ctrl.max = *TLVP_VAL(&tp, RSL_IE_MS_POWER);
+ lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max;
lchan->ms_power_ctrl.fixed = false;
}
/* 9.3.24 Timing Advance */
@@ -1633,7 +1632,7 @@ 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 = pwr;
+ lchan->ms_power_ctrl.max = pwr;
LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Rx MS POWER CONTROL %" PRIu8 "\n", pwr);
@@ -1647,20 +1646,20 @@ static int rsl_rx_ms_pwr_ctrl(struct msgb *msg)
lchan->ms_power_ctrl.fixed = true;
}
- /* Only set current to lchan->ms_power if actual value of current
- in dBm > value in dBm from lchan->ms_power, or if fixed. */
+ /* Only set current to max if actual value of current
+ in dBm > value in dBm from max, or if fixed. */
if (lchan->ms_power_ctrl.fixed) {
- lchan->ms_power_ctrl.current = lchan->ms_power;
+ lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max;
} else {
- max_pwr = ms_pwr_dbm(bts->band, lchan->ms_power);
+ max_pwr = ms_pwr_dbm(bts->band, lchan->ms_power_ctrl.max);
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.max, max_pwr,
lchan->ms_power_ctrl.current, curr_pwr);
} else if (curr_pwr > max_pwr) {
- lchan->ms_power_ctrl.current = lchan->ms_power;
+ lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max;
}
}
diff --git a/src/common/vty.c b/src/common/vty.c
index fd9be40c..514d1202 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1173,7 +1173,7 @@ static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
vty_out(vty, " BS Power: %d dBm, MS Power: %u dBm%s",
lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
- lchan->bs_power*2,
- ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
+ ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.max),
VTY_NEWLINE);
vty_out(vty, " Channel Mode / Codec: %s%s",
get_value_string(gsm48_cmode_names, lchan->tch_mode),