Change in osmo-bts[master]: A-bis/RSL: refactor handling of BS Power IE (power reduction)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon Jun 15 15:05:09 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/18835 )


Change subject: A-bis/RSL: refactor handling of BS Power IE (power reduction)
......................................................................

A-bis/RSL: refactor handling of BS Power IE (power reduction)

According to 3GPP TS 08.58, section 9.3.4, BS Power IE indicates
the transmission power attenuation on a particular channel:

  +--------------+---------+-----------------+
  | Reserved (3) | FPC (1) | Power level (4) |
  +--------------+---------+-----------------+

so let's change handling of this IE as follows:

  - s/bs_power/bs_power_red/g, so it reflects 'reduction';
  - get rid of ms_power_ctrl.bts_tx_pwr, it's always 0 anyway;
    - fix rsl_tx_meas_res(): use lchan->bs_power_red;
  - always check if FPC (Fast Power Control) flag is set;
    - we don't support it, so reject messages containing it;
    - fix rsl_rx_chan_activ(): properly apply the bitmask.

Change-Id: I16cc50dfca102030380a06e16c234d5f6698f38f
---
M include/osmo-bts/gsm_data_shared.h
M src/common/rsl.c
M src/common/tx_power.c
M src/common/vty.c
4 files changed, 26 insertions(+), 24 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/35/18835/1

diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h
index 7cfbfeb..c3dba3c 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -193,8 +193,6 @@
 		uint8_t flags;
 		/* RSL measurement result number, 0 at lchan_act */
 		uint8_t res_nr;
-		/* current Tx power level of the BTS */
-		uint8_t bts_tx_pwr;
 		/* number of measurements stored in array below */
 		uint8_t num_ul_meas;
 		struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
@@ -267,8 +265,9 @@
 		uint8_t max;
 		bool fixed;
 	} ms_power_ctrl;
-	/* Power levels for BTS */
-	uint8_t bs_power;
+
+	/* BTS power reduction (2 dB steps) */
+	uint8_t bs_power_red;
 
 	struct msgb *pending_rel_ind_msg;
 
diff --git a/src/common/rsl.c b/src/common/rsl.c
index f057a89..b9c9695 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1001,7 +1001,7 @@
 	lchan->tch_mode = 0;
 	memset(&lchan->encr, 0, sizeof(lchan->encr));
 	memset(&lchan->ho, 0, sizeof(lchan->ho));
-	lchan->bs_power = 0;
+	lchan->bs_power_red = 0;
 	memset(&lchan->ms_power_ctrl, 0, sizeof(lchan->ms_power_ctrl));
 	lchan->rqd_ta = 0;
 	copy_sacch_si_to_lchan(lchan);
@@ -1146,8 +1146,15 @@
 	}
 
 	/* 9.3.4 BS Power */
-	if (TLVP_PRES_LEN(&tp, RSL_IE_BS_POWER, 1))
-		lchan->bs_power = *TLVP_VAL(&tp, RSL_IE_BS_POWER);
+	if (TLVP_PRES_LEN(&tp, RSL_IE_BS_POWER, 1)) {
+		if (*TLVP_VAL(&tp, RSL_IE_BS_POWER) & (1 << 4)) {
+			LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Fast Power Control is not supported\n");
+			return rsl_tx_chan_act_nack(lchan, RSL_ERR_SERV_OPT_UNIMPL);
+		}
+
+		lchan->bs_power_red = *TLVP_VAL(&tp, RSL_IE_BS_POWER) & 0x0f;
+	}
+
 	/* 9.3.13 MS Power */
 	if (TLVP_PRES_LEN(&tp, RSL_IE_MS_POWER, 1)) {
 		lchan->ms_power_ctrl.max = *TLVP_VAL(&tp, RSL_IE_MS_POWER) & 0x1F;
@@ -1664,21 +1671,13 @@
 	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;
+	uint8_t old_bs_power_red;
 
 	rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
 
@@ -1686,12 +1685,16 @@
 	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);
+	if (*TLVP_VAL(&tp, RSL_IE_BS_POWER) & (1 << 4)) {
+		LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Fast Power Control is not supported\n");
+		return rsl_tx_error_report(msg->trx, RSL_ERR_SERV_OPT_UNIMPL, &dch->chan_nr, NULL, msg);
+	}
+
+	old_bs_power_red = lchan->bs_power_red;
+	lchan->bs_power_red = *TLVP_VAL(&tp, RSL_IE_BS_POWER) & 0x0f;
 
 	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;
+		  old_bs_power_red * 2, lchan->bs_power_red * 2);
 
 	/* 9.3.31 MS Power Parameters (O) */
 	if (TLVP_PRESENT(&tp, RSL_IE_BS_POWER_PARAM)) {
@@ -2896,7 +2899,7 @@
 		msgb_tlv_put(msg, RSL_IE_UPLINK_MEAS, ie_len, meas_res);
 		lchan->meas.flags &= ~LC_UL_M_F_RES_VALID;
 	}
-	msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->meas.bts_tx_pwr);
+	msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power_red);
 	if (lchan->meas.flags & LC_UL_M_F_L1_VALID) {
 		msgb_tv_fixed_put(msg, RSL_IE_L1_INFO, 2, lchan->meas.l1_info);
 		lchan->meas.flags &= ~LC_UL_M_F_L1_VALID;
diff --git a/src/common/tx_power.c b/src/common/tx_power.c
index e418cec..de741f5 100644
--- a/src/common/tx_power.c
+++ b/src/common/tx_power.c
@@ -67,7 +67,7 @@
 }
 int get_p_target_mdBm_lchan(struct gsm_lchan *lchan)
 {
-	return get_p_target_mdBm(lchan->ts->trx, lchan->bs_power);
+	return get_p_target_mdBm(lchan->ts->trx, lchan->bs_power_red);
 }
 
 /* calculate the actual total output power required, taking into account the
@@ -133,7 +133,7 @@
 }
 int get_p_trxout_target_mdBm_lchan(struct gsm_lchan *lchan)
 {
-	return get_p_trxout_target_mdBm(lchan->ts->trx, lchan->bs_power);
+	return get_p_trxout_target_mdBm(lchan->ts->trx, lchan->bs_power_red);
 }
 
 
diff --git a/src/common/vty.c b/src/common/vty.c
index 3dfd387..058ff30 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1183,7 +1183,7 @@
 		VTY_NEWLINE);
 	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,
+		- lchan->bs_power_red * 2,
 		ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.max),
 		VTY_NEWLINE);
 	vty_out(vty, "  Channel Mode / Codec: %s%s",

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/18835
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I16cc50dfca102030380a06e16c234d5f6698f38f
Gerrit-Change-Number: 18835
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200615/6a070249/attachment.htm>


More information about the gerrit-log mailing list