pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/16062 )
Change subject: Move and rename gsm_lchan.ms_power field ...................................................................... Move and rename gsm_lchan.ms_power field Make it clear that it contains the maximum MS power level (TS 05.05) and not the one to be used. The one aimed at is in ms_power_ctrl.current. Since it's used in related code, move it inside the ms_power_ctrl struct too. Related: OS#1851 Change-Id: Ib264ec7dac87355cef6415461ed74bd8e9c8ca52 --- M include/osmo-bts/gsm_data_shared.h M src/common/power_control.c M src/common/rsl.c M src/common/vty.c M src/osmo-bts-trx/loops.c M src/osmo-bts-virtual/l1_if.c 6 files changed, 18 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/62/16062/1 diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h index 5061310..8a52fe9 100644 --- a/include/osmo-bts/gsm_data_shared.h +++ b/include/osmo-bts/gsm_data_shared.h @@ -199,9 +199,6 @@ /* State */ enum gsm_lchan_state state; const char *broken_reason; - /* Power levels for MS and BTS */ - uint8_t bs_power; - uint8_t ms_power; /* Encryption information */ struct { uint8_t alg_id; @@ -323,8 +320,11 @@ /* power handling */ struct { uint8_t current; + uint8_t max; bool fixed; } ms_power_ctrl; + /* Power levels for BTS */ + uint8_t bs_power; struct msgb *pending_rel_ind_msg; diff --git a/src/common/power_control.c b/src/common/power_control.c index f467cd5..38a7fb7 100644 --- a/src/common/power_control.c +++ b/src/common/power_control.c @@ -83,8 +83,8 @@ /* Don't ask for smaller ms power level than the one set * by BSC upon RSL CHAN ACT */ - if (new_pwr < lchan->ms_power) - new_pwr = lchan->ms_power; + if (new_pwr < lchan->ms_power_ctrl.max) + new_pwr = lchan->ms_power_ctrl.max; if (lchan->ms_power_ctrl.current != new_pwr) { lchan->ms_power_ctrl.current = new_pwr; diff --git a/src/common/rsl.c b/src/common/rsl.c index f88d2d7..86be47c 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1002,7 +1002,6 @@ memset(&lchan->encr, 0, sizeof(lchan->encr)); memset(&lchan->ho, 0, sizeof(lchan->ho)); lchan->bs_power = 0; - lchan->ms_power = 0; memset(&lchan->ms_power_ctrl, 0, sizeof(lchan->ms_power_ctrl)); lchan->rqd_ta = 0; copy_sacch_si_to_lchan(lchan); @@ -1099,8 +1098,8 @@ gsm_lchans_name(lchan->state)); /* Initialize channel defaults */ - lchan->ms_power = ms_pwr_ctl_lvl(lchan->ts->trx->bts->band, 0); - lchan->ms_power_ctrl.current = lchan->ms_power; + lchan->ms_power_ctrl.max = ms_pwr_ctl_lvl(lchan->ts->trx->bts->band, 0); + lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max; lchan->ms_power_ctrl.fixed = false; rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg)); @@ -1151,8 +1150,8 @@ lchan->bs_power = *TLVP_VAL(&tp, RSL_IE_BS_POWER); /* 9.3.13 MS Power */ if (TLVP_PRES_LEN(&tp, RSL_IE_MS_POWER, 1)) { - lchan->ms_power = *TLVP_VAL(&tp, RSL_IE_MS_POWER); - lchan->ms_power_ctrl.current = lchan->ms_power; + lchan->ms_power_ctrl.max = *TLVP_VAL(&tp, RSL_IE_MS_POWER); + lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max; lchan->ms_power_ctrl.fixed = false; } /* 9.3.24 Timing Advance */ @@ -1633,7 +1632,7 @@ 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 = pwr; + lchan->ms_power_ctrl.max = pwr; LOGPLCHAN(lchan, DRSL, LOGL_INFO, "Rx MS POWER CONTROL %" PRIu8 "\n", pwr); @@ -1650,17 +1649,17 @@ /* Only set current to lchan->ms_power if actual value of current in dBm > value in dBm from lchan->ms_power, or if fixed. */ if (lchan->ms_power_ctrl.fixed) { - lchan->ms_power_ctrl.current = lchan->ms_power; + lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max; } else { - max_pwr = ms_pwr_dbm(bts->band, lchan->ms_power); + max_pwr = ms_pwr_dbm(bts->band, lchan->ms_power_ctrl.max); 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.max, max_pwr, lchan->ms_power_ctrl.current, curr_pwr); } else if (curr_pwr > max_pwr) { - lchan->ms_power_ctrl.current = lchan->ms_power; + lchan->ms_power_ctrl.current = lchan->ms_power_ctrl.max; } } diff --git a/src/common/vty.c b/src/common/vty.c index 6ae82d1..206b166 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -1173,7 +1173,7 @@ 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, - ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), + ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.max), VTY_NEWLINE); vty_out(vty, " Channel Mode / Codec: %s%s", get_value_string(gsm48_cmode_names, lchan->tch_mode), diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c index 70e566d..f44dffa 100644 --- a/src/osmo-bts-trx/loops.c +++ b/src/osmo-bts-trx/loops.c @@ -63,11 +63,11 @@ lchan->ms_power_ctrl.current, gsm_band_name(band)); return; } - bsc_max_dbm = ms_pwr_dbm(band, lchan->ms_power); + bsc_max_dbm = ms_pwr_dbm(band, lchan->ms_power_ctrl.max); if (bsc_max_dbm < 0) { LOGPLCHAN(lchan, DLOOP, LOGL_NOTICE, "Failed to calculate dBm for power ctl level %" PRIu8 " on band %s\n", - lchan->ms_power, gsm_band_name(band)); + lchan->ms_power_ctrl.max, gsm_band_name(band)); return; } diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c index 58f4781..ab2cb76 100644 --- a/src/osmo-bts-virtual/l1_if.c +++ b/src/osmo-bts-virtual/l1_if.c @@ -320,7 +320,7 @@ DEBUGPFN(DMEAS, fn, "RX L1 frame %s chan_nr=0x%02x MS pwr=%ddBm rssi=%.1f dBFS " "ber=%.2f%% (%d/%d bits) L1_ta=%d rqd_ta=%d toa=%.2f\n", - gsm_lchan_name(lchan), chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), + gsm_lchan_name(lchan), chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.max), rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], lchan->rqd_ta, toa); l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/16062 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ib264ec7dac87355cef6415461ed74bd8e9c8ca52 Gerrit-Change-Number: 16062 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-MessageType: newchange