laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bts/+/15970 )
Change subject: rsl: Assign recv pwr to lchan's max ms power
......................................................................
rsl: Assign recv pwr to lchan's max ms power
Otherwise older ms_power value will be kept and used as a maximum.
>From TS 08.58 sec 4.8 "MS power control":
"""
If power control is supported by BTS and it is to be used,
this is indicated by optional parameters in the MS POWER CONTROL
message (or the CHANNEL ACTIVATION message). Based on the
measurements performed on the uplink, TRX then attempts to keep
the power control parameters within the limits set by the
MS POWER CONTROL message (or by the CHANNEL ACTIVATION message).
"""
Change-Id: I0583eef477c33279ee5bfcda80141f365413a276
---
M src/common/rsl.c
1 file changed, 22 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/common/rsl.c b/src/common/rsl.c
index de51e6f..e460693 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <netdb.h>
#include <stdbool.h>
+#include <inttypes.h>
#include <sys/types.h>
#include <arpa/inet.h>
@@ -1623,8 +1624,10 @@
{
struct abis_rsl_dchan_hdr *dch = msgb_l2(msg);
struct gsm_lchan *lchan = msg->lchan;
+ struct gsm_bts *bts = lchan->ts->trx->bts;
struct tlv_parsed tp;
uint8_t pwr;
+ int max_pwr, curr_pwr;
rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
@@ -1633,9 +1636,9 @@
return rsl_tx_error_report(msg->trx, RSL_ERR_MAND_IE_ERROR,
&dch->chan_nr, NULL, msg);
pwr = *TLVP_VAL(&tp, RSL_IE_MS_POWER) & 0x1F;
- lchan->ms_power_ctrl.current = pwr;
+ lchan->ms_power = pwr;
- LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Rx MS POWER CONTROL %d\n",
lchan->ms_power_ctrl.current);
+ LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Rx MS POWER CONTROL %d\n",
lchan->ms_power_ctrl.current);
/* 9.3.31 MS Power Parameters (O) */
if (TLVP_PRESENT(&tp, RSL_IE_MS_POWER_PARAM))
@@ -1647,6 +1650,23 @@
lchan->ms_power_ctrl.fixed = 1;
}
+ /* Only set current to lchan->ms_power if actual value of current
+ in dBm > value in dBm from lchan->ms_power, or if fixed=1. */
+ if (lchan->ms_power_ctrl.fixed) {
+ lchan->ms_power_ctrl.current = lchan->ms_power;
+ } else {
+ max_pwr = ms_pwr_dbm(bts->band, lchan->ms_power);
+ curr_pwr = ms_pwr_dbm(bts->band, lchan->ms_power_ctrl.current);
+ if (max_pwr < 0 || curr_pwr < 0) {
+ LOGPLCHAN(lchan, DRSL, LOGL_ERROR,
+ "Unable to calculate power levels to dBm: %"
PRIu8 " -> %d, %" PRIu8 " -> %d\n",
+ lchan->ms_power, max_pwr,
+ lchan->ms_power_ctrl.current, curr_pwr);
+ } else if (curr_pwr > max_pwr) {
+ lchan->ms_power_ctrl.current = lchan->ms_power;
+ }
+ }
+
bts_model_adjst_ms_pwr(lchan);
return 0;
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15970
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I0583eef477c33279ee5bfcda80141f365413a276
Gerrit-Change-Number: 15970
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged