[PATCH] openbsc[master]: Add remote BTS feature storage and helpers

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue May 30 14:00:42 UTC 2017


Review at  https://gerrit.osmocom.org/2797

Add remote BTS feature storage and helpers

In addition to compile-time defined BTS model features we also need
run-time BTS features reported by BTS via OML. This should be shared by
BSC and BTS. To accommodate for this, add following:

* features bitvec to gsm_bts struct
* comments to avoid confusion between 2 feature sets
* helper functions to set/query particular feature
* upper boundary on number of supported features and assertion for it

Change-Id: I02bd317097ba66585c50ebd4e8fc348f6dc3dad9
Related: OS#1614
---
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/src/libcommon/gsm_data.c
2 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/97/2797/1

diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 4661830..6f7124f 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -536,6 +536,7 @@
 
 	struct tlv_definition nm_att_tlvdef;
 
+	/* features of a given BTS model set via gsm_bts_model_register() locally */
 	struct bitvec features;
 	uint8_t _features_data[MAX_BTS_FEATURES/8];
 };
@@ -550,6 +551,7 @@
 	BTS_FEAT_OML_ALERTS,
 	BTS_FEAT_AGCH_PCH_PROP,
 	BTS_FEAT_CBCH,
+	_NUM_BTS_FEAT
 };
 
 /*
@@ -682,6 +684,10 @@
 	enum gsm_band band;
 	char version[MAX_VERSION_LENGTH];
 	char sub_model[MAX_VERSION_LENGTH];
+
+	/* features of a given BTS set/reported via OML */
+	struct bitvec features;
+	uint8_t _features_data[MAX_BTS_FEATURES/8];
 
 	/* Connected PCU version (if any) */
 	char pcu_version[MAX_VERSION_LENGTH];
@@ -911,6 +917,18 @@
 	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 *
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index 2c7ea0a..825e10b 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -225,11 +225,13 @@
 
 int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat)
 {
+	OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
 	return bitvec_set_bit_pos(&model->features, feat, 1);
 }
 
 bool gsm_btsmodel_has_feature(struct gsm_bts_model *model, enum gsm_bts_features feat)
 {
+	OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
 	return bitvec_get_bit_pos(&model->features, feat);
 }
 
@@ -299,6 +301,8 @@
 	bts->neigh_list_manual_mode = 0;
 	bts->si_common.cell_sel_par.cell_resel_hyst = 2; /* 4 dB */
 	bts->si_common.cell_sel_par.rxlev_acc_min = 0;
+	bts->features.data = &bts->_features_data[0];
+	bts->features.data_len = sizeof(bts->_features_data);
 	bts->si_common.si2quater_neigh_list.arfcn = bts->si_common.data.earfcn_list;
 	bts->si_common.si2quater_neigh_list.meas_bw = bts->si_common.data.meas_bw_list;
 	bts->si_common.si2quater_neigh_list.length = MAX_EARFCN_LIST;

-- 
To view, visit https://gerrit.osmocom.org/2797
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02bd317097ba66585c50ebd4e8fc348f6dc3dad9
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list