diff mbox

[1/3] Add SI2quater support to SI3

Message ID 1460729086-8961-1-git-send-email-msuraev@sysmocom.de
State Not Applicable
Headers show

Commit Message

Max April 15, 2016, 2:04 p.m. UTC
From: Max <msuraev@sysmocom.de>

Advertise SI2 quater presence and location (if available) using SI3
according to 3GPP TS 44.018 ยง 10.5.2.34
---
 openbsc/include/openbsc/rest_octets.h   | 3 ++-
 openbsc/src/libbsc/bsc_init.c           | 1 +
 openbsc/src/libbsc/rest_octets.c        | 7 +++++++
 openbsc/src/libbsc/system_information.c | 8 +++++++-
 4 files changed, 17 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h
index 963b010..9560b14 100644
--- a/openbsc/include/openbsc/rest_octets.h
+++ b/openbsc/include/openbsc/rest_octets.h
@@ -43,7 +43,8 @@  struct gsm48_si_ro_info {
 			 present:1;
 	} scheduling;
 	struct gsm48_si3_gprs_ind gprs_ind;
-
+	/* SI 3 specific */
+	uint8_t si2quater_indicator;
 	/* SI 4 specific */
 	struct gsm48_lsa_params lsa_params;
 	uint16_t cell_id;
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 713109c..fd8dd66 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -140,6 +140,7 @@  int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx)
 		gen_si[n_si++] = SYSINFO_TYPE_2;
 		gen_si[n_si++] = SYSINFO_TYPE_2bis;
 		gen_si[n_si++] = SYSINFO_TYPE_2ter;
+		gen_si[n_si++] = SYSINFO_TYPE_2quater;
 		gen_si[n_si++] = SYSINFO_TYPE_3;
 		gen_si[n_si++] = SYSINFO_TYPE_4;
 
diff --git a/openbsc/src/libbsc/rest_octets.c b/openbsc/src/libbsc/rest_octets.c
index 4545794..fa35f21 100644
--- a/openbsc/src/libbsc/rest_octets.c
+++ b/openbsc/src/libbsc/rest_octets.c
@@ -129,6 +129,13 @@  int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3)
 	/* GPRS Indicator */
 	append_gprs_ind(&bv, &si3->gprs_ind);
 
+	bitvec_set_bit(&bv, H); /* 3G Early Classmark Sending Restriction controlled by early_cm_ctrl above */
+
+	if (si3->si2quater_indicator) {
+		bitvec_set_bit(&bv, H); /* indicator struct present */
+		bitvec_set_uint(&bv, 0, 1); /* message is sent on BCCH Norm */
+	}
+
 	bitvec_spare_padding(&bv, (bv.data_len*8)-1);
 	return bv.data_len;
 }
diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c
index 1ee9d41..62ee306 100644
--- a/openbsc/src/libbsc/system_information.c
+++ b/openbsc/src/libbsc/system_information.c
@@ -510,6 +510,7 @@  static struct gsm48_si_ro_info si_info = {
 		.ra_colour = 0,
 		.present = 1,
 	},
+	.si2quater_indicator = 0,
 	.lsa_params = {
 		.present = 0,
 	},
@@ -545,7 +546,12 @@  static int generate_si3(uint8_t *output, struct gsm_bts *bts)
 	} else {
 		si_info.si2ter_indicator = 0;
 	}
-
+	if ((bts->si_valid & (1 << SYSINFO_TYPE_2quater))) {
+		LOGP(DRR, LOGL_INFO, "SI 2quater is included.\n");
+		si_info.si2quater_indicator = 1;
+	} else {
+		si_info.si2quater_indicator = 0;
+	}
 	/* SI3 Rest Octets (10.5.2.34), containing
 		CBQ, CELL_RESELECT_OFFSET, TEMPORARY_OFFSET, PENALTY_TIME
 		Power Offset, 2ter Indicator, Early Classmark Sending,