aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-05-23 20:15:29 +0200
committerHarald Welte <laforge@gnumonks.org>2019-05-24 11:03:37 +0200
commit839b0f264f1e20ebf41a232808438ffba972be65 (patch)
tree696fbed32b00e733d22d5d1f62aac5fd74899c26
parentbf5d8eed1103ea295bb63718a2f6330d9fbebb5d (diff)
rsl: Implement parsing of BS Power Control message
-rw-r--r--doc/manuals/abis/rsl.adoc2
-rw-r--r--src/common/rsl.c44
2 files changed, 45 insertions, 1 deletions
diff --git a/doc/manuals/abis/rsl.adoc b/doc/manuals/abis/rsl.adoc
index ec4da67..f66142d 100644
--- a/doc/manuals/abis/rsl.adoc
+++ b/doc/manuals/abis/rsl.adoc
@@ -39,6 +39,7 @@ Specific additions and limitations apply, see the linked sections.
| 8.4.11 | - | MODE MODIFY NEGATIVE ACKNOWLEDGE | -> | Sent
| 8.4.14 | - | RF CHANNEL RELEASE | <- | Received
| 8.4.15 | <<MS_POWER_CONTROL>> | MS POWER CONTROL | <- | Received
+| 8.4.16 | - | BS POWER CONTROL | <- | Received
| 8.4.19 | - | RF CHANNEL RELEASE ACKNOWLEDGE | -> | Sent
| 8.4.20 | <<SACCH_INFO_MODIFY>> | SACCH INFO MODIFY | <- | Received
5+<| *COMMON CHANNEL MANAGEMENT MESSAGES*
@@ -91,7 +92,6 @@ Specific additions and limitations apply, see the linked sections.
2+<| *DEDICATED CHANNEL MANAGEMENT MESSAGES*
| 8.4.12 | PHYSICAL CONTEXT REQUEST
| 8.4.13 | PHYSICAL CONTEXT CONFIRM
-| 8.4.16 | BS POWER CONTROL
| 8.4.17 | PREPROCESS CONFIGURE
| 8.4.18 | PREPROCESSED MEASUREMENT RESULT
| 8.4.21 | TALKER DETECTION
diff --git a/src/common/rsl.c b/src/common/rsl.c
index e6fd8b9..25ed279 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1585,6 +1585,47 @@ static int rsl_rx_ms_pwr_ctrl(struct msgb *msg)
return 0;
}
+/* See TS 48.058 Section 9.3.4 */
+static int bs_power_attenuation_dB(uint8_t bs_power)
+{
+ /* the lower nibble contains the number of 2dB steps that the BS power is reduced compared
+ * to its nominal transmit power */
+ return - ((bs_power & 0xF) *2);
+}
+
+/* 8.4.16 BS POWER CONTROL */
+static int rsl_rx_bs_pwr_ctrl(struct msgb *msg)
+{
+ struct abis_rsl_dchan_hdr *dch = msgb_l2(msg);
+ struct gsm_lchan *lchan = msg->lchan;
+ struct tlv_parsed tp;
+ uint8_t new_bs_power;
+
+ rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
+
+ /* 9.3.4 BS Power (M) */
+ if (!TLVP_PRES_LEN(&tp, RSL_IE_BS_POWER, 1))
+ return rsl_tx_error_report(msg->trx, RSL_ERR_MAND_IE_ERROR, &dch->chan_nr, NULL, msg);
+
+ new_bs_power = *TLVP_VAL(&tp, RSL_IE_BS_POWER);
+
+ LOGPLCHAN(lchan, DRSL, LOGL_INFO, "BS POWER CONTROL Attenuation %d -> %d dB\n",
+ bs_power_attenuation_dB(lchan->bs_power), bs_power_attenuation_dB(new_bs_power));
+
+ lchan->bs_power = new_bs_power;
+
+ /* 9.3.31 MS Power Parameters (O) */
+ if (TLVP_PRESENT(&tp, RSL_IE_BS_POWER_PARAM)) {
+ /* Spec explicitly states BTS should perform autonomous
+ * BS power control loop in BTS if 'BS Power Parameters'
+ * IE is present! WE don't support that. */
+ return rsl_tx_error_report(msg->trx, RSL_ERR_OPT_IE_ERROR, &dch->chan_nr, NULL, msg);
+ }
+
+ return 0;
+}
+
+
/* 8.4.20 SACCH INFO MODify */
static int rsl_rx_sacch_inf_mod(struct msgb *msg)
{
@@ -2926,6 +2967,9 @@ static int rsl_rx_dchan(struct gsm_bts_trx *trx, struct msgb *msg)
case RSL_MT_MS_POWER_CONTROL:
ret = rsl_rx_ms_pwr_ctrl(msg);
break;
+ case RSL_MT_BS_POWER_CONTROL:
+ ret = rsl_rx_bs_pwr_ctrl(msg);
+ break;
case RSL_MT_IPAC_PDCH_ACT:
case RSL_MT_IPAC_PDCH_DEACT:
rsl_rx_dyn_pdch(msg, dch->c.msg_type == RSL_MT_IPAC_PDCH_ACT);