[MERGED] openbsc[master]: Move SI-related defines

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
Thu Jun 15 11:43:10 UTC 2017


Max has submitted this change and it was merged.

Change subject: Move SI-related defines
......................................................................


Move SI-related defines

* move SI2quater related defines to shared header
* add define from OsmoBTS which checks for presence of a given SI
  message in gsm_bts struct. Rename it to avoid conflicts with OsmoBTS
  code and to match naming conventions of similar macros.

Change-Id: I11432c93c772d1ead6d45a7bb0f1d13d492c82f1
Related: OS#1660
---
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/include/openbsc/rest_octets.h
M openbsc/src/libbsc/bsc_init.c
M openbsc/src/libbsc/system_information.c
M openbsc/tests/gsm0408/gsm0408_test.c
5 files changed, 11 insertions(+), 10 deletions(-)

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



diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index b72ed2d..a507606 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -26,6 +26,12 @@
 
 #include <openbsc/common_cs.h>
 
+/* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018: 4-bit index is used (2#1111 = 10#15) */
+#define SI2Q_MAX_NUM 16
+/* length in bits (for single SI2quater message) */
+#define SI2Q_MAX_LEN 160
+#define SI2Q_MIN_LEN 18
+
 struct osmo_bsc_data;
 
 struct osmo_bsc_sccp_con;
@@ -486,6 +492,7 @@
 };
 
 #define GSM_BTS_SI2Q(bts)	(struct gsm48_system_information_type_2quater *)((bts)->si_buf[SYSINFO_TYPE_2quater])
+#define GSM_BTS_HAS_SI(bts, i) ((bts)->si_valid & (1 << i))
 #define GSM_BTS_SI(bts, i)	(void *)((bts)->si_buf[i])
 #define GSM_LCHAN_SI(lchan, i)	(void *)((lchan)->si.buf[i])
 
diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h
index 7b324d3..49a2312 100644
--- a/openbsc/include/openbsc/rest_octets.h
+++ b/openbsc/include/openbsc/rest_octets.h
@@ -5,12 +5,6 @@
 #include <openbsc/gsm_04_08.h>
 #include <osmocom/gsm/sysinfo.h>
 
-/* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018: 4-bit index is used */
-#define SI2Q_MAX_NUM 16
-/* length in bits (for single SI2quater message) */
-#define SI2Q_MAX_LEN 160
-#define SI2Q_MIN_LEN 18
-
 /* generate SI1 rest octets */
 int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net);
 int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts);
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index e5226a9..25f3fdc 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -186,7 +186,7 @@
 
 	for (n = 0; n < n_si; n++) {
 		i = gen_si[n];
-		if (!(bts->si_valid & (1 << i)))
+		if (!GSM_BTS_HAS_SI(bts, i))
 			continue;
 		rc = rsl_si(trx, i, si_len[i]);
 		if (rc < 0)
diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c
index 644bebd..a074a78 100644
--- a/openbsc/src/libbsc/system_information.c
+++ b/openbsc/src/libbsc/system_information.c
@@ -774,13 +774,13 @@
 	/* allow/disallow DTXu */
 	gsm48_set_dtx(&si3->cell_options, bts->dtxu, bts->dtxu, true);
 
-	if ((bts->si_valid & (1 << SYSINFO_TYPE_2ter))) {
+	if (GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_2ter)) {
 		LOGP(DRR, LOGL_INFO, "SI 2ter is included.\n");
 		si_info.si2ter_indicator = 1;
 	} else {
 		si_info.si2ter_indicator = 0;
 	}
-	if ((bts->si_valid & (1 << SYSINFO_TYPE_2quater))) {
+	if (GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_2quater)) {
 		LOGP(DRR, LOGL_INFO, "SI 2quater is included, based on %zu EARFCNs and %zu UARFCNs.\n",
 		     si2q_earfcn_count(&bts->si_common.si2quater_neigh_list), bts->si_common.uarfcn_length);
 		si_info.si2quater_indicator = 1;
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c
index 36f6993..5a78505 100644
--- a/openbsc/tests/gsm0408/gsm0408_test.c
+++ b/openbsc/tests/gsm0408/gsm0408_test.c
@@ -105,7 +105,7 @@
 	r = gsm_generate_si(bts, SYSINFO_TYPE_2quater);
 	if (r > 0)
 		printf("generated %s SI2quater [%02u/%02u]: [%d] %s\n",
-		       (bts->si_valid & (1 << SYSINFO_TYPE_2quater)) ? "valid" : "invalid",
+		       GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_2quater) ? "valid" : "invalid",
 		       bts->si2q_index, bts->si2q_count, r,
 		       osmo_hexdump((void *)GSM_BTS_SI2Q(bts), GSM_MACBLOCK_LEN));
 	else

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I11432c93c772d1ead6d45a7bb0f1d13d492c82f1
Gerrit-PatchSet: 4
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list