Change in osmo-bsc[master]: remove special case from assignment_count_result()

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 1 17:29:35 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24353 )

Change subject: remove special case from assignment_count_result()
......................................................................

remove special case from assignment_count_result()

The single place that calls this special case is now actually doing the
exact same thing as the general case, and this is merely code dup.

Related: SYS#5315 OS#4940
Change-Id: Ic62e8a48d3c88a1966086240a41732d169328491
---
M src/osmo-bsc/assignment_fsm.c
1 file changed, 13 insertions(+), 27 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  laforge: Looks good to me, approved



diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index aeb9a24..f294473 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -84,19 +84,17 @@
 		rate_ctr_inc(&conn->network->bsc_ctrs->ctr[BSC_##counter]); \
 		if (bts) { \
 			rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_##counter]); \
-			if (BTS_##counter != BTS_CTR_ASSIGNMENT_NO_CHANNEL) { \
-				switch (conn->assignment.req.ch_mode_rate_list[0].chan_mode) { \
-				case GSM48_CMODE_SIGN: \
-					rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_##counter##_SIGN]); \
-					break; \
-				case GSM48_CMODE_SPEECH_V1: \
-				case GSM48_CMODE_SPEECH_EFR: \
-				case GSM48_CMODE_SPEECH_AMR: \
-					rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_##counter##_SPEECH]); \
-					break; \
-				default: \
-					break; \
-				} \
+			switch (conn->assignment.req.ch_mode_rate_list[0].chan_mode) { \
+			case GSM48_CMODE_SIGN: \
+				rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_##counter##_SIGN]); \
+				break; \
+			case GSM48_CMODE_SPEECH_V1: \
+			case GSM48_CMODE_SPEECH_EFR: \
+			case GSM48_CMODE_SPEECH_AMR: \
+				rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_##counter##_SPEECH]); \
+				break; \
+			default: \
+				break; \
 			} \
 		} \
 	} while(0)
@@ -458,8 +456,6 @@
 	OSMO_ASSERT(!conn->assignment.fi);
 	OSMO_ASSERT(!conn->assignment.new_lchan);
 
-	assignment_count(CTR_ASSIGNMENT_ATTEMPTED);
-
 	fi = osmo_fsm_inst_alloc_child(&assignment_fsm, conn->fi, GSCON_EV_ASSIGNMENT_END);
 	OSMO_ASSERT(fi);
 	conn->assignment.fi = fi;
@@ -469,6 +465,8 @@
 	conn->assignment.req = *req;
 	req = &conn->assignment.req;
 
+	assignment_count(CTR_ASSIGNMENT_ATTEMPTED);
+
 	/* Check if we need a voice stream. If yes, set the appropriate struct
 	 * members in conn */
 	if (check_requires_voice_stream(conn) < 0)
@@ -544,18 +542,6 @@
 	 * down the assignment in case of failure. */
 	if (!conn->assignment.new_lchan) {
 		assignment_count_result(CTR_ASSIGNMENT_NO_CHANNEL);
-		switch (req->ch_mode_rate_list[0].chan_mode) {
-		case GSM48_CMODE_SIGN:
-			rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_ASSIGNMENT_NO_CHANNEL_SIGN]);
-			break;
-		case GSM48_CMODE_SPEECH_V1:
-		case GSM48_CMODE_SPEECH_EFR:
-		case GSM48_CMODE_SPEECH_AMR:
-			rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_ASSIGNMENT_NO_CHANNEL_SPEECH]);
-			break;
-		default:
-			break;
-		}
 		assignment_fail(GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE,
 				"BSSMAP Assignment Command:"
 				" No lchan available for: pref=%s:%s / alt1=%s:%s / alt2=%s:%s\n",

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic62e8a48d3c88a1966086240a41732d169328491
Gerrit-Change-Number: 24353
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210601/7fb1b9cf/attachment.htm>


More information about the gerrit-log mailing list