Change in osmo-bsc[master]: Count handover per BTS as well as per BSC

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

laforge gerrit-no-reply at lists.osmocom.org
Mon Aug 24 07:41:44 UTC 2020


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

Change subject: Count handover per BTS as well as per BSC
......................................................................

Count handover per BTS as well as per BSC

Our current handover counters only count success/failures per BSC. It
would be nice to also count which BTS is part of a (successful/failed)
handover.

This patch duplicates the BSC counters for the BTS and changes the
ho_count and related macros to also count per BTS. If a BTS is NULL
(when conn->lchan is NULL) counting for the BTS is ignored.

Change-Id: I025ef14e2cfd2eea8880212c9406372ce0bf9296
Related: SYS#4877
---
M include/osmocom/bsc/bts.h
M src/osmo-bsc/bsc_subscr_conn_fsm.c
M src/osmo-bsc/handover_fsm.c
3 files changed, 132 insertions(+), 24 deletions(-)

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



diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 16053a3..46a173d 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -68,6 +68,25 @@
 	BTS_CTR_ASSIGNMENT_TIMEOUT,
 	BTS_CTR_ASSIGNMENT_FAILED,
 	BTS_CTR_ASSIGNMENT_ERROR,
+	BTS_CTR_HANDOVER_ATTEMPTED,
+	BTS_CTR_HANDOVER_COMPLETED,
+	BTS_CTR_HANDOVER_STOPPED,
+	BTS_CTR_HANDOVER_NO_CHANNEL,
+	BTS_CTR_HANDOVER_TIMEOUT,
+	BTS_CTR_HANDOVER_FAILED,
+	BTS_CTR_HANDOVER_ERROR,
+	BTS_CTR_INTER_BSC_HO_OUT_ATTEMPTED,
+	BTS_CTR_INTER_BSC_HO_OUT_COMPLETED,
+	BTS_CTR_INTER_BSC_HO_OUT_STOPPED,
+	BTS_CTR_INTER_BSC_HO_OUT_TIMEOUT,
+	BTS_CTR_INTER_BSC_HO_OUT_ERROR,
+	BTS_CTR_INTER_BSC_HO_IN_ATTEMPTED,
+	BTS_CTR_INTER_BSC_HO_IN_COMPLETED,
+	BTS_CTR_INTER_BSC_HO_IN_STOPPED,
+	BTS_CTR_INTER_BSC_HO_IN_NO_CHANNEL,
+	BTS_CTR_INTER_BSC_HO_IN_FAILED,
+	BTS_CTR_INTER_BSC_HO_IN_TIMEOUT,
+	BTS_CTR_INTER_BSC_HO_IN_ERROR,
 };
 
 static const struct rate_ctr_desc bts_ctr_description[] = {
@@ -127,6 +146,34 @@
 	[BTS_CTR_ASSIGNMENT_FAILED] =                {"assignment:failed", "Received Assignment Failure message"},
 	[BTS_CTR_ASSIGNMENT_ERROR] =                 {"assignment:error", "Assignment failed for other reason"},
 
+	[BTS_CTR_HANDOVER_ATTEMPTED] = 		{"handover:attempted", "Intra-BSC handover attempts"},
+	[BTS_CTR_HANDOVER_COMPLETED] = 		{"handover:completed", "Intra-BSC handover completed"},
+	[BTS_CTR_HANDOVER_STOPPED] = 		{"handover:stopped", "Connection ended during HO"},
+	[BTS_CTR_HANDOVER_NO_CHANNEL] = 	{"handover:no_channel", "Failure to allocate lchan for HO"},
+	[BTS_CTR_HANDOVER_TIMEOUT] = 		{"handover:timeout", "Handover timed out"},
+	[BTS_CTR_HANDOVER_FAILED] = 		{"handover:failed", "Received Handover Fail messages"},
+	[BTS_CTR_HANDOVER_ERROR] = 		{"handover:error", "Re-assignment failed for other reason"},
+
+	[BTS_CTR_INTER_BSC_HO_OUT_ATTEMPTED] =	{"interbsc_ho_out:attempted",
+						 "Attempts to handover to remote BSS"},
+	[BTS_CTR_INTER_BSC_HO_OUT_COMPLETED] =	{"interbsc_ho_out:completed",
+						 "Handover to remote BSS completed"},
+	[BTS_CTR_INTER_BSC_HO_OUT_STOPPED] =	{"interbsc_ho_out:stopped", "Connection ended during HO"},
+	[BTS_CTR_INTER_BSC_HO_OUT_TIMEOUT] =	{"interbsc_ho_out:timeout", "Handover timed out"},
+	[BTS_CTR_INTER_BSC_HO_OUT_ERROR] =	{"interbsc_ho_out:error",
+						 "Handover to remote BSS failed for other reason"},
+
+	[BTS_CTR_INTER_BSC_HO_IN_ATTEMPTED] =	{"interbsc_ho_in:attempted",
+						 "Attempts to handover from remote BSS"},
+	[BTS_CTR_INTER_BSC_HO_IN_COMPLETED] =	{"interbsc_ho_in:completed",
+						 "Handover from remote BSS completed"},
+	[BTS_CTR_INTER_BSC_HO_IN_STOPPED] =	{"interbsc_ho_in:stopped", "Connection ended during HO"},
+	[BTS_CTR_INTER_BSC_HO_IN_NO_CHANNEL] =	{"interbsc_ho_in:no_channel",
+						 "Failure to allocate lchan for HO"},
+	[BTS_CTR_INTER_BSC_HO_IN_TIMEOUT] =	{"interbsc_ho_in:timeout", "Handover from remote BSS timed out"},
+	[BTS_CTR_INTER_BSC_HO_IN_FAILED] =	{"interbsc_ho_in:failed", "Received Handover Fail message"},
+	[BTS_CTR_INTER_BSC_HO_IN_ERROR] =	{"interbsc_ho_in:error",
+						 "Handover from remote BSS failed for other reason"},
 };
 
 static const struct rate_ctr_group_desc bts_ctrg_desc = {
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index bd0b534..04718da 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -382,7 +382,11 @@
 		return;
 
 	case GSCON_EV_HANDOVER_START:
+		bts = conn_get_bts(conn);
 		rate_ctr_inc(&conn->network->bsc_ctrs->ctr[BSC_CTR_HANDOVER_ATTEMPTED]);
+		if (bts)
+			rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_HANDOVER_ATTEMPTED]);
+
 		/* Rely on handover_fsm timeout */
 		if (osmo_fsm_inst_state_chg(fi, ST_HANDOVER, 0, 0))
 			LOGPFSML(fi, LOGL_ERROR, "Cannot transition to HANDOVER state, discarding\n");
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 8ed5945..c3cbd61 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -80,13 +80,29 @@
 
 /* Assume presence of local var 'conn' as struct gsm_subscriber_connection.
  * This is a macro to preserve the source file and line number in logging. */
-#define ho_count(counter) do { \
-		LOG_HO(conn, LOGL_DEBUG, "incrementing rate counter: %s %s\n", \
+#define ho_count_bsc(counter) do { \
+		LOG_HO(conn, LOGL_DEBUG, "(BSC) incrementing rate counter: %s %s\n", \
 		       bsc_ctr_description[counter].name, \
 		       bsc_ctr_description[counter].description); \
 		rate_ctr_inc(&conn->network->bsc_ctrs->ctr[counter]); \
 	} while(0)
 
+/* Assume presence of local var 'conn' as struct gsm_subscriber_connection.
+ * Handles bts == NULL gracefully
+ * This is a macro to preserve the source file and line number in logging. */
+#define ho_count_bts(bts, counter) do { \
+		LOG_HO(conn, LOGL_DEBUG, "(BTS) incrementing rate counter: %s %s\n", \
+		       bts_ctr_description[counter].name, \
+		       bts_ctr_description[counter].description); \
+		if (bts) \
+			rate_ctr_inc(&bts->bts_ctrs->ctr[counter]); \
+	} while(0)
+
+#define ho_count(bts, counter) do { \
+        ho_count_bsc(BSC_##counter); \
+        ho_count_bts(bts, BTS_##counter); \
+} while(0)
+
 static uint8_t g_next_ho_ref = 1;
 
 const char *handover_status(struct gsm_subscriber_connection *conn)
@@ -341,6 +357,7 @@
 	struct handover *ho = &conn->ho;
 	struct osmo_fsm_inst *fi = conn->ho.fi;
 	struct lchan_activate_info info;
+        struct gsm_bts *bts = conn_get_bts(conn);
 
 	OSMO_ASSERT(ho->new_bts);
 	OSMO_ASSERT(ho->new_lchan_type != GSM_LCHAN_NONE);
@@ -357,7 +374,7 @@
 	else
 		ho_fsm_update_id(fi, "intraBSC");
 
-	ho_count(BSC_CTR_HANDOVER_ATTEMPTED);
+	ho_count(bts, CTR_HANDOVER_ATTEMPTED);
 
 	if (!ho->new_lchan) {
 		ho_fail(HO_RESULT_FAIL_NO_CHANNEL,
@@ -570,8 +587,6 @@
 		return;
 	}
 
-	ho_count(BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED);
-
 	/* Figure out which cell to handover to. */
 	for (match_idx = 0; ; match_idx++) {
 		struct gsm_bts *bts;
@@ -612,6 +627,8 @@
 		break;
 	}
 
+	ho_count(ho->new_bts, CTR_INTER_BSC_HO_IN_ATTEMPTED);
+
 	if (!ho->new_bts) {
 		ho_fail(HO_RESULT_ERROR, "No local cell matches the target %s",
 			req->cell_id_target_name);
@@ -660,31 +677,31 @@
 	lchan_activate(ho->new_lchan, &info);
 }
 
-#define FUNC_RESULT_COUNTER(name) \
-static int result_counter_##name(enum handover_result result) \
+#define FUNC_RESULT_COUNTER(obj, name) \
+static int result_counter_##obj##_##name(enum handover_result result) \
 { \
 	switch (result) { \
 	case HO_RESULT_OK: \
-		return BSC_CTR_##name##_COMPLETED; \
+		return obj##_CTR_##name##_COMPLETED; \
 	case HO_RESULT_FAIL_NO_CHANNEL: \
-		return BSC_CTR_##name##_NO_CHANNEL; \
+		return obj##_CTR_##name##_NO_CHANNEL; \
 	case HO_RESULT_FAIL_RR_HO_FAIL: \
-		return BSC_CTR_##name##_FAILED; \
+		return obj##_CTR_##name##_FAILED; \
 	case HO_RESULT_FAIL_TIMEOUT: \
-		return BSC_CTR_##name##_TIMEOUT; \
+		return obj##_CTR_##name##_TIMEOUT; \
 	case HO_RESULT_CONN_RELEASE: \
-		return BSC_CTR_##name##_STOPPED; \
+		return obj##_CTR_##name##_STOPPED; \
 	default: \
 	case HO_RESULT_ERROR: \
-		return BSC_CTR_##name##_ERROR; \
+		return obj##_CTR_##name##_ERROR; \
 	} \
 }
 
-FUNC_RESULT_COUNTER(ASSIGNMENT)
-FUNC_RESULT_COUNTER(HANDOVER)
-FUNC_RESULT_COUNTER(INTER_BSC_HO_IN)
+FUNC_RESULT_COUNTER(BSC, ASSIGNMENT)
+FUNC_RESULT_COUNTER(BSC, HANDOVER)
+FUNC_RESULT_COUNTER(BSC, INTER_BSC_HO_IN)
 
-static int result_counter_INTER_BSC_HO_OUT(enum handover_result result) {
+static int result_counter_BSC_INTER_BSC_HO_OUT(enum handover_result result) {
 	switch (result) {
 	case HO_RESULT_OK:
 		return BSC_CTR_INTER_BSC_HO_OUT_COMPLETED;
@@ -698,22 +715,59 @@
 	}
 }
 
-static int result_counter(enum handover_scope scope, enum handover_result result)
+static int result_counter_bsc(enum handover_scope scope, enum handover_result result)
 {
 	switch (scope) {
 	case HO_INTRA_CELL:
-		return result_counter_ASSIGNMENT(result);
+		return result_counter_BSC_ASSIGNMENT(result);
 	default:
 		LOGP(DHO, LOGL_ERROR, "invalid enum handover_scope value: %s\n",
 		     handover_scope_name(scope));
 		/* use "normal" HO_INTRA_BSC counter... */
 	case HO_NO_HANDOVER:
 	case HO_INTRA_BSC:
-		return result_counter_HANDOVER(result);
+		return result_counter_BSC_HANDOVER(result);
 	case HO_INTER_BSC_OUT:
-		return result_counter_INTER_BSC_HO_OUT(result);
+		return result_counter_BSC_INTER_BSC_HO_OUT(result);
 	case HO_INTER_BSC_IN:
-		return result_counter_INTER_BSC_HO_IN(result);
+		return result_counter_BSC_INTER_BSC_HO_IN(result);
+	}
+}
+
+FUNC_RESULT_COUNTER(BTS, ASSIGNMENT)
+FUNC_RESULT_COUNTER(BTS, HANDOVER)
+FUNC_RESULT_COUNTER(BTS, INTER_BSC_HO_IN)
+
+static int result_counter_BTS_INTER_BSC_HO_OUT(enum handover_result result) {
+	switch (result) {
+	case HO_RESULT_OK:
+		return BTS_CTR_INTER_BSC_HO_OUT_COMPLETED;
+	case HO_RESULT_FAIL_TIMEOUT:
+		return BTS_CTR_INTER_BSC_HO_OUT_TIMEOUT;
+	case HO_RESULT_CONN_RELEASE:
+		return BTS_CTR_INTER_BSC_HO_OUT_STOPPED;
+	default:
+	case HO_RESULT_ERROR:
+		return BTS_CTR_INTER_BSC_HO_OUT_ERROR;
+	}
+}
+
+static int result_counter_bts(enum handover_scope scope, enum handover_result result)
+{
+	switch (scope) {
+	case HO_INTRA_CELL:
+		return result_counter_BTS_ASSIGNMENT(result);
+	default:
+		LOGP(DHO, LOGL_ERROR, "invalid enum handover_scope value: %s\n",
+		     handover_scope_name(scope));
+		/* use "normal" HO_INTRA_BSC counter... */
+	case HO_NO_HANDOVER:
+	case HO_INTRA_BSC:
+		return result_counter_BTS_HANDOVER(result);
+	case HO_INTER_BSC_OUT:
+		return result_counter_BTS_INTER_BSC_HO_OUT(result);
+	case HO_INTER_BSC_IN:
+		return result_counter_BTS_INTER_BSC_HO_IN(result);
 	}
 }
 
@@ -787,6 +841,7 @@
 {
 	struct handover_decision_callbacks *hdc;
 	struct handover *ho = &conn->ho;
+	struct gsm_bts *bts = conn_get_bts(conn);
 
 	/* Sanity -- an error result ensures beyond doubt that we don't use the new lchan below
 	 * when the handover isn't actually allowed to change this conn. */
@@ -858,7 +913,8 @@
 	if (hdc && hdc->on_handover_end)
 		hdc->on_handover_end(conn, result);
 
-	ho_count(result_counter(ho->scope, result));
+	ho_count_bsc(result_counter_bsc(ho->scope, result));
+	ho_count_bts(bts, result_counter_bts(ho->scope, result));
 
 	LOG_HO(conn, LOGL_INFO, "Result: %s\n", handover_result_name(result));
 
@@ -1143,10 +1199,11 @@
 	int rc;
 	struct handover *ho = &conn->ho;
 	struct osmo_fsm_inst *fi = conn->ho.fi;
+	struct gsm_bts *bts = conn_get_bts(conn);
 
 	ho->scope = HO_INTER_BSC_OUT;
 	ho_fsm_update_id(fi, "interBSCout");
-	ho_count(BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED);
+	ho_count(bts, CTR_INTER_BSC_HO_OUT_ATTEMPTED);
 
 	rc = bsc_tx_bssmap_ho_required(conn->lchan, target_cells);
 	if (rc) {

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I025ef14e2cfd2eea8880212c9406372ce0bf9296
Gerrit-Change-Number: 19736
Gerrit-PatchSet: 3
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20200824/e3be1f8d/attachment.htm>


More information about the gerrit-log mailing list