Change in osmo-bsc[master]: power_control: send RSL_IE_{MS, BS}_POWER_PARAM on CHANnel ACTIVation

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
Fri Dec 18 16:13:06 UTC 2020


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


Change subject: power_control: send RSL_IE_{MS,BS}_POWER_PARAM on CHANnel ACTIVation
......................................................................

power_control: send RSL_IE_{MS,BS}_POWER_PARAM on CHANnel ACTIVation

Change-Id: I586b1c9e16390757b015c2871a36abc3975e0fc4
Related: SYS#4918
---
M include/osmocom/bsc/bts.h
M src/osmo-bsc/abis_rsl.c
2 files changed, 65 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/87/21787/1

diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index fc5ec40..97e2ff8 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -184,6 +184,9 @@
 
 	void (*e1line_bind_ops)(struct e1inp_line *line);
 
+	/* (Optional) encoding function for MS/BS Power Control paramaters */
+	int (*enc_power_params)(struct msgb *msg, const struct gsm_power_ctrl_params *cp);
+
 	void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
 	void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
 	void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index f8ea5a5..917726a 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -486,6 +486,59 @@
 	}
 }
 
+static void add_power_control_params(struct msgb *msg,
+				     const struct gsm_bts *bts,
+				     enum gsm_power_ctrl_dir dir)
+{
+	const struct gsm_power_ctrl_params *cp;
+	uint8_t tag, msg_len, *ie_len;
+	int rc;
+
+	if (dir == GSM_PWR_CTRL_DIR_UL) {
+		tag = RSL_IE_MS_POWER_PARAM;
+		cp = bts->ms_power_ctrl;
+	} else {
+		tag = RSL_IE_BS_POWER_PARAM;
+		cp = bts->bs_power_ctrl;
+	}
+
+	/* These parameters are only valid for dynamic mode */
+	if (cp->mode != GSM_PWR_CTRL_MODE_DYN_BTS)
+		return;
+
+	switch (bts->type) {
+	case GSM_BTS_TYPE_NANOBTS:
+	case GSM_BTS_TYPE_OSMOBTS:
+		/* For both ip.access nanoBTS and osmoBTS we send MS/BS Power Control
+		 * parameters once - right after the RSL connection is established.
+		 * However, we may still need to send an empty IE here in order to
+		 * indicate that dynamic power control is to be performed by BTS. */
+		msgb_tlv_put(msg, tag, 0, NULL);
+		return;
+	default:
+		/* Since IE {MS,BS}_POWER_PARAM content is operator dependent, it's not
+		 * known if non-osmocom BTS models will support an empty IE, so let's
+		 * better skip sending it unless we know for sure what each expects. */
+		if (bts->model->enc_power_params == NULL)
+			return;
+
+		/* Put tag first, length will be updated later */
+		ie_len = msgb_tl_put(msg, tag);
+		msg_len = msgb_length(msg);
+
+		rc = bts->model->enc_power_params(msg, cp);
+		if (rc != 0) {
+			LOGP(DRSL, LOGL_ERROR, "Failed to encode MS/BS Power Control "
+			     "parameters, omitting this IE (tag 0x%02x)\n", tag);
+			msgb_get(msg, msg_len - 2);
+			return;
+		}
+
+		/* Update length part of the containing IE */
+		*ie_len = msgb_length(msg) - msg_len;
+	}
+}
+
 /* Chapter 8.4.1 */
 int rsl_tx_chan_activ(struct gsm_lchan *lchan, uint8_t act_type, uint8_t ho_ref)
 {
@@ -570,15 +623,16 @@
 		break;
 	}
 
-	msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power);
-	msgb_tv_put(msg, RSL_IE_MS_POWER, lchan->ms_power);
+	if (bts->bs_power_ctrl->mode != GSM_PWR_CTRL_MODE_NONE)
+		msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power);
+	if (bts->ms_power_ctrl->mode != GSM_PWR_CTRL_MODE_NONE)
+		msgb_tv_put(msg, RSL_IE_MS_POWER, lchan->ms_power);
+
 	msgb_tv_put(msg, RSL_IE_TIMING_ADVANCE, ta);
-	/* indicate MS power control to be performed by BTS: */
-	if (bts->type == GSM_BTS_TYPE_OSMOBTS)
-		msgb_tl_put(msg, RSL_IE_MS_POWER_PARAM);
-	/* else: Since IE MS_POWER_PARAM content is operator dependent, it's not
-	   known if non-osmocom BTS models will support an empty IE, so let's
-	   better skip sending it unless we know for sure what each expects. */
+
+	/* BS/MS Power Control Parameters (if supported by BTS model) */
+	add_power_control_params(msg, bts, GSM_PWR_CTRL_DIR_DL);
+	add_power_control_params(msg, bts, GSM_PWR_CTRL_DIR_UL);
 
 	mr_config_for_bts(lchan, msg);
 	rep_acch_cap_for_bts(lchan, msg);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I586b1c9e16390757b015c2871a36abc3975e0fc4
Gerrit-Change-Number: 21787
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/20201218/36ab5ac0/attachment.htm>


More information about the gerrit-log mailing list