diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2020-05-30 00:14:03 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2020-06-11 00:36:21 +0700 |
commit | 578156b815530fbaf14037217197b77edca3fee0 (patch) | |
tree | 6664af7d8bae19643a56e362a42f84c824db4c99 /include | |
parent | ba0e5c7d5091a1c334e23a52b5903bdcecf9798a (diff) |
Do not mix public and private BTS features, use libosmocore's API
It was a very bad idea to mix "public" BTS features, that are
reported to the BSC via OML, and those features, that are used
locally (and exclusively) in osmo-bts.
Why? At least because we already have the BTS feature manipulation
API in libosmocore, that is used by osmo-bsc, but for some reason
not by osmo-bts. New features added to libosmocore would clash
with the existing "internal" ones like BTS_FEAT_MS_PWR_CTRL_DSP.
So what this change does can be described as follows:
- remove duplicate definition of the "public" features,
- use libosmocore's API for the "public" features,
- separate both "internal" and "public" features:
- the "public" features continue to live in bitvec,
- the "internal" features become flags,
- s/BTS_FEAT/BTS_INTERNAL_FLAG/g.
Change-Id: Icf792d02323bb73e3b8d46384c7890cb1eb4731e
Diffstat (limited to 'include')
-rw-r--r-- | include/osmo-bts/gsm_data_shared.h | 61 |
1 files changed, 18 insertions, 43 deletions
diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h index f3855f7b..7cfbfeb2 100644 --- a/include/osmo-bts/gsm_data_shared.h +++ b/include/osmo-bts/gsm_data_shared.h @@ -14,6 +14,7 @@ #include <osmocom/gsm/rxlev_stat.h> #include <osmocom/gsm/sysinfo.h> #include <osmocom/gsm/meas_rep.h> +#include <osmocom/gsm/bts_features.h> #include <osmocom/gsm/gsm48_rest_octets.h> #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/protocol/gsm_08_58.h> @@ -38,8 +39,6 @@ #define MAX_VERSION_LENGTH 64 -#define MAX_BTS_FEATURES 128 - struct gsm_lchan; struct osmo_rtp_socket; struct pcu_sock_state; @@ -402,35 +401,21 @@ enum bts_attribute { TRX_PHY_VERSION, }; -/* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility - with BTS compiled against earlier version of this header. Also make sure that the description strings - gsm_bts_features_descs[] in gsm_data_shared.c are also updated accordingly! */ -enum gsm_bts_features { - BTS_FEAT_HSCSD, - BTS_FEAT_GPRS, - BTS_FEAT_EGPRS, - BTS_FEAT_ECSD, - BTS_FEAT_HOPPING, - BTS_FEAT_MULTI_TSC, - BTS_FEAT_OML_ALERTS, - BTS_FEAT_AGCH_PCH_PROP, - BTS_FEAT_CBCH, - BTS_FEAT_SPEECH_F_V1, - BTS_FEAT_SPEECH_H_V1, - BTS_FEAT_SPEECH_F_EFR, - BTS_FEAT_SPEECH_F_AMR, - BTS_FEAT_SPEECH_H_AMR, - BTS_FEAT_ETWS_PN, - BTS_FEAT_MS_PWR_CTRL_DSP, - /* When the feature is set then the measurement data is included in - * (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the - * measurement data is passed using a separate MPH INFO MEAS IND. - * (See also ticket: OS#2977) */ - BTS_FEAT_MEAS_PAYLOAD_COMB, - _NUM_BTS_FEAT -}; +/* BTS implementation flags (internal use, not exposed via OML) */ +#define bts_internal_flag_get(bts, flag) \ + ((bts->flags & (typeof(bts->flags)) flag) != 0) +#define bts_internal_flag_set(bts, flag) \ + bts->flags |= (typeof(bts->flags)) flag + +/* TODO: add a brief description of this flag */ +#define BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP (1 << 0) +/* When this flag is set then the measurement data is included in + * (PRIM_PH_DATA) and struct ph_tch_param (PRIM_TCH). Otherwise the + * measurement data is passed using a separate MPH INFO MEAS IND. + * (See also ticket: OS#2977) */ +#define BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB (1 << 1) -extern const struct value_string gsm_bts_features_descs[]; +extern const struct value_string bts_impl_flag_desc[]; struct gsm_bts_gprs_nsvc { struct gsm_bts *bts; @@ -522,8 +507,10 @@ struct gsm_bts { char version[MAX_VERSION_LENGTH]; char sub_model[MAX_VERSION_LENGTH]; - /* features of a given BTS set/reported via OML */ + /* public features of a given BTS (set/reported via OML) */ struct bitvec *features; + /* implementation flags of a given BTS (not exposed via OML) */ + uint16_t flags; /* Connected PCU version (if any) */ char pcu_version[MAX_VERSION_LENGTH]; @@ -740,18 +727,6 @@ static inline char *gsm_lchan_name(const struct gsm_lchan *lchan) return lchan->name; } -static inline int gsm_bts_set_feature(struct gsm_bts *bts, enum gsm_bts_features feat) -{ - OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); - return bitvec_set_bit_pos(bts->features, feat, 1); -} - -static inline bool gsm_bts_has_feature(const struct gsm_bts *bts, enum gsm_bts_features feat) -{ - OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES); - return bitvec_get_bit_pos(bts->features, feat); -} - void gsm_abis_mo_reset(struct gsm_abis_mo *mo); struct gsm_abis_mo * |