Change in osmocom-bb[master]: layer23/app_ccch_scan.c: clean up System Information handling

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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Mon Oct 1 18:13:01 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/11174


Change subject: layer23/app_ccch_scan.c: clean up System Information handling
......................................................................

layer23/app_ccch_scan.c: clean up System Information handling

Change-Id: I8c2594920fcad8a3e346b938bd0c20409f4d01c9
---
M src/host/layer23/src/misc/app_ccch_scan.c
1 file changed, 98 insertions(+), 93 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/74/11174/1

diff --git a/src/host/layer23/src/misc/app_ccch_scan.c b/src/host/layer23/src/misc/app_ccch_scan.c
index 31b72f8..49adee9 100644
--- a/src/host/layer23/src/misc/app_ccch_scan.c
+++ b/src/host/layer23/src/misc/app_ccch_scan.c
@@ -45,108 +45,113 @@
 	int ccch_mode;
 } app_state;
 
+static int bcch_check_tc(uint8_t si_type, uint8_t tc)
+{
+	/* FIXME: there is no tc information (always 0) */
+	return 0;
+
+	switch (si_type) {
+	case GSM48_MT_RR_SYSINFO_1:
+		if (tc != 0)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_2:
+		if (tc != 1)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_3:
+		if (tc != 2 && tc != 6)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_4:
+		if (tc != 3 && tc != 7)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_7:
+		if (tc != 7)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_8:
+		if (tc != 3)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_9:
+		if (tc != 4)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_13:
+		if (tc != 4 && tc != 0)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_16:
+		if (tc != 6)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_17:
+		if (tc != 2)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_2bis:
+		if (tc != 5)
+			return -EINVAL;
+		break;
+	case GSM48_MT_RR_SYSINFO_2ter:
+		if (tc != 5 && tc != 4)
+			return -EINVAL;
+		break;
+
+	/* The following types are used on SACCH only */
+	case GSM48_MT_RR_SYSINFO_5:
+	case GSM48_MT_RR_SYSINFO_6:
+	case GSM48_MT_RR_SYSINFO_5bis:
+	case GSM48_MT_RR_SYSINFO_5ter:
+		break;
+
+	/* Unknown SI type */
+	default:
+		LOGP(DRR, LOGL_INFO, "Unknown SI (type=0x%02x)\n", si_type);
+		return -ENOTSUP;
+	};
+
+	return 0;
+}
+
+static void handle_si3(struct osmocom_ms *ms,
+	struct gsm48_system_information_type_3 *si)
+{
+	if (app_state.ccch_mode != CCCH_MODE_NONE)
+		return;
+
+	if (si->control_channel_desc.ccch_conf == RSL_BCCH_CCCH_CONF_1_C)
+		app_state.ccch_mode = CCCH_MODE_COMBINED;
+	else
+		app_state.ccch_mode = CCCH_MODE_NON_COMBINED;
+
+	l1ctl_tx_ccch_mode_req(ms, app_state.ccch_mode);
+}
+
 static void dump_bcch(struct osmocom_ms *ms, uint8_t tc, const uint8_t *data)
 {
 	struct gsm48_system_information_type_header *si_hdr;
 	si_hdr = (struct gsm48_system_information_type_header *) data;
+	uint8_t si_type = si_hdr->system_information;
+
+	LOGP(DRR, LOGL_INFO, "BCCH message (type=0x%02x): %s\n",
+		si_type, gsm48_rr_msg_name(si_type));
+
+	if (bcch_check_tc(si_type, tc) == -EINVAL)
+		LOGP(DRR, LOGL_INFO, "SI on wrong tc=%u\n", tc);
 
 	/* GSM 05.02 §6.3.1.3 Mapping of BCCH data */
-	switch (si_hdr->system_information) {
-	case GSM48_MT_RR_SYSINFO_1:
-#ifdef BCCH_TC_CHECK
-		if (tc != 0)
-			LOGP(DRR, LOGL_ERROR, "SI1 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_2:
-#ifdef BCCH_TC_CHECK
-		if (tc != 1)
-			LOGP(DRR, LOGL_ERROR, "SI2 on the wrong TC: %d\n", tc);
-#endif
-		break;
+	switch (si_type) {
 	case GSM48_MT_RR_SYSINFO_3:
-#ifdef BCCH_TC_CHECK
-		if (tc != 2 && tc != 6)
-			LOGP(DRR, LOGL_ERROR, "SI3 on the wrong TC: %d\n", tc);
-#endif
-		if (app_state.ccch_mode == CCCH_MODE_NONE) {
-			struct gsm48_system_information_type_3 *si3 =
-				(struct gsm48_system_information_type_3 *)data;
+		handle_si3(ms,
+			(struct gsm48_system_information_type_3 *) data);
+		break;
 
-			if (si3->control_channel_desc.ccch_conf == RSL_BCCH_CCCH_CONF_1_C)
-				app_state.ccch_mode = CCCH_MODE_COMBINED;
-			else
-				app_state.ccch_mode = CCCH_MODE_NON_COMBINED;
-
-			l1ctl_tx_ccch_mode_req(ms, app_state.ccch_mode);
-		}
-		break;
-	case GSM48_MT_RR_SYSINFO_4:
-#ifdef BCCH_TC_CHECK
-		if (tc != 3 && tc != 7)
-			LOGP(DRR, LOGL_ERROR, "SI4 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_5:
-		break;
-	case GSM48_MT_RR_SYSINFO_6:
-		break;
-	case GSM48_MT_RR_SYSINFO_7:
-#ifdef BCCH_TC_CHECK
-		if (tc != 7)
-			LOGP(DRR, LOGL_ERROR, "SI7 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_8:
-#ifdef BCCH_TC_CHECK
-		if (tc != 3)
-			LOGP(DRR, LOGL_ERROR, "SI8 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_9:
-#ifdef BCCH_TC_CHECK
-		if (tc != 4)
-			LOGP(DRR, LOGL_ERROR, "SI9 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_13:
-#ifdef BCCH_TC_CHECK
-		if (tc != 4 && tc != 0)
-			LOGP(DRR, LOGL_ERROR, "SI13 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_16:
-#ifdef BCCH_TC_CHECK
-		if (tc != 6)
-			LOGP(DRR, LOGL_ERROR, "SI16 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_17:
-#ifdef BCCH_TC_CHECK
-		if (tc != 2)
-			LOGP(DRR, LOGL_ERROR, "SI17 on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_2bis:
-#ifdef BCCH_TC_CHECK
-		if (tc != 5)
-			LOGP(DRR, LOGL_ERROR, "SI2bis on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_2ter:
-#ifdef BCCH_TC_CHECK
-		if (tc != 5 && tc != 4)
-			LOGP(DRR, LOGL_ERROR, "SI2ter on the wrong TC: %d\n", tc);
-#endif
-		break;
-	case GSM48_MT_RR_SYSINFO_5bis:
-		break;
-	case GSM48_MT_RR_SYSINFO_5ter:
-		break;
 	default:
-		LOGP(DRR, LOGL_ERROR, "Unknown SI: %d\n",
-		     si_hdr->system_information);
-		break;
+		/* We don't care about other types of SI */
+		break; /* thus there is nothing to do */
 	};
 }
 

-- 
To view, visit https://gerrit.osmocom.org/11174
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c2594920fcad8a3e346b938bd0c20409f4d01c9
Gerrit-Change-Number: 11174
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181001/2cc713ce/attachment.htm>


More information about the gerrit-log mailing list