From c693067b7e99a643da673cb3e2a36162cbd0f59c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 14 Nov 2019 16:27:25 +0100 Subject: Introduce BTS feature BTS_FEAT_MS_PWR_CTRL_DSP It indicates whether BTS model supports managing an MS Power Control Loop over HW/DSP instead of using the software based osmocom algorithm present in osmo-bts. osmo-bts-trx own loop implementation is considered to be a "DSP/HW" one since it acts on lower layers and interferes with osmocom algorithm since it controls the same end variable "lchan->ms_power_ctrl.current", this way we make sure both aren't enabled at the same time. Old behavior in kept: if common upper-layer algo is not enabled explicitly in VTY (ms-power-control osmo) and bts-trx specific lower layer algo is neither enabled (osmotrx ms-power-loop ), then no power control is done at all. Related: OS#1851 Change-Id: I49706926b1e962b18791174627bc3cc0cd0cd9d5 --- src/common/bts.c | 4 ++++ src/common/gsm_data_shared.c | 1 + src/common/vty.c | 8 +++++++- src/osmo-bts-litecell15/main.c | 1 + src/osmo-bts-oc2g/main.c | 1 + src/osmo-bts-sysmo/main.c | 1 + src/osmo-bts-trx/loops.c | 9 ++++++--- src/osmo-bts-trx/main.c | 1 + 8 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/common/bts.c b/src/common/bts.c index 3809eb3e..da411761 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -256,6 +256,10 @@ int bts_trx_init(struct gsm_bts_trx *trx) tpp->ramp.step_size_mdB = to_mdB(2); tpp->ramp.step_interval_sec = 1; + /* IF BTS model doesn't DSP/HW support MS Power Control Loop, enable osmo algo by default: */ + if (!gsm_bts_has_feature(trx->bts, BTS_FEAT_MS_PWR_CTRL_DSP)) + trx->ms_pwr_ctl_soft = true; + rc = bts_model_trx_init(trx); if (rc < 0) { llist_del(&trx->list); diff --git a/src/common/gsm_data_shared.c b/src/common/gsm_data_shared.c index 80acabcb..b31d458b 100644 --- a/src/common/gsm_data_shared.c +++ b/src/common/gsm_data_shared.c @@ -108,6 +108,7 @@ const struct value_string gsm_bts_features_descs[] = { { BTS_FEAT_SPEECH_F_AMR, "Fullrate speech AMR" }, { BTS_FEAT_SPEECH_H_AMR, "Halfrate speech AMR" }, { BTS_FEAT_ETWS_PN, "ETWS Primary Notification on PCH" }, + { BTS_FEAT_MS_PWR_CTRL_DSP, "DSP/HW based MS Power Control Loop" }, { 0, NULL } }; diff --git a/src/common/vty.c b/src/common/vty.c index 514d1202..2558ba85 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -789,8 +789,14 @@ DEFUN(cfg_trx_ms_power_control, cfg_trx_ms_power_control_cmd, "Handled by DSP\n" "Handled by OsmoBTS\n") { struct gsm_bts_trx *trx = vty->index; + bool soft = !strcmp(argv[0], "osmo"); - trx->ms_pwr_ctl_soft = !strcmp(argv[0], "osmo"); + if (!soft && !gsm_bts_has_feature(trx->bts, BTS_FEAT_MS_PWR_CTRL_DSP)) { + vty_out(vty, "This BTS model has no DSP/HW MS Power Control support%s", VTY_NEWLINE); + return CMD_WARNING; + } + + trx->ms_pwr_ctl_soft = soft; return CMD_SUCCESS; } diff --git a/src/osmo-bts-litecell15/main.c b/src/osmo-bts-litecell15/main.c index b0d725b8..6f3fc006 100644 --- a/src/osmo-bts-litecell15/main.c +++ b/src/osmo-bts-litecell15/main.c @@ -112,6 +112,7 @@ int bts_model_init(struct gsm_bts *bts) gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_EFR); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_AMR); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_AMR); + gsm_bts_set_feature(bts, BTS_FEAT_MS_PWR_CTRL_DSP); bts_model_vty_init(bts); diff --git a/src/osmo-bts-oc2g/main.c b/src/osmo-bts-oc2g/main.c index cbf5c420..f9bb0cb1 100644 --- a/src/osmo-bts-oc2g/main.c +++ b/src/osmo-bts-oc2g/main.c @@ -120,6 +120,7 @@ int bts_model_init(struct gsm_bts *bts) gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_EFR); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_AMR); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_AMR); + gsm_bts_set_feature(bts, BTS_FEAT_MS_PWR_CTRL_DSP); bts_model_vty_init(bts); diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c index ad7118ae..bb2c4363 100644 --- a/src/osmo-bts-sysmo/main.c +++ b/src/osmo-bts-sysmo/main.c @@ -86,6 +86,7 @@ int bts_model_init(struct gsm_bts *bts) gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_EFR); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_AMR); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_AMR); + gsm_bts_set_feature(bts, BTS_FEAT_MS_PWR_CTRL_DSP); bts_model_vty_init(bts); diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c index 1f54feec..e73d842c 100644 --- a/src/osmo-bts-trx/loops.c +++ b/src/osmo-bts-trx/loops.c @@ -237,8 +237,9 @@ void trx_loop_sacch_input(struct l1sched_trx *l1t, uint8_t chan_nr, .lchan[l1sap_chan2ss(chan_nr)]; struct phy_instance *pinst = trx_phy_instance(l1t->trx); - /* if MS power control loop is enabled, handle it */ - if (pinst->phy_link->u.osmotrx.trx_ms_power_loop) + /* if common upper layer MS power control loop is disabled + and lower layer MS power control loop is enabled, handle it */ + if (!l1t->trx->ms_pwr_ctl_soft && pinst->phy_link->u.osmotrx.trx_ms_power_loop) ms_power_val(lchan, chan_state, rssi); /* if TA loop is enabled, handle it */ @@ -257,7 +258,9 @@ void trx_loop_sacch_clock(struct l1sched_trx *l1t, uint8_t chan_nr, if (lchan->ms_power_ctrl.fixed) return; - if (pinst->phy_link->u.osmotrx.trx_ms_power_loop) + /* if common upper layer MS power control loop is disabled + and lower layer MS power control loop is enabled, handle it */ + if (!l1t->trx->ms_pwr_ctl_soft && pinst->phy_link->u.osmotrx.trx_ms_power_loop) ms_power_clock(lchan, chan_state); /* count the number of SACCH clocks */ diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c index cf40ea3f..9a29b3b2 100644 --- a/src/osmo-bts-trx/main.c +++ b/src/osmo-bts-trx/main.c @@ -116,6 +116,7 @@ int bts_model_init(struct gsm_bts *bts) gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_AMR); gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_AMR); gsm_bts_set_feature(bts, BTS_FEAT_CBCH); + gsm_bts_set_feature(bts, BTS_FEAT_MS_PWR_CTRL_DSP); bts_model_vty_init(bts); -- cgit v1.2.3