aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-05-30 00:14:03 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-06-11 00:36:21 +0700
commit578156b815530fbaf14037217197b77edca3fee0 (patch)
tree6664af7d8bae19643a56e362a42f84c824db4c99 /src
parentba0e5c7d5091a1c334e23a52b5903bdcecf9798a (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 'src')
-rw-r--r--src/common/bts.c8
-rw-r--r--src/common/gsm_data_shared.c21
-rw-r--r--src/common/l1sap.c8
-rw-r--r--src/common/vty.c24
-rw-r--r--src/osmo-bts-litecell15/main.c21
-rw-r--r--src/osmo-bts-oc2g/main.c21
-rw-r--r--src/osmo-bts-octphy/l1_if.c10
-rw-r--r--src/osmo-bts-sysmo/main.c25
-rw-r--r--src/osmo-bts-trx/main.c21
-rw-r--r--src/osmo-bts-virtual/main.c14
10 files changed, 88 insertions, 85 deletions
diff --git a/src/common/bts.c b/src/common/bts.c
index 9710a2ce..d8a6ff28 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -194,7 +194,7 @@ int bts_init(struct gsm_bts *bts)
osmo_rtp_init(tall_rtp_ctx);
/* features implemented in 'common', available for all models */
- gsm_bts_set_feature(bts, BTS_FEAT_ETWS_PN);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_ETWS_PN);
rc = bts_model_init(bts);
if (rc < 0) {
@@ -258,7 +258,7 @@ int bts_trx_init(struct gsm_bts_trx *trx)
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))
+ if (!bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP))
trx->ms_pwr_ctl_soft = true;
rc = bts_model_trx_init(trx);
@@ -797,7 +797,7 @@ struct gsm_time *get_time(struct gsm_bts *bts)
int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
enum gsm48_chan_mode cm)
{
- enum gsm_bts_features feature = _NUM_BTS_FEAT;
+ enum osmo_bts_features feature = _NUM_BTS_FEAT;
/* We assume that signalling support is mandatory,
* there is no BTS_FEAT_* definition to check that. */
@@ -845,7 +845,7 @@ int bts_supports_cm(struct gsm_bts *bts, enum gsm_phys_chan_config pchan,
}
/* Check if the feature is supported by this BTS */
- if (gsm_bts_has_feature(bts, feature))
+ if (osmo_bts_has_feature(bts->features, feature))
return 1;
return 0;
diff --git a/src/common/gsm_data_shared.c b/src/common/gsm_data_shared.c
index e23b04b3..c6800016 100644
--- a/src/common/gsm_data_shared.c
+++ b/src/common/gsm_data_shared.c
@@ -92,24 +92,9 @@ const char *btsvariant2str(enum gsm_bts_type_variant v)
return get_value_string(osmo_bts_variant_names, v);
}
-const struct value_string gsm_bts_features_descs[] = {
- { BTS_FEAT_HSCSD, "HSCSD" },
- { BTS_FEAT_GPRS, "GPRS" },
- { BTS_FEAT_EGPRS, "EGPRS" },
- { BTS_FEAT_ECSD, "ECSD" },
- { BTS_FEAT_HOPPING, "Frequency Hopping" },
- { BTS_FEAT_MULTI_TSC, "Multi-TSC" },
- { BTS_FEAT_OML_ALERTS, "OML Alerts" },
- { BTS_FEAT_AGCH_PCH_PROP, "AGCH/PCH proportional allocation" },
- { BTS_FEAT_CBCH, "CBCH" },
- { BTS_FEAT_SPEECH_F_V1, "Fullrate speech V1" },
- { BTS_FEAT_SPEECH_H_V1, "Halfrate speech V1" },
- { BTS_FEAT_SPEECH_F_EFR, "Fullrate speech EFR" },
- { 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" },
- { BTS_FEAT_MEAS_PAYLOAD_COMB, "Measurement and Payload data combined"},
+const struct value_string bts_impl_flag_desc[] = {
+ { BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP, "DSP/HW based MS Power Control Loop" },
+ { BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB, "Measurement and Payload data combined" },
{ 0, NULL }
};
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 84d4859d..dad1b494 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -757,8 +757,8 @@ static int l1sap_mph_info_ind(struct gsm_bts_trx *trx,
break;
case PRIM_INFO_MEAS:
/* We should never get an INFO_IND with PRIM_INFO_MEAS
- * when BTS_FEAT_MEAS_PAYLOAD_COMB is enabled */
- if (gsm_bts_has_feature(trx->bts, BTS_FEAT_MEAS_PAYLOAD_COMB))
+ * when BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB is set */
+ if (bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB))
OSMO_ASSERT(false);
process_l1sap_meas_data(trx, l1sap, PRIM_MPH_INFO);
@@ -1279,7 +1279,7 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx,
/* The ph_data_param contained in the l1sap primitive may contain
* measurement data. If this data is present, forward it for
* processing */
- if (gsm_bts_has_feature(trx->bts, BTS_FEAT_MEAS_PAYLOAD_COMB))
+ if (bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB))
process_l1sap_meas_data(trx, l1sap, PRIM_PH_DATA);
if (ts_is_pdch(&trx->ts[tn])) {
@@ -1399,7 +1399,7 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
/* The ph_tch_param contained in the l1sap primitive may contain
* measurement data. If this data is present, forward it for
* processing */
- if (gsm_bts_has_feature(trx->bts, BTS_FEAT_MEAS_PAYLOAD_COMB))
+ if (bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB))
process_l1sap_meas_data(trx, l1sap, PRIM_TCH);
msgb_pull_to_l2(msg);
diff --git a/src/common/vty.c b/src/common/vty.c
index 1d74b367..3dfd3878 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -766,7 +766,7 @@ DEFUN(cfg_trx_ms_power_control, cfg_trx_ms_power_control_cmd,
struct gsm_bts_trx *trx = vty->index;
bool soft = !strcmp(argv[0], "osmo");
- if (!soft && !gsm_bts_has_feature(trx->bts, BTS_FEAT_MS_PWR_CTRL_DSP)) {
+ if (!soft && !bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP)) {
/* NOTE: osmo-bts-trx used to have its own (low-level) MS Power Control loop, which
* has been ripped out in favour of the common implementation. Configuration files
* may still contain 'dsp', so let's be tolerant and override 'dsp' by 'osmo'. */
@@ -827,13 +827,27 @@ static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
static void bts_dump_vty_features(struct vty *vty, struct gsm_bts *bts)
{
unsigned int i;
- bool no_features = true;
+ bool no_features;
+
vty_out(vty, " Features:%s", VTY_NEWLINE);
- for (i = 0; i < _NUM_BTS_FEAT; i++) {
- if (gsm_bts_has_feature(bts, i)) {
+ for (i = 0, no_features = true; i < _NUM_BTS_FEAT; i++) {
+ if (osmo_bts_has_feature(bts->features, i)) {
+ vty_out(vty, " %03u ", i);
+ vty_out(vty, "%-40s%s", osmo_bts_feature_name(i), VTY_NEWLINE);
+ no_features = false;
+ }
+ }
+
+ if (no_features)
+ vty_out(vty, " (not available)%s", VTY_NEWLINE);
+
+ vty_out(vty, " BTS model specific (internal) flags:%s", VTY_NEWLINE);
+
+ for (i = 0, no_features = true; i < sizeof(bts->flags) * 8; i++) {
+ if (bts_internal_flag_get(bts, i)) {
vty_out(vty, " %03u ", i);
- vty_out(vty, "%-40s%s", get_value_string(gsm_bts_features_descs, i), VTY_NEWLINE);
+ vty_out(vty, "%-40s%s", get_value_string(bts_impl_flag_desc, i), VTY_NEWLINE);
no_features = false;
}
}
diff --git a/src/osmo-bts-litecell15/main.c b/src/osmo-bts-litecell15/main.c
index ef021352..b48d3ecc 100644
--- a/src/osmo-bts-litecell15/main.c
+++ b/src/osmo-bts-litecell15/main.c
@@ -110,16 +110,17 @@ int bts_model_init(struct gsm_bts *bts)
exit(23);
}
- gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_EGPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);
- gsm_bts_set_feature(bts, BTS_FEAT_AGCH_PCH_PROP);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_V1);
- 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);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_GPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_EGPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_OML_ALERTS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_AGCH_PCH_PROP);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_EFR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_AMR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
+
+ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_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 f9bb0cb1..a0f4d4a8 100644
--- a/src/osmo-bts-oc2g/main.c
+++ b/src/osmo-bts-oc2g/main.c
@@ -111,16 +111,17 @@ int bts_model_init(struct gsm_bts *bts)
exit(23);
}
- gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_EGPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);
- gsm_bts_set_feature(bts, BTS_FEAT_AGCH_PCH_PROP);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_V1);
- 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);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_GPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_EGPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_OML_ALERTS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_AGCH_PCH_PROP);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_EFR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_AMR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
+
+ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
bts_model_vty_init(bts);
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index fb62f8b7..0adc8fee 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -779,13 +779,13 @@ int bts_model_init(struct gsm_bts *bts)
/* FIXME: what is the nominal transmit power of the PHY/board? */
bts->c0->nominal_power = 15;
- gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_GPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_OML_ALERTS);
#if defined(cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_FCCH_SCH_BCCH_CCCH_SDCCH4_CBCH_SACCHC4) && defined(cOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM_SDCCH8_CBCH_SACCHC8)
- gsm_bts_set_feature(bts, BTS_FEAT_CBCH);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_CBCH);
#endif
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
bts_model_vty_init(bts);
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 44c6d5d4..51a14c7d 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -76,18 +76,19 @@ int bts_model_init(struct gsm_bts *bts)
exit(23);
}
- gsm_bts_set_feature(bts, BTS_FEAT_CBCH);
- gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_EGPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);
- gsm_bts_set_feature(bts, BTS_FEAT_AGCH_PCH_PROP);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_V1);
- 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);
- gsm_bts_set_feature(bts, BTS_FEAT_MEAS_PAYLOAD_COMB);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_CBCH);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_GPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_EGPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_OML_ALERTS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_AGCH_PCH_PROP);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_EFR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_AMR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
+
+ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP);
+ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB);
bts_model_vty_init(bts);
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 3ccd5976..bd3d0cb4 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -110,16 +110,17 @@ int bts_model_init(struct gsm_bts *bts)
* through TRXC. */
bts->c0->nominal_power = 23;
- gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_EGPRS);
- gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_V1);
- 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_CBCH);
- gsm_bts_set_feature(bts, BTS_FEAT_MEAS_PAYLOAD_COMB);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_GPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_EGPRS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_OML_ALERTS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_EFR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_AMR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_CBCH);
+
+ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB);
bts_model_vty_init(bts);
diff --git a/src/osmo-bts-virtual/main.c b/src/osmo-bts-virtual/main.c
index a6fc290f..fb5d3573 100644
--- a/src/osmo-bts-virtual/main.c
+++ b/src/osmo-bts-virtual/main.c
@@ -62,13 +62,13 @@ int bts_model_init(struct gsm_bts *bts)
bts->variant = BTS_OSMO_VIRTUAL;
bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
- gsm_bts_set_feature(bts, BTS_FEAT_OML_ALERTS);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_V1);
- gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_V1);
- 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_CBCH);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_OML_ALERTS);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_EFR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_AMR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_AMR);
+ osmo_bts_set_feature(bts->features, BTS_FEAT_CBCH);
bts_model_vty_init(bts);