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
This commit is contained in:
Oliver Smith 2022-04-22 12:48:29 +02:00 committed by osmith
parent d055493071
commit 2d818b9f2e
3 changed files with 12 additions and 6 deletions

View File

@ -615,6 +615,13 @@ struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts)
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 gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type)
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;
}

View File

@ -317,7 +317,7 @@ DEFUN_USRATTR(cfg_ts_tsc,
{
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 @@ DEFUN_USRATTR(cfg_ts_hopping,
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

View File

@ -1270,8 +1270,7 @@ static int generate_si13(enum osmo_sysinfo_type t, struct gsm_bts *bts)
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)