[PATCH] osmo-pcu[master]: RACH: improve single block detection

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
Wed Feb 7 16:57:00 UTC 2018


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

RACH: improve single block detection

Replace unreadable if-else ladder in is_single_block() with regular
switch-case. This enables implementation of 11-bit RACH support in
follow-up patches.

Related: OS#1548
Change-Id: I9180478152f9341f11bb3dffe61671da683f24d8
---
M src/bts.cpp
1 file changed, 30 insertions(+), 46 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/12/6312/1

diff --git a/src/bts.cpp b/src/bts.cpp
index 3d29ad6..05966d0 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -642,55 +642,39 @@
 		     "MS requests single phase access, but we force two phase access [RACH is %s bit]\n",
 		     is_11bit ? "11" : "8");
 
-	if (!is_11bit && (burst_type == GSM_L1_BURST_TYPE_ACCESS_0)) {
+	switch(burst_type) {
+	case GSM_L1_BURST_TYPE_ACCESS_0:
+		if (is_11bit) {
+			LOGP(DRLCMAC, LOGL_ERROR, "Error: GPRS 11 bit RACH not supported\n");
+			return false;
+		}
 
 		if ((ra & 0xf8) == 0x70)
-			sb = true;
-		else if (force_two_phase) {
-			LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single "
-				"phase access, but we force two phase "
-				"access\n");
-			sb = true;
+			return true;
+
+		if (force_two_phase)
+			return true;
+		break;
+	case GSM_L1_BURST_TYPE_ACCESS_1: /* deliberate fall-through */
+	case GSM_L1_BURST_TYPE_ACCESS_2:
+		if (is_11bit) {
+			if (!(ra & (1 << 10))) {
+				if (force_two_phase)
+					return true;
+
+				return false;
+			}
+
+			return true;
 		}
-
-	} else if (is_11bit &&
-		((burst_type == GSM_L1_BURST_TYPE_ACCESS_1) ||
-		(burst_type == GSM_L1_BURST_TYPE_ACCESS_2))) {
-
-		if (!(ra & (1 << 10))) {
-			if (force_two_phase) {
-				LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH "
-					"received. MS requests single phase "
-					"access but we force two phase "
-					"access\n");
-				sb = true;
-			} else
-				sb = false;
-		} else {
-			LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH received."
-				"MS requests single block allocation\n");
-			sb = true;
-		}
-
-	} else if (is_11bit &&
-		(burst_type == GSM_L1_BURST_TYPE_ACCESS_0)) {
-		LOGP(DRLCMAC, LOGL_ERROR,
-			"Error: GPRS 11 bit RACH not supported\n");
-
-	} else if (burst_type == GSM_L1_BURST_TYPE_NONE) {
-		LOGP(DRLCMAC, LOGL_DEBUG, "pcu has not received burst type "
-			"from bts \n");
-
-		if ((ra & 0xf8) == 0x70) {
-			LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single block "
-				"allocation\n");
-			sb = true;
-		} else if (force_two_phase) {
-			LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single "
-				"phase access, but we force two phase "
-				"access\n");
-			sb = true;
-		}
+		LOGP(DRLCMAC, LOGL_ERROR, "Unexpected RACH burst type %u for 8-bit RACH\n", burst_type);
+		break;
+	case GSM_L1_BURST_TYPE_NONE:
+		LOGP(DRLCMAC, LOGL_ERROR, "PCU has not received burst type from BTS\n");
+		break;
+	default:
+		LOGP(DRLCMAC, LOGL_ERROR, "Unexpected RACH burst type %u for %s-bit RACH\n",
+		     burst_type, is_11bit ? "11" : "8");
 	}
 
 	return sb;

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

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



More information about the gerrit-log mailing list