Change in osmo-bts[master]: [VAMOS] rsl_lchan_lookup(): make it more readable

laforge gerrit-no-reply at lists.osmocom.org
Fri Jun 4 20:04:16 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/24438 )

Change subject: [VAMOS] rsl_lchan_lookup(): make it more readable
......................................................................

[VAMOS] rsl_lchan_lookup(): make it more readable

Change-Id: I3160929c739a521fe494716c3da3d3b72370a98a
Related: SYS#4895, OS#4941
---
M src/common/gsm_data.c
1 file changed, 28 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/common/gsm_data.c b/src/common/gsm_data.c
index 8425d1a..6b57851 100644
--- a/src/common/gsm_data.c
+++ b/src/common/gsm_data.c
@@ -282,41 +282,62 @@
 	if (rc)
 		*rc = -EINVAL;
 
-	if (cbits == ABIS_RSL_CHAN_NR_CBITS_Bm_ACCHs) {
+	switch (cbits) {
+	case ABIS_RSL_CHAN_NR_CBITS_Bm_ACCHs:
 		lch_idx = 0;	/* TCH/F */
 		if (ts->pchan != GSM_PCHAN_TCH_F &&
 		    ts->pchan != GSM_PCHAN_PDCH &&
 		    ts->pchan != GSM_PCHAN_TCH_F_PDCH &&
 		    ts->pchan != GSM_PCHAN_TCH_F_TCH_H_PDCH)
 			ok = false;
-	} else if ((cbits & 0x1e) == ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(0)) {
+		break;
+	case ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(0):
+	case ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(1):
 		lch_idx = cbits & 0x1;	/* TCH/H */
 		if (ts->pchan != GSM_PCHAN_TCH_H &&
 		    ts->pchan != GSM_PCHAN_TCH_F_TCH_H_PDCH)
 			ok = false;
-	} else if ((cbits & 0x1c) == ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(0)) {
+		break;
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(0):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(1):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(2):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(3):
 		lch_idx = cbits & 0x3;	/* SDCCH/4 */
 		if (ts->pchan != GSM_PCHAN_CCCH_SDCCH4 &&
 		    ts->pchan != GSM_PCHAN_CCCH_SDCCH4_CBCH)
 			ok = false;
-	} else if ((cbits & 0x18) == ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(0)) {
+		break;
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(0):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(1):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(2):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(3):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(4):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(5):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(6):
+	case ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(7):
 		lch_idx = cbits & 0x7;	/* SDCCH/8 */
 		if (ts->pchan != GSM_PCHAN_SDCCH8_SACCH8C &&
 		    ts->pchan != GSM_PCHAN_SDCCH8_SACCH8C_CBCH)
 			ok = false;
-	} else if (cbits == 0x10 || cbits == 0x11 || cbits == 0x12) {
+		break;
+	case ABIS_RSL_CHAN_NR_CBITS_BCCH:
+	case ABIS_RSL_CHAN_NR_CBITS_RACH:
+	case ABIS_RSL_CHAN_NR_CBITS_PCH_AGCH:
 		lch_idx = 0;
 		if (ts->pchan != GSM_PCHAN_CCCH &&
 		    ts->pchan != GSM_PCHAN_CCCH_SDCCH4 &&
 		    ts->pchan != GSM_PCHAN_CCCH_SDCCH4_CBCH)
 			ok = false;
 		/* FIXME: we should not return first sdcch4 !!! */
-	} else if ((chan_nr & RSL_CHAN_NR_MASK) == RSL_CHAN_OSMO_PDCH) {
+		break;
+	case ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCH:
 		lch_idx = 0;
 		if (ts->pchan != GSM_PCHAN_TCH_F_TCH_H_PDCH)
 			ok = false;
-	} else
+		break;
+	default:
 		return NULL;
+	}
 
 	if (rc && ok)
 		*rc = 0;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/24438
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I3160929c739a521fe494716c3da3d3b72370a98a
Gerrit-Change-Number: 24438
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210604/aef972c5/attachment.htm>


More information about the gerrit-log mailing list