From cc4ada5bc4fdd1eb0b20ad2512312f20c253669b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 29 Jan 2015 20:57:17 +0100 Subject: power: Make it possible to force a power level Use the standard RSL commands to order a logical channel to use a fixed power level. The code is not fully verified and there was a last minute change to invoke bts_model_adjst_ms_pwr. Conflicts: tests/stubs.c --- src/common/rsl.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/common/rsl.c b/src/common/rsl.c index 5082f2a8..5a2befd1 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1089,6 +1089,26 @@ static int rsl_rx_mode_modif(struct msgb *msg) return rc; } +/* 8.4.15 MS POWER CONTROL */ +static int rsl_rx_ms_pwr_ctrl(struct msgb *msg) +{ + struct gsm_lchan *lchan = msg->lchan; + struct tlv_parsed tp; + + rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg)); + if (TLVP_PRESENT(&tp, RSL_IE_MS_POWER)) { + uint8_t pwr = *TLVP_VAL(&tp, RSL_IE_MS_POWER) & 0x1F; + lchan->ms_power_ctrl.fixed = 1; + lchan->ms_power_ctrl.current = pwr; + + LOGP(DRSL, LOGL_NOTICE, "%s forcing power to %d\n", + gsm_lchan_name(lchan), lchan->ms_power_ctrl.current); + bts_model_adjst_ms_pwr(lchan); + } + + return 0; +} + /* 8.4.20 SACCH INFO MODify */ static int rsl_rx_sacch_inf_mod(struct msgb *msg) { @@ -1750,6 +1770,9 @@ static int rsl_rx_dchan(struct gsm_bts_trx *trx, struct msgb *msg) case RSL_MT_MODE_MODIFY_REQ: ret = rsl_rx_mode_modif(msg); break; + case RSL_MT_MS_POWER_CONTROL: + ret = rsl_rx_ms_pwr_ctrl(msg); + break; case RSL_MT_PHY_CONTEXT_REQ: case RSL_MT_PREPROC_CONFIG: case RSL_MT_RTD_REP: -- cgit v1.2.3