2021-04-04 18:39:16 +00:00
|
|
|
/* Osmocom OsmoBTS specific code */
|
2012-07-02 17:51:55 +00:00
|
|
|
|
|
|
|
/* (C) 2010-2012 by Harald Welte <laforge@gnumonks.org>
|
power_control: implement BCCH carrier power reduction operation
The BCCH carrier (sometimes called C0) of a BTS shall maintain
discontinuous Downlink transmission at full power in order to
stay 'visible' to the mobile stations. Because of that, early
versions of 3GPP TS 45.008 prohibited BS power reduction on C0.
However, starting from version 13.0.0 (2015-11) there is a feature
called 'BCCH carrier power reduction operation'. This is a special
mode of operation, where the variation of RF level for some
timeslots is relaxed for the purpose of energy saving.
In BCCH carrier power reduction operation, for timeslots on the
C0 carrier, except timeslots carrying BCCH/CCCH, the output power
may be lower than the output power used for timeslots carrying
BCCH/CCCH. In this case the maximum allowed difference in output
power actually transmitted by the BTS is 6 dB.
Introduce a VTY command to turn on and off the BCCH carrier power
reduction operation. Also introduce a CTRL command. On the
A-bis/RSL, abuse the BS POWER CONTROL message by setting
the Channel Number IE to 0x80 (RSL_CHAN_BCCH).
Currently, only osmo-bts-trx is supported. A value greater than
zero makes it reduce the power on *inactive* timeslots of the
BCCH carrier. Sending zero disables the BCCH power reduction
mode completely.
For more details, see 3GPP TS 45.008, section 7.1, and 3GPP TR 45.926.
Change-Id: I047fce33d4d3e4c569dd006ba17858467a2f4783
Related: SYS#4919
2021-06-21 19:55:46 +00:00
|
|
|
* (C) 2021 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
|
2012-07-02 17:51:55 +00:00
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
|
|
|
#include <osmocom/gsm/tlv.h>
|
|
|
|
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/gsm_data.h>
|
|
|
|
#include <osmocom/bsc/signal.h>
|
|
|
|
#include <osmocom/bsc/abis_nm.h>
|
2020-07-15 18:53:16 +00:00
|
|
|
#include <osmocom/bsc/bts.h>
|
2012-07-02 17:51:55 +00:00
|
|
|
#include <osmocom/abis/e1_input.h>
|
|
|
|
#include <osmocom/gsm/tlv.h>
|
|
|
|
#include <osmocom/core/msgb.h>
|
|
|
|
#include <osmocom/core/talloc.h>
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/gsm_data.h>
|
|
|
|
#include <osmocom/bsc/abis_nm.h>
|
|
|
|
#include <osmocom/bsc/abis_rsl.h>
|
|
|
|
#include <osmocom/bsc/debug.h>
|
2012-07-02 17:51:55 +00:00
|
|
|
#include <osmocom/abis/subchan_demux.h>
|
|
|
|
#include <osmocom/abis/ipaccess.h>
|
|
|
|
#include <osmocom/core/logging.h>
|
|
|
|
|
|
|
|
extern struct gsm_bts_model bts_model_nanobts;
|
|
|
|
|
2021-04-04 18:39:16 +00:00
|
|
|
static struct gsm_bts_model model_osmobts;
|
2012-07-02 17:51:55 +00:00
|
|
|
|
2021-08-26 13:41:17 +00:00
|
|
|
static void enc_osmo_meas_proc_params(struct msgb *msg, const struct gsm_power_ctrl_params *mp)
|
|
|
|
{
|
|
|
|
struct osmo_preproc_ave_cfg *ave_cfg;
|
|
|
|
uint8_t *ie_len;
|
|
|
|
|
|
|
|
/* No averaging => no Measurement Averaging parameters */
|
|
|
|
if (mp->ci_fr_meas.algo == GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE &&
|
|
|
|
mp->ci_hr_meas.algo == GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE &&
|
|
|
|
mp->ci_amr_fr_meas.algo == GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE &&
|
|
|
|
mp->ci_amr_hr_meas.algo == GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE &&
|
|
|
|
mp->ci_sdcch_meas.algo == GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE &&
|
|
|
|
mp->ci_gprs_meas.algo == GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* (TLV) Measurement Averaging parameters for RxLev/RxQual */
|
|
|
|
ie_len = msgb_tl_put(msg, RSL_IPAC_EIE_OSMO_MEAS_AVG_CFG);
|
|
|
|
|
|
|
|
ave_cfg = (struct osmo_preproc_ave_cfg *) msgb_put(msg, sizeof(*ave_cfg));
|
|
|
|
|
|
|
|
#define ENC_PROC(PARAMS, TO, TYPE) do { \
|
|
|
|
(TO)->TYPE.ave_enabled = (PARAMS)->TYPE##_meas.algo != GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE; \
|
|
|
|
if ((TO)->TYPE.ave_enabled) { \
|
|
|
|
/* H_REQAVE and H_REQT */ \
|
|
|
|
(TO)->TYPE.h_reqave = (PARAMS)->TYPE##_meas.h_reqave & 0x1f; \
|
|
|
|
(TO)->TYPE.h_reqt = (PARAMS)->TYPE##_meas.h_reqt & 0x1f; \
|
|
|
|
/* Averaging method and parameters */ \
|
|
|
|
(TO)->TYPE.ave_method = ((PARAMS)->TYPE##_meas.algo - 1) & 0x07; \
|
|
|
|
switch ((PARAMS)->TYPE##_meas.algo) { \
|
|
|
|
case GSM_PWR_CTRL_MEAS_AVG_ALGO_OSMO_EWMA: \
|
|
|
|
msgb_v_put(msg, (PARAMS)->TYPE##_meas.ewma.alpha); \
|
|
|
|
break; \
|
|
|
|
case GSM_PWR_CTRL_MEAS_AVG_ALGO_WEIGHTED: \
|
|
|
|
case GSM_PWR_CTRL_MEAS_AVG_ALGO_MOD_MEDIAN: \
|
|
|
|
/* FIXME: unknown format */ \
|
|
|
|
break; \
|
|
|
|
case GSM_PWR_CTRL_MEAS_AVG_ALGO_UNWEIGHTED: \
|
|
|
|
case GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE: \
|
|
|
|
/* No parameters here */ \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
ENC_PROC(mp, ave_cfg, ci_fr);
|
|
|
|
ENC_PROC(mp, ave_cfg, ci_hr);
|
|
|
|
ENC_PROC(mp, ave_cfg, ci_amr_fr);
|
|
|
|
ENC_PROC(mp, ave_cfg, ci_amr_hr);
|
|
|
|
ENC_PROC(mp, ave_cfg, ci_sdcch);
|
|
|
|
ENC_PROC(mp, ave_cfg, ci_gprs);
|
|
|
|
#undef ENC_PROC
|
|
|
|
|
|
|
|
/* Update length part of the containing IE */
|
|
|
|
*ie_len = msg->tail - (ie_len + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Appends Osmocom specific extension IEs into RSL_IE_MS_POWER_PARAM */
|
|
|
|
void osmobts_enc_power_params_osmo_ext(struct msgb *msg, const struct gsm_power_ctrl_params *cp)
|
|
|
|
{
|
|
|
|
struct osmo_preproc_pc_thresh *osmo_thresh;
|
|
|
|
struct osmo_preproc_pc_comp *osmo_thresh_comp;
|
|
|
|
uint8_t *ie_len;
|
|
|
|
|
|
|
|
/* (TLV) Measurement Averaging Configure (C/I) */
|
|
|
|
enc_osmo_meas_proc_params(msg, cp);
|
|
|
|
|
|
|
|
/* (TLV) Thresholds (C/I) */
|
|
|
|
ie_len = msgb_tl_put(msg, RSL_IPAC_EIE_OSMO_MS_PWR_CTL);
|
|
|
|
osmo_thresh = (struct osmo_preproc_pc_thresh *) msgb_put(msg, sizeof(*osmo_thresh));
|
|
|
|
#define ENC_THRESH_CI(TYPE) \
|
2021-09-27 10:01:14 +00:00
|
|
|
do { \
|
|
|
|
if (cp->TYPE##_meas.enabled) { \
|
|
|
|
osmo_thresh->l_##TYPE = cp->TYPE##_meas.lower_thresh; \
|
|
|
|
osmo_thresh->u_##TYPE = cp->TYPE##_meas.upper_thresh; \
|
|
|
|
} else { \
|
|
|
|
osmo_thresh->l_##TYPE = 0; \
|
|
|
|
osmo_thresh->u_##TYPE = 0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2021-08-26 13:41:17 +00:00
|
|
|
ENC_THRESH_CI(ci_fr);
|
|
|
|
ENC_THRESH_CI(ci_hr);
|
|
|
|
ENC_THRESH_CI(ci_amr_fr);
|
|
|
|
ENC_THRESH_CI(ci_amr_hr);
|
|
|
|
ENC_THRESH_CI(ci_sdcch);
|
|
|
|
ENC_THRESH_CI(ci_gprs);
|
|
|
|
#undef ENC_THRESH_CI
|
|
|
|
/* Update length part of the containing IE */
|
|
|
|
*ie_len = msg->tail - (ie_len + 1);
|
|
|
|
|
|
|
|
/* (TLV) PC Threshold Comparators (C/I) */
|
|
|
|
ie_len = msgb_tl_put(msg, RSL_IPAC_EIE_OSMO_PC_THRESH_COMP);
|
|
|
|
osmo_thresh_comp = (struct osmo_preproc_pc_comp *) msgb_put(msg, sizeof(*osmo_thresh_comp));
|
|
|
|
#define ENC_THRESH_CI(TYPE) \
|
2021-09-27 10:01:14 +00:00
|
|
|
do { \
|
|
|
|
if (cp->TYPE##_meas.enabled) { \
|
|
|
|
osmo_thresh_comp->TYPE.lower_p = cp->TYPE##_meas.lower_cmp_p & 0x1f; \
|
|
|
|
osmo_thresh_comp->TYPE.lower_n = cp->TYPE##_meas.lower_cmp_n & 0x1f; \
|
|
|
|
osmo_thresh_comp->TYPE.upper_p = cp->TYPE##_meas.upper_cmp_p & 0x1f; \
|
|
|
|
osmo_thresh_comp->TYPE.upper_n = cp->TYPE##_meas.upper_cmp_n & 0x1f; \
|
|
|
|
} else { \
|
|
|
|
osmo_thresh_comp->TYPE.lower_p = 0; \
|
|
|
|
osmo_thresh_comp->TYPE.lower_n = 0; \
|
|
|
|
osmo_thresh_comp->TYPE.upper_p = 0; \
|
|
|
|
osmo_thresh_comp->TYPE.upper_n = 0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2021-08-26 13:41:17 +00:00
|
|
|
ENC_THRESH_CI(ci_fr);
|
|
|
|
ENC_THRESH_CI(ci_hr);
|
|
|
|
ENC_THRESH_CI(ci_amr_fr);
|
|
|
|
ENC_THRESH_CI(ci_amr_hr);
|
|
|
|
ENC_THRESH_CI(ci_sdcch);
|
|
|
|
ENC_THRESH_CI(ci_gprs);
|
|
|
|
#undef ENC_THRESH_CI
|
|
|
|
/* Update length part of the containing IE */
|
|
|
|
*ie_len = msg->tail - (ie_len + 1);
|
|
|
|
}
|
|
|
|
|
power_control: implement BCCH carrier power reduction operation
The BCCH carrier (sometimes called C0) of a BTS shall maintain
discontinuous Downlink transmission at full power in order to
stay 'visible' to the mobile stations. Because of that, early
versions of 3GPP TS 45.008 prohibited BS power reduction on C0.
However, starting from version 13.0.0 (2015-11) there is a feature
called 'BCCH carrier power reduction operation'. This is a special
mode of operation, where the variation of RF level for some
timeslots is relaxed for the purpose of energy saving.
In BCCH carrier power reduction operation, for timeslots on the
C0 carrier, except timeslots carrying BCCH/CCCH, the output power
may be lower than the output power used for timeslots carrying
BCCH/CCCH. In this case the maximum allowed difference in output
power actually transmitted by the BTS is 6 dB.
Introduce a VTY command to turn on and off the BCCH carrier power
reduction operation. Also introduce a CTRL command. On the
A-bis/RSL, abuse the BS POWER CONTROL message by setting
the Channel Number IE to 0x80 (RSL_CHAN_BCCH).
Currently, only osmo-bts-trx is supported. A value greater than
zero makes it reduce the power on *inactive* timeslots of the
BCCH carrier. Sending zero disables the BCCH power reduction
mode completely.
For more details, see 3GPP TS 45.008, section 7.1, and 3GPP TR 45.926.
Change-Id: I047fce33d4d3e4c569dd006ba17858467a2f4783
Related: SYS#4919
2021-06-21 19:55:46 +00:00
|
|
|
static int power_ctrl_set_c0_power_red(const struct gsm_bts *bts,
|
|
|
|
const uint8_t red)
|
|
|
|
{
|
|
|
|
struct abis_rsl_dchan_hdr *dh;
|
|
|
|
struct msgb *msg;
|
|
|
|
|
|
|
|
msg = rsl_msgb_alloc();
|
|
|
|
if (msg == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
LOGP(DRSL, LOGL_NOTICE, "%sabling BCCH carrier power reduction "
|
|
|
|
"operation mode for BTS%u (maximum %u dB)\n",
|
|
|
|
red ? "En" : "Dis", bts->nr, red);
|
|
|
|
|
|
|
|
/* Abuse the standard BS POWER CONTROL message by specifying 'Common Channel'
|
|
|
|
* in the Protocol Discriminator field and 'BCCH' in the Channel Number IE. */
|
|
|
|
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
|
|
|
|
dh->c.msg_discr = ABIS_RSL_MDISC_COM_CHAN;
|
|
|
|
dh->c.msg_type = RSL_MT_BS_POWER_CONTROL;
|
|
|
|
dh->ie_chan = RSL_IE_CHAN_NR;
|
|
|
|
dh->chan_nr = RSL_CHAN_BCCH;
|
|
|
|
|
|
|
|
msgb_tv_put(msg, RSL_IE_BS_POWER, red / 2);
|
|
|
|
|
|
|
|
msg->dst = bts->c0->rsl_link_primary;
|
|
|
|
|
|
|
|
return abis_rsl_sendmsg(msg);
|
|
|
|
}
|
|
|
|
|
2021-04-04 18:39:16 +00:00
|
|
|
int bts_model_osmobts_init(void)
|
2012-07-02 17:51:55 +00:00
|
|
|
{
|
2021-04-04 18:39:16 +00:00
|
|
|
model_osmobts = bts_model_nanobts;
|
|
|
|
model_osmobts.name = "osmo-bts";
|
|
|
|
model_osmobts.type = GSM_BTS_TYPE_OSMOBTS;
|
2013-04-24 08:54:02 +00:00
|
|
|
|
2021-04-04 18:39:16 +00:00
|
|
|
/* Unlike nanoBTS, osmo-bts does support SI2bis and SI2ter fine */
|
|
|
|
model_osmobts.force_combined_si = false;
|
2018-11-19 16:48:17 +00:00
|
|
|
|
power_control: implement BCCH carrier power reduction operation
The BCCH carrier (sometimes called C0) of a BTS shall maintain
discontinuous Downlink transmission at full power in order to
stay 'visible' to the mobile stations. Because of that, early
versions of 3GPP TS 45.008 prohibited BS power reduction on C0.
However, starting from version 13.0.0 (2015-11) there is a feature
called 'BCCH carrier power reduction operation'. This is a special
mode of operation, where the variation of RF level for some
timeslots is relaxed for the purpose of energy saving.
In BCCH carrier power reduction operation, for timeslots on the
C0 carrier, except timeslots carrying BCCH/CCCH, the output power
may be lower than the output power used for timeslots carrying
BCCH/CCCH. In this case the maximum allowed difference in output
power actually transmitted by the BTS is 6 dB.
Introduce a VTY command to turn on and off the BCCH carrier power
reduction operation. Also introduce a CTRL command. On the
A-bis/RSL, abuse the BS POWER CONTROL message by setting
the Channel Number IE to 0x80 (RSL_CHAN_BCCH).
Currently, only osmo-bts-trx is supported. A value greater than
zero makes it reduce the power on *inactive* timeslots of the
BCCH carrier. Sending zero disables the BCCH power reduction
mode completely.
For more details, see 3GPP TS 45.008, section 7.1, and 3GPP TR 45.926.
Change-Id: I047fce33d4d3e4c569dd006ba17858467a2f4783
Related: SYS#4919
2021-06-21 19:55:46 +00:00
|
|
|
/* Power control API */
|
|
|
|
model_osmobts.power_ctrl_set_c0_power_red = &power_ctrl_set_c0_power_red;
|
|
|
|
|
2021-04-04 18:39:16 +00:00
|
|
|
model_osmobts.features.data = &model_osmobts._features_data[0];
|
|
|
|
model_osmobts.features.data_len =
|
|
|
|
sizeof(model_osmobts._features_data);
|
|
|
|
memset(model_osmobts.features.data, 0, model_osmobts.features.data_len);
|
2012-07-02 17:51:55 +00:00
|
|
|
|
2022-04-26 14:53:14 +00:00
|
|
|
/* Adjust bts_init/bts_model_init in OsmoBTS to report new features.
|
|
|
|
* See also: doc/bts-features.txt */
|
2012-07-02 17:51:55 +00:00
|
|
|
|
2021-04-04 18:39:16 +00:00
|
|
|
model_osmobts.nm_att_tlvdef.def[NM_ATT_OSMO_NS_LINK_CFG].type = TLV_TYPE_TL16V;
|
2020-09-21 16:35:24 +00:00
|
|
|
|
2021-04-04 18:39:16 +00:00
|
|
|
return gsm_bts_model_register(&model_osmobts);
|
2012-07-02 17:51:55 +00:00
|
|
|
}
|