Change in osmo-bsc[master]: power_control: make use of MS/BS parameters in RSL messages

2020-12-21 Thread fixeria
fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/21787 )

Change subject: power_control: make use of MS/BS parameters in RSL messages
..

power_control: make use of MS/BS parameters in RSL messages

Change-Id: I586b1c9e16390757b015c2871a36abc3975e0fc4
Related: SYS#4918
---
M src/osmo-bsc/abis_rsl.c
1 file changed, 52 insertions(+), 17 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index a803a03..2142219 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -185,6 +185,42 @@
return "";
 }

+static void add_power_control_params(struct msgb *msg, enum abis_rsl_ie iei,
+const struct gsm_lchan *lchan)
+{
+   const struct gsm_bts *bts = lchan->ts->trx->bts;
+   const struct gsm_power_ctrl_params *cp;
+
+   /* Since {MS,BS}_POWER_PARAM IE content is operator dependent, it's not
+* known how different BTS models will interpret an empty IE, so let's
+* better skip sending it unless we know for sure what each expects. */
+   if (bts->model->power_ctrl_enc_rsl_params == NULL)
+   return;
+
+   if (iei == RSL_IE_MS_POWER_PARAM)
+   cp = >ms_power_ctrl;
+   else
+   cp = >bs_power_ctrl;
+
+   /* These parameters are only valid for dynamic mode */
+   if (cp->mode != GSM_PWR_CTRL_MODE_DYN_BTS)
+   return;
+
+   /* Put tag first, length will be updated later */
+   uint8_t *ie_len = msgb_tl_put(msg, iei);
+   uint8_t msg_len = msgb_length(msg);
+
+   if (bts->model->power_ctrl_enc_rsl_params(msg, cp) != 0) {
+   LOGP(DRSL, LOGL_ERROR, "Failed to encode MS/BS Power Control "
+"parameters, omitting this IE (tag 0x%02x)\n", iei);
+   msgb_get(msg, msg_len - 2);
+   return;
+   }
+
+   /* Update length part of the containing IE */
+   *ie_len = msgb_length(msg) - msg_len;
+}
+
 /* Send a BCCH_INFO message as per Chapter 8.5.1 */
 int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type 
si_type, const uint8_t *data, int len)
 {
@@ -281,6 +317,9 @@

msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power);
 
+   /* BS Power Control Parameters (if supported by BTS model) */
+   add_power_control_params(msg, RSL_IE_BS_POWER_PARAM, lchan);
+
msg->dst = lchan->ts->trx->rsl_link;

return abis_rsl_sendmsg(msg);
@@ -288,8 +327,6 @@

 int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan)
 {
-   struct gsm_bts_trx *trx = lchan->ts->trx;
-   struct gsm_bts *bts = trx->bts;
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg;
uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
@@ -304,14 +341,11 @@
dh->chan_nr = chan_nr;

msgb_tv_put(msg, RSL_IE_MS_POWER, lchan->ms_power);
-   /* 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. */

-   msg->dst = trx->rsl_link;
+   /* MS Power Control Parameters (if supported by BTS model) */
+   add_power_control_params(msg, RSL_IE_MS_POWER_PARAM, lchan);
+
+   msg->dst = lchan->ts->trx->rsl_link;

return abis_rsl_sendmsg(msg);
 }
@@ -562,15 +596,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, RSL_IE_BS_POWER_PARAM, lchan);
+   add_power_control_params(msg, RSL_IE_MS_POWER_PARAM, lchan);

mr_config_for_bts(lchan, msg);
rep_acch_cap_for_bts(lchan, msg);

--
To view, visit 

Change in osmo-bsc[master]: power_control: make use of MS/BS parameters in RSL messages

2020-12-21 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/21787 )

Change subject: power_control: make use of MS/BS parameters in RSL messages
..


Patch Set 5: Code-Review+2


--
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: 5
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 21 Dec 2020 09:50:52 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: power_control: make use of MS/BS parameters in RSL messages

2020-12-20 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/21787 )

Change subject: power_control: make use of MS/BS parameters in RSL messages
..


Patch Set 5: Code-Review+1


--
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: 5
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Sun, 20 Dec 2020 15:48:28 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: power_control: make use of MS/BS parameters in RSL messages

2020-12-19 Thread fixeria
Hello Jenkins Builder, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-bsc/+/21787

to look at the new patch set (#5).

Change subject: power_control: make use of MS/BS parameters in RSL messages
..

power_control: make use of MS/BS parameters in RSL messages

Change-Id: I586b1c9e16390757b015c2871a36abc3975e0fc4
Related: SYS#4918
---
M src/osmo-bsc/abis_rsl.c
1 file changed, 52 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/87/21787/5
--
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: 5
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in osmo-bsc[master]: power_control: make use of MS/BS parameters in RSL messages

2020-12-19 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/21787 )

Change subject: power_control: make use of MS/BS parameters in RSL messages
..


Patch Set 4: Code-Review+1


--
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: 4
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Sat, 19 Dec 2020 16:52:00 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: power_control: make use of MS/BS parameters in RSL messages

2020-12-18 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/21787 )

Change subject: power_control: make use of MS/BS parameters in RSL messages
..


Patch Set 3:

This change is ready for review.


--
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: 3
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Comment-Date: Sat, 19 Dec 2020 00:10:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment