osmith submitted this change.

View Change

Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified
Always use reported features if available

Instead of sometimes checking against hardcoded BTS model features, and
sometimes against features reported at runtime (which only some BTS
models do):
* copy the hardcoded BTS model features to BTS features initially
* do all checks against BTS features

Related: SYS#5922, OS#5538
Change-Id: Idf2d933aa8b03b1f708e56a08707fe6c620a97aa
---
M src/osmo-bsc/bts.c
M src/osmo-bsc/bts_trx_vty.c
M src/osmo-bsc/system_information.c
3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 774384f..54d9cdd 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -615,6 +615,13 @@
int gsm_set_bts_model(struct gsm_bts *bts, struct gsm_bts_model *model)
{
bts->model = model;
+
+ /* Copy hardcoded feature list from BTS model. For some BTS we support
+ * reporting features at runtime (as of writing nanobts, OsmoBTS),
+ * which will then replace this list. */
+ if (model)
+ memcpy(bts->_features_data, bts->model->_features_data, sizeof(bts->_features_data));
+
return 0;
}

@@ -683,11 +690,11 @@
int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode)
{
if (mode != BTS_GPRS_NONE &&
- !osmo_bts_has_feature(&bts->model->features, BTS_FEAT_GPRS)) {
+ !osmo_bts_has_feature(&bts->features, BTS_FEAT_GPRS)) {
return 0;
}
if (mode == BTS_GPRS_EGPRS &&
- !osmo_bts_has_feature(&bts->model->features, BTS_FEAT_EGPRS)) {
+ !osmo_bts_has_feature(&bts->features, BTS_FEAT_EGPRS)) {
return 0;
}

diff --git a/src/osmo-bsc/bts_trx_vty.c b/src/osmo-bsc/bts_trx_vty.c
index 39584a5..27bba2c 100644
--- a/src/osmo-bsc/bts_trx_vty.c
+++ b/src/osmo-bsc/bts_trx_vty.c
@@ -317,7 +317,7 @@
{
struct gsm_bts_trx_ts *ts = vty->index;

- if (!osmo_bts_has_feature(&ts->trx->bts->model->features, BTS_FEAT_MULTI_TSC)) {
+ if (!osmo_bts_has_feature(&ts->trx->bts->features, BTS_FEAT_MULTI_TSC)) {
vty_out(vty, "%% This BTS does not support a TSC != BCC, "
"falling back to BCC%s", VTY_NEWLINE);
ts->tsc = -1;
@@ -341,7 +341,7 @@
struct gsm_bts_trx_ts *ts = vty->index;
int enabled = atoi(argv[0]);

- if (enabled && !osmo_bts_has_feature(&ts->trx->bts->model->features, BTS_FEAT_HOPPING)) {
+ if (enabled && !osmo_bts_has_feature(&ts->trx->bts->features, BTS_FEAT_HOPPING)) {
vty_out(vty, "%% BTS model does not seem to support freq. hopping%s", VTY_NEWLINE);
/* Allow enabling frequency hopping anyway, because the BTS might not have
* connected yet (thus not sent the feature vector), so we cannot know for
diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c
index 187678d..48f7453 100644
--- a/src/osmo-bsc/system_information.c
+++ b/src/osmo-bsc/system_information.c
@@ -1270,8 +1270,7 @@

si13_info.cell_opts.ext_info.ccn_active = bts->gprs.ccn.forced_vty ?
bts->gprs.ccn.active :
- osmo_bts_has_feature(&bts->model->features,
- BTS_FEAT_CCN);
+ osmo_bts_has_feature(&bts->features, BTS_FEAT_CCN);

ret = osmo_gsm48_rest_octets_si13_encode(si13->rest_octets, &si13_info);
if (ret < 0)

To view, visit change 27921. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Idf2d933aa8b03b1f708e56a08707fe6c620a97aa
Gerrit-Change-Number: 27921
Gerrit-PatchSet: 4
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-CC: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged