[MERGED] osmo-bsc[master]: gsm_data: use feature list from libosmocore

2018-03-12 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: gsm_data: use feature list from libosmocore
..


gsm_data: use feature list from libosmocore

In order to avoid code duplication the feature list (bit masks) and
the desciptive value strings as well as the function to set and get
the feature bits have been moved to libosmocore.

- use feature list functionality provided by libosmocore

Depends: libosmocore Change-Id Id0c35aef11aa49aa40abe7deef1f9dbd12210776
Change-Id: I3e80517539cc5d0e5d8189d434a5e3cc0fdea1a0
---
M include/osmocom/bsc/gsm_data.h
M src/libbsc/abis_nm.c
M src/libbsc/bsc_vty.c
M src/libbsc/bts_ericsson_rbs2000.c
M src/libbsc/bts_ipaccess_nanobts.c
M src/libbsc/bts_nokia_site.c
M src/libbsc/bts_siemens_bs11.c
M src/libbsc/bts_sysmobts.c
M src/libbsc/gsm_data.c
9 files changed, 25 insertions(+), 79 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 27aa261..74009a9 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -211,8 +212,6 @@
 #define HARDCODED_BTS2_TS  11
 
 #define MAX_VERSION_LENGTH 64
-
-#define MAX_BTS_FEATURES 128
 
 enum gsm_hooks {
GSM_HOOK_NM_SWLOAD,
@@ -614,22 +613,7 @@
uint8_t _features_data[MAX_BTS_FEATURES/8];
 };
 
-/* 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 */
-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,
-   _NUM_BTS_FEAT
-};
 
-extern const struct value_string gsm_bts_features_descs[];
 
 /*
  * This keeps track of the paging status of one BTS. It
@@ -1018,18 +1002,6 @@
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(>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(>features, feat);
-}
-
 void gsm_abis_mo_reset(struct gsm_abis_mo *mo);
 
 struct gsm_nm_state *
@@ -1366,7 +1338,6 @@
 void gsm48_ra_id_by_bts(struct gsm48_ra_id *buf, struct gsm_bts *bts);
 void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
 
-int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
 int gsm_bts_model_register(struct gsm_bts_model *model);
 
 struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan 
*lchan);
@@ -1383,7 +1354,6 @@
   uint8_t e1_ts, uint8_t e1_ts_ss);
 
 void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason);
-bool gsm_btsmodel_has_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
 struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
 int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx);
 int gsm_bts_set_system_infos(struct gsm_bts *bts);
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 435d004..aa418ca 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define OM_ALLOC_SIZE  1024
 #define OM_HEADROOM_SIZE   128
@@ -501,11 +502,11 @@
adjust = m_id_len + 3; /* adjust for parsed TL16V struct */
 
for (i = 0; i < _NUM_BTS_FEAT; i++)
-   if (gsm_bts_has_feature(bts, i) != 
gsm_btsmodel_has_feature(bts->model, i))
+   if (osmo_bts_has_feature(>features, i) != 
osmo_bts_has_feature(>model->features, i))
LOGP(DNM, LOGL_NOTICE, "BTS%u feature '%s' 
reported via OML does not match statically "
 "set feature: %u != %u. Please fix.\n", 
bts->nr,
-get_value_string(gsm_bts_features_descs, 
i),
-gsm_bts_has_feature(bts, i), 
gsm_btsmodel_has_feature(bts->model, i));
+get_value_string(osmo_bts_features_descs, 
i),
+osmo_bts_has_feature(>features, i), 
osmo_bts_has_feature(>model->features, i));
}
 
*data_len -= adjust;
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 29a3c80..04818d9 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -3977,7 +3977,7 @@
 {
struct gsm_bts_trx_ts *ts = vty->index;
 
- 

osmo-bsc[master]: gsm_data: use feature list from libosmocore

2018-03-12 Thread Harald Welte

Patch Set 6: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3e80517539cc5d0e5d8189d434a5e3cc0fdea1a0
Gerrit-PatchSet: 6
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


[PATCH] osmo-bsc[master]: gsm_data: use feature list from libosmocore

2018-03-12 Thread dexter
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6993

to look at the new patch set (#6).

gsm_data: use feature list from libosmocore

In order to avoid code duplication the feature list (bit masks) and
the desciptive value strings as well as the function to set and get
the feature bits have been moved to libosmocore.

- use feature list functionality provided by libosmocore

Depends: libosmocore Change-Id Id0c35aef11aa49aa40abe7deef1f9dbd12210776
Change-Id: I3e80517539cc5d0e5d8189d434a5e3cc0fdea1a0
---
M include/osmocom/bsc/gsm_data.h
M src/libbsc/abis_nm.c
M src/libbsc/bsc_vty.c
M src/libbsc/bts_ericsson_rbs2000.c
M src/libbsc/bts_ipaccess_nanobts.c
M src/libbsc/bts_nokia_site.c
M src/libbsc/bts_siemens_bs11.c
M src/libbsc/bts_sysmobts.c
M src/libbsc/gsm_data.c
9 files changed, 25 insertions(+), 79 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/93/6993/6

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 27aa261..74009a9 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -211,8 +212,6 @@
 #define HARDCODED_BTS2_TS  11
 
 #define MAX_VERSION_LENGTH 64
-
-#define MAX_BTS_FEATURES 128
 
 enum gsm_hooks {
GSM_HOOK_NM_SWLOAD,
@@ -614,22 +613,7 @@
uint8_t _features_data[MAX_BTS_FEATURES/8];
 };
 
-/* 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 */
-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,
-   _NUM_BTS_FEAT
-};
 
-extern const struct value_string gsm_bts_features_descs[];
 
 /*
  * This keeps track of the paging status of one BTS. It
@@ -1018,18 +1002,6 @@
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(>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(>features, feat);
-}
-
 void gsm_abis_mo_reset(struct gsm_abis_mo *mo);
 
 struct gsm_nm_state *
@@ -1366,7 +1338,6 @@
 void gsm48_ra_id_by_bts(struct gsm48_ra_id *buf, struct gsm_bts *bts);
 void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
 
-int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
 int gsm_bts_model_register(struct gsm_bts_model *model);
 
 struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan 
*lchan);
@@ -1383,7 +1354,6 @@
   uint8_t e1_ts, uint8_t e1_ts_ss);
 
 void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason);
-bool gsm_btsmodel_has_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
 struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
 int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx);
 int gsm_bts_set_system_infos(struct gsm_bts *bts);
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 435d004..aa418ca 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define OM_ALLOC_SIZE  1024
 #define OM_HEADROOM_SIZE   128
@@ -501,11 +502,11 @@
adjust = m_id_len + 3; /* adjust for parsed TL16V struct */
 
for (i = 0; i < _NUM_BTS_FEAT; i++)
-   if (gsm_bts_has_feature(bts, i) != 
gsm_btsmodel_has_feature(bts->model, i))
+   if (osmo_bts_has_feature(>features, i) != 
osmo_bts_has_feature(>model->features, i))
LOGP(DNM, LOGL_NOTICE, "BTS%u feature '%s' 
reported via OML does not match statically "
 "set feature: %u != %u. Please fix.\n", 
bts->nr,
-get_value_string(gsm_bts_features_descs, 
i),
-gsm_bts_has_feature(bts, i), 
gsm_btsmodel_has_feature(bts->model, i));
+get_value_string(osmo_bts_features_descs, 
i),
+osmo_bts_has_feature(>features, i), 
osmo_bts_has_feature(>model->features, i));
}
 
*data_len -= adjust;
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 29a3c80..04818d9 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -3977,7 +3977,7 @@
 {
struct gsm_bts_trx_ts *ts = vty->index;
 
-   if 

osmo-bsc[master]: gsm_data: use feature list from libosmocore

2018-03-05 Thread Harald Welte

Patch Set 4: Code-Review+2

Sorry, missed the depends-on

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3e80517539cc5d0e5d8189d434a5e3cc0fdea1a0
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


osmo-bsc[master]: gsm_data: use feature list from libosmocore

2018-03-03 Thread Harald Welte

Patch Set 4: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/6993/4//COMMIT_MSG
Commit Message:

Line 13: - use feature list functionality provided by libosmocore
this depends on a certain new feature in libosmcoore, henc you must include the 
Change-Id of the libosmcoore change here.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3e80517539cc5d0e5d8189d434a5e3cc0fdea1a0
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-HasComments: Yes


[PATCH] osmo-bsc[master]: gsm_data: use feature list from libosmocore

2018-03-01 Thread dexter
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/6993

to look at the new patch set (#2).

gsm_data: use feature list from libosmocore

In order to avoid code duplication the feature list (bit masks) and
the desciptive value strings as well as the function to set and get
the feature bits have been moved to libosmocore.

- use feature list functionality provided by libosmocore

Change-Id: I3e80517539cc5d0e5d8189d434a5e3cc0fdea1a0
Depends: Change-Id Id0c35aef11aa49aa40abe7deef1f9dbd12210776
---
M include/osmocom/bsc/gsm_data.h
M src/libbsc/abis_nm.c
M src/libbsc/bsc_vty.c
M src/libbsc/bts_ericsson_rbs2000.c
M src/libbsc/bts_ipaccess_nanobts.c
M src/libbsc/bts_nokia_site.c
M src/libbsc/bts_siemens_bs11.c
M src/libbsc/bts_sysmobts.c
M src/libbsc/gsm_data.c
9 files changed, 25 insertions(+), 79 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/93/6993/2

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 3c65c9c..32bc011 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -210,8 +211,6 @@
 #define HARDCODED_BTS2_TS  11
 
 #define MAX_VERSION_LENGTH 64
-
-#define MAX_BTS_FEATURES 128
 
 enum gsm_hooks {
GSM_HOOK_NM_SWLOAD,
@@ -613,22 +612,7 @@
uint8_t _features_data[MAX_BTS_FEATURES/8];
 };
 
-/* 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 */
-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,
-   _NUM_BTS_FEAT
-};
 
-extern const struct value_string gsm_bts_features_descs[];
 
 /*
  * This keeps track of the paging status of one BTS. It
@@ -1017,18 +1001,6 @@
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(>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(>features, feat);
-}
-
 void gsm_abis_mo_reset(struct gsm_abis_mo *mo);
 
 struct gsm_nm_state *
@@ -1356,7 +1328,6 @@
 int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
 void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
 
-int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
 int gsm_bts_model_register(struct gsm_bts_model *model);
 
 struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan 
*lchan);
@@ -1373,7 +1344,6 @@
   uint8_t e1_ts, uint8_t e1_ts_ss);
 
 void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason);
-bool gsm_btsmodel_has_feature(struct gsm_bts_model *model, enum 
gsm_bts_features feat);
 struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
 int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx);
 int gsm_bts_set_system_infos(struct gsm_bts *bts);
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 671c874..da6f053 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define OM_ALLOC_SIZE  1024
 #define OM_HEADROOM_SIZE   128
@@ -501,11 +502,11 @@
adjust = m_id_len + 3; /* adjust for parsed TL16V struct */
 
for (i = 0; i < _NUM_BTS_FEAT; i++)
-   if (gsm_bts_has_feature(bts, i) != 
gsm_btsmodel_has_feature(bts->model, i))
+   if (osmo_bts_has_feature(>features, i) != 
osmo_bts_has_feature(>model->features, i))
LOGP(DNM, LOGL_NOTICE, "BTS%u feature '%s' 
reported via OML does not match statically "
 "set feature: %u != %u. Please fix.\n", 
bts->nr,
-get_value_string(gsm_bts_features_descs, 
i),
-gsm_bts_has_feature(bts, i), 
gsm_btsmodel_has_feature(bts->model, i));
+get_value_string(osmo_bts_features_descs, 
i),
+osmo_bts_has_feature(>features, i), 
osmo_bts_has_feature(>model->features, i));
}
 
*data_len -= adjust;
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index ae1dd93..be2e559 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -3971,7 +3971,7 @@
 {
struct gsm_bts_trx_ts *ts = vty->index;
 
-   if (!gsm_btsmodel_has_feature(ts->trx->bts->model,