diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index c4ee39daf..cd0f8cbe0 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -12,6 +12,7 @@ #include +#include "osmocom/bsc/power_control.h" #include "osmocom/bsc/gsm_data.h" #include "osmocom/bsc/bts_trx.h" #include "osmocom/bsc/bts_sm.h" diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index fcd888367..4a58c2b68 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1356,98 +1356,6 @@ enum gsm48_rr_cause bsc_gsm48_rr_cause_from_rsl_cause(uint8_t c); int bsc_sccp_inst_next_conn_id(struct osmo_sccp_instance *sccp); -/* MS/BS Power related measurement averaging algo */ -enum gsm_power_ctrl_meas_avg_algo { - GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE = 0x00, - GSM_PWR_CTRL_MEAS_AVG_ALGO_UNWEIGHTED = 0x01, - GSM_PWR_CTRL_MEAS_AVG_ALGO_WEIGHTED = 0x02, - GSM_PWR_CTRL_MEAS_AVG_ALGO_MOD_MEDIAN = 0x03, - /* EWMA is an Osmocom specific algo */ - GSM_PWR_CTRL_MEAS_AVG_ALGO_OSMO_EWMA = 0x04, -}; - -/* MS/BS Power related measurement parameters */ -struct gsm_power_ctrl_meas_params { - /* Are these measurement paremeters to be taken into account by loop? */ - bool enabled; - - /* Thresholds (see 3GPP TS 45.008, section A.3.2.1) */ - uint8_t lower_thresh; /* lower (decreasing) direction */ - uint8_t upper_thresh; /* upper (increasing) direction */ - - /* Threshold Comparators for lower (decreasing) direction */ - uint8_t lower_cmp_p; /* P1 for RxLev, P3 for RxQual */ - uint8_t lower_cmp_n; /* N1 for RxLev, N3 for RxQual */ - /* Threshold Comparators for upper (increasing) direction */ - uint8_t upper_cmp_p; /* P2 for RxLev, P4 for RxQual */ - uint8_t upper_cmp_n; /* N2 for RxLev, N4 for RxQual */ - - /* Hreqave and Hreqt (see 3GPP TS 45.008, Annex A) */ - uint8_t h_reqave; - uint8_t h_reqt; - - /* AVG algorithm and its specific parameters */ - enum gsm_power_ctrl_meas_avg_algo algo; - union { - /* Exponentially Weighted Moving Average */ - struct { - /* Smoothing factor: higher the value - less smoothing */ - uint8_t alpha; /* 1 .. 99 (in %) */ - } ewma; - }; -}; - -enum gsm_power_ctrl_dir { - GSM_PWR_CTRL_DIR_UL, /* MS Power Control */ - GSM_PWR_CTRL_DIR_DL, /* BS Power Control */ -}; - -enum gsm_power_ctrl_mode { - /* Do not send MS/BS Power Control IEs */ - GSM_PWR_CTRL_MODE_NONE = 0, - /* Send MS/BS Power IE only (with target level) */ - GSM_PWR_CTRL_MODE_STATIC, - /* Send MS/BS Power [Parameters] IEs (dynamic mode) */ - GSM_PWR_CTRL_MODE_DYN_BTS, - /* Do not send MS/BS Power IEs and use BSC Power Loop */ - GSM_PWR_CTRL_MODE_DYN_BSC, - -}; - -/* MS/BS Power Control Parameters */ -struct gsm_power_ctrl_params { - /* Power Control direction: Uplink or Downlink */ - enum gsm_power_ctrl_dir dir; - /* Power Control mode to be used by the BTS */ - enum gsm_power_ctrl_mode mode; - - /* BS Power reduction value / maximum (in dB) */ - uint8_t bs_power_val_db; /* for static mode */ - uint8_t bs_power_max_db; /* for dynamic mode */ - - /* Power change step size (dynamic mode only) */ - uint8_t inc_step_size_db; /* increasing direction */ - uint8_t red_step_size_db; /* reducing direction */ - - /* Minimum interval between power level changes */ - uint8_t ctrl_interval; /* 1 step is 2 SACCH periods */ - - /* Measurement averaging parameters for RxLev & RxQual */ - struct gsm_power_ctrl_meas_params rxqual_meas; - struct gsm_power_ctrl_meas_params rxlev_meas; - /* Measurement averaging parameters for C/I: */ - struct gsm_power_ctrl_meas_params ci_fr_meas; - struct gsm_power_ctrl_meas_params ci_hr_meas; - struct gsm_power_ctrl_meas_params ci_amr_fr_meas; - struct gsm_power_ctrl_meas_params ci_amr_hr_meas; - struct gsm_power_ctrl_meas_params ci_sdcch_meas; - struct gsm_power_ctrl_meas_params ci_gprs_meas; -}; - -extern const struct gsm_power_ctrl_params power_ctrl_params_def; -void power_ctrl_params_def_reset(struct gsm_power_ctrl_params *params, - enum gsm_power_ctrl_dir dir); - /* Interference Measurement Parameters */ struct gsm_interf_meas_params { /* Intave: Interference Averaging period (see 3GPP TS 45.008, table A.1) */ diff --git a/include/osmocom/bsc/power_control.h b/include/osmocom/bsc/power_control.h index 82cbcb096..2eb23e7e2 100644 --- a/include/osmocom/bsc/power_control.h +++ b/include/osmocom/bsc/power_control.h @@ -5,3 +5,95 @@ #include int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan, const struct gsm_meas_rep *mr); + +/* MS/BS Power related measurement averaging algo */ +enum gsm_power_ctrl_meas_avg_algo { + GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE = 0x00, + GSM_PWR_CTRL_MEAS_AVG_ALGO_UNWEIGHTED = 0x01, + GSM_PWR_CTRL_MEAS_AVG_ALGO_WEIGHTED = 0x02, + GSM_PWR_CTRL_MEAS_AVG_ALGO_MOD_MEDIAN = 0x03, + /* EWMA is an Osmocom specific algo */ + GSM_PWR_CTRL_MEAS_AVG_ALGO_OSMO_EWMA = 0x04, +}; + +/* MS/BS Power related measurement parameters */ +struct gsm_power_ctrl_meas_params { + /* Are these measurement paremeters to be taken into account by loop? */ + bool enabled; + + /* Thresholds (see 3GPP TS 45.008, section A.3.2.1) */ + uint8_t lower_thresh; /* lower (decreasing) direction */ + uint8_t upper_thresh; /* upper (increasing) direction */ + + /* Threshold Comparators for lower (decreasing) direction */ + uint8_t lower_cmp_p; /* P1 for RxLev, P3 for RxQual */ + uint8_t lower_cmp_n; /* N1 for RxLev, N3 for RxQual */ + /* Threshold Comparators for upper (increasing) direction */ + uint8_t upper_cmp_p; /* P2 for RxLev, P4 for RxQual */ + uint8_t upper_cmp_n; /* N2 for RxLev, N4 for RxQual */ + + /* Hreqave and Hreqt (see 3GPP TS 45.008, Annex A) */ + uint8_t h_reqave; + uint8_t h_reqt; + + /* AVG algorithm and its specific parameters */ + enum gsm_power_ctrl_meas_avg_algo algo; + union { + /* Exponentially Weighted Moving Average */ + struct { + /* Smoothing factor: higher the value - less smoothing */ + uint8_t alpha; /* 1 .. 99 (in %) */ + } ewma; + }; +}; + +enum gsm_power_ctrl_dir { + GSM_PWR_CTRL_DIR_UL, /* MS Power Control */ + GSM_PWR_CTRL_DIR_DL, /* BS Power Control */ +}; + +enum gsm_power_ctrl_mode { + /* Do not send MS/BS Power Control IEs */ + GSM_PWR_CTRL_MODE_NONE = 0, + /* Send MS/BS Power IE only (with target level) */ + GSM_PWR_CTRL_MODE_STATIC, + /* Send MS/BS Power [Parameters] IEs (dynamic mode) */ + GSM_PWR_CTRL_MODE_DYN_BTS, + /* Do not send MS/BS Power IEs and use BSC Power Loop */ + GSM_PWR_CTRL_MODE_DYN_BSC, + +}; + +/* MS/BS Power Control Parameters */ +struct gsm_power_ctrl_params { + /* Power Control direction: Uplink or Downlink */ + enum gsm_power_ctrl_dir dir; + /* Power Control mode to be used by the BTS */ + enum gsm_power_ctrl_mode mode; + + /* BS Power reduction value / maximum (in dB) */ + uint8_t bs_power_val_db; /* for static mode */ + uint8_t bs_power_max_db; /* for dynamic mode */ + + /* Power change step size (dynamic mode only) */ + uint8_t inc_step_size_db; /* increasing direction */ + uint8_t red_step_size_db; /* reducing direction */ + + /* Minimum interval between power level changes */ + uint8_t ctrl_interval; /* 1 step is 2 SACCH periods */ + + /* Measurement averaging parameters for RxLev & RxQual */ + struct gsm_power_ctrl_meas_params rxqual_meas; + struct gsm_power_ctrl_meas_params rxlev_meas; + /* Measurement averaging parameters for C/I: */ + struct gsm_power_ctrl_meas_params ci_fr_meas; + struct gsm_power_ctrl_meas_params ci_hr_meas; + struct gsm_power_ctrl_meas_params ci_amr_fr_meas; + struct gsm_power_ctrl_meas_params ci_amr_hr_meas; + struct gsm_power_ctrl_meas_params ci_sdcch_meas; + struct gsm_power_ctrl_meas_params ci_gprs_meas; +}; + +extern const struct gsm_power_ctrl_params power_ctrl_params_def; +void power_ctrl_params_def_reset(struct gsm_power_ctrl_params *params, + enum gsm_power_ctrl_dir dir); diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 5fba05f4d..28b2a1d53 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -1129,221 +1129,6 @@ const struct gsm_interf_meas_params interf_meas_params_def = { }, }; -/* Default MS/BS Power Control parameters (see 3GPP TS 45.008, table A.1) */ -const struct gsm_power_ctrl_params power_ctrl_params_def = { - /* Static Power Control is the safe default */ - .mode = GSM_PWR_CTRL_MODE_STATIC, - - /* BS Power reduction value / maximum (in dB) */ - .bs_power_val_db = 0, /* no attenuation in static mode */ - .bs_power_max_db = 12, /* up to 12 dB in dynamic mode */ - - /* Power increasing/reducing step size */ - .inc_step_size_db = 4, /* 2, 4, or 6 dB */ - .red_step_size_db = 2, /* 2 or 4 dB */ - - /* RxLev measurement parameters */ - .rxlev_meas = { - .enabled = true, - /* Thresholds for RxLev (see 3GPP TS 45.008, A.3.2.1) */ - .lower_thresh = 32, /* L_RXLEV_XX_P (-78 dBm) */ - .upper_thresh = 38, /* U_RXLEV_XX_P (-72 dBm) */ - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_RXLEV_XX_P */ - .lower_cmp_p = 10, /* P1 as in 3GPP TS 45.008, A.3.2.1 (case a) */ - .lower_cmp_n = 12, /* N1 as in 3GPP TS 45.008, A.3.2.1 (case a) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_RXLEV_XX_P */ - .upper_cmp_p = 19, /* P2 as in 3GPP TS 45.008, A.3.2.1 (case b) */ - .upper_cmp_n = 20, /* N2 as in 3GPP TS 45.008, A.3.2.1 (case b) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, - - /* RxQual measurement parameters */ - .rxqual_meas = { - .enabled = true, - /* Thresholds for RxQual (see 3GPP TS 45.008, A.3.2.1) */ - .lower_thresh = 3, /* L_RXQUAL_XX_P (0.8% <= BER < 1.6%) */ - .upper_thresh = 0, /* U_RXQUAL_XX_P (BER < 0.2%) */ - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_RXQUAL_XX_P */ - .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_RXQUAL_XX_P */ - .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, - - /* C/I measurement parameters. - * Target C/I retrieved from "GSM/EDGE: Evolution and Performance" Table 10.3. - * Set lower and upper so that (lower + upper) / 2 is equal or slightly - * above the target. - */ - .ci_fr_meas = { /* FR: Target C/I = 15 dB, Soft blocking threshold = 10 dB */ - .enabled = false, - .lower_thresh = 13, - .upper_thresh = 17, - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_CI_FR_XX_P */ - .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_CI_FR_XX_P */ - .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, - .ci_hr_meas = { /* HR: Target C/I = 18 dB, Soft blocking threshold = 13 dB */ - .enabled = false, - .lower_thresh = 16, - .upper_thresh = 21, - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_CI_HR_XX_P */ - .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_CI_HR_XX_P */ - .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, - .ci_amr_fr_meas = { /* AMR-FR: Target C/I = 9 dB, Soft blocking threshold = 4 dB */ - .enabled = false, - .lower_thresh = 7, - .upper_thresh = 11, - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_CI_AMR_FR_XX_P */ - .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_CI_AMR_FR_XX_P */ - .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, - .ci_amr_hr_meas = { /* AMR-HR: Target C/I = 15 dB, Soft blocking threshold = 10 dB */ - .enabled = false, - .lower_thresh = 13, - .upper_thresh = 17, - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_CI_AMR_HR_XX_P */ - .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_CI_AMR_HR_XX_P */ - .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, - .ci_sdcch_meas = { /* SDCCH: Target C/I = 14 dB, Soft blocking threshold = 9 dB */ - .enabled = false, - .lower_thresh = 12, - .upper_thresh = 16, - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_CI_SDCCH_XX_P */ - .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_CI_SDCCH_XX_P */ - .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, - .ci_gprs_meas = { /* GPRS: Target C/I = 20 dB, Soft blocking threshold = 15 dB */ - .enabled = false, - .lower_thresh = 18, - .upper_thresh = 24, - - /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages - * out of LOWER_CMP_N averages are lower than L_CI_GPRS_XX_P */ - .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ - /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages - * out of UPPER_CMP_N averages are greater than L_CI_GPRS_XX_P */ - .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ - - /* No averaging (filtering) by default */ - .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, - - /* Hreqave: the period over which an average is produced */ - .h_reqave = 4, /* TODO: investigate a reasonable default value */ - /* Hreqt: the number of averaged results maintained */ - .h_reqt = 6, /* TODO: investigate a reasonable default value */ - }, -}; - -void power_ctrl_params_def_reset(struct gsm_power_ctrl_params *params, - enum gsm_power_ctrl_dir dir) -{ - *params = power_ctrl_params_def; - params->dir = dir; - - /* Trigger loop every N-th SACCH block. See 3GPP TS 45.008 section 4.7.1. */ - if (dir == GSM_PWR_CTRL_DIR_UL) - params->ctrl_interval = 2; /* N=4 (1.92s) */ - else - params->ctrl_interval = 1; /* N=2 (0.960) */ -} - enum rsl_cmod_spd chan_mode_to_rsl_cmod_spd(enum gsm48_chan_mode chan_mode) { switch (gsm48_chan_mode_to_non_vamos(chan_mode)) { diff --git a/src/osmo-bsc/power_control.c b/src/osmo-bsc/power_control.c index 6fe445544..e26b0d6f2 100644 --- a/src/osmo-bsc/power_control.c +++ b/src/osmo-bsc/power_control.c @@ -259,3 +259,218 @@ int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan, const struct gsm_meas_rep *mr) return 1; } + +/* Default MS/BS Power Control parameters (see 3GPP TS 45.008, table A.1) */ +const struct gsm_power_ctrl_params power_ctrl_params_def = { + /* Static Power Control is the safe default */ + .mode = GSM_PWR_CTRL_MODE_STATIC, + + /* BS Power reduction value / maximum (in dB) */ + .bs_power_val_db = 0, /* no attenuation in static mode */ + .bs_power_max_db = 12, /* up to 12 dB in dynamic mode */ + + /* Power increasing/reducing step size */ + .inc_step_size_db = 4, /* 2, 4, or 6 dB */ + .red_step_size_db = 2, /* 2 or 4 dB */ + + /* RxLev measurement parameters */ + .rxlev_meas = { + .enabled = true, + /* Thresholds for RxLev (see 3GPP TS 45.008, A.3.2.1) */ + .lower_thresh = 32, /* L_RXLEV_XX_P (-78 dBm) */ + .upper_thresh = 38, /* U_RXLEV_XX_P (-72 dBm) */ + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_RXLEV_XX_P */ + .lower_cmp_p = 10, /* P1 as in 3GPP TS 45.008, A.3.2.1 (case a) */ + .lower_cmp_n = 12, /* N1 as in 3GPP TS 45.008, A.3.2.1 (case a) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_RXLEV_XX_P */ + .upper_cmp_p = 19, /* P2 as in 3GPP TS 45.008, A.3.2.1 (case b) */ + .upper_cmp_n = 20, /* N2 as in 3GPP TS 45.008, A.3.2.1 (case b) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, + + /* RxQual measurement parameters */ + .rxqual_meas = { + .enabled = true, + /* Thresholds for RxQual (see 3GPP TS 45.008, A.3.2.1) */ + .lower_thresh = 3, /* L_RXQUAL_XX_P (0.8% <= BER < 1.6%) */ + .upper_thresh = 0, /* U_RXQUAL_XX_P (BER < 0.2%) */ + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_RXQUAL_XX_P */ + .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_RXQUAL_XX_P */ + .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, + + /* C/I measurement parameters. + * Target C/I retrieved from "GSM/EDGE: Evolution and Performance" Table 10.3. + * Set lower and upper so that (lower + upper) / 2 is equal or slightly + * above the target. + */ + .ci_fr_meas = { /* FR: Target C/I = 15 dB, Soft blocking threshold = 10 dB */ + .enabled = false, + .lower_thresh = 13, + .upper_thresh = 17, + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_CI_FR_XX_P */ + .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_CI_FR_XX_P */ + .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, + .ci_hr_meas = { /* HR: Target C/I = 18 dB, Soft blocking threshold = 13 dB */ + .enabled = false, + .lower_thresh = 16, + .upper_thresh = 21, + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_CI_HR_XX_P */ + .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_CI_HR_XX_P */ + .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, + .ci_amr_fr_meas = { /* AMR-FR: Target C/I = 9 dB, Soft blocking threshold = 4 dB */ + .enabled = false, + .lower_thresh = 7, + .upper_thresh = 11, + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_CI_AMR_FR_XX_P */ + .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_CI_AMR_FR_XX_P */ + .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, + .ci_amr_hr_meas = { /* AMR-HR: Target C/I = 15 dB, Soft blocking threshold = 10 dB */ + .enabled = false, + .lower_thresh = 13, + .upper_thresh = 17, + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_CI_AMR_HR_XX_P */ + .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_CI_AMR_HR_XX_P */ + .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, + .ci_sdcch_meas = { /* SDCCH: Target C/I = 14 dB, Soft blocking threshold = 9 dB */ + .enabled = false, + .lower_thresh = 12, + .upper_thresh = 16, + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_CI_SDCCH_XX_P */ + .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_CI_SDCCH_XX_P */ + .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, + .ci_gprs_meas = { /* GPRS: Target C/I = 20 dB, Soft blocking threshold = 15 dB */ + .enabled = false, + .lower_thresh = 18, + .upper_thresh = 24, + + /* Increase {UL,DL}_TXPWR if at least LOWER_CMP_P averages + * out of LOWER_CMP_N averages are lower than L_CI_GPRS_XX_P */ + .lower_cmp_p = 5, /* P3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + .lower_cmp_n = 7, /* N3 as in 3GPP TS 45.008, A.3.2.1 (case c) */ + /* Decrease {UL,DL}_TXPWR if at least UPPER_CMP_P averages + * out of UPPER_CMP_N averages are greater than L_CI_GPRS_XX_P */ + .upper_cmp_p = 15, /* P4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + .upper_cmp_n = 18, /* N4 as in 3GPP TS 45.008, A.3.2.1 (case d) */ + + /* No averaging (filtering) by default */ + .algo = GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE, + + /* Hreqave: the period over which an average is produced */ + .h_reqave = 4, /* TODO: investigate a reasonable default value */ + /* Hreqt: the number of averaged results maintained */ + .h_reqt = 6, /* TODO: investigate a reasonable default value */ + }, +}; + +void power_ctrl_params_def_reset(struct gsm_power_ctrl_params *params, + enum gsm_power_ctrl_dir dir) +{ + *params = power_ctrl_params_def; + params->dir = dir; + + /* Trigger loop every N-th SACCH block. See 3GPP TS 45.008 section 4.7.1. */ + if (dir == GSM_PWR_CTRL_DIR_UL) + params->ctrl_interval = 2; /* N=4 (1.92s) */ + else + params->ctrl_interval = 1; /* N=2 (0.960) */ +}