From 01c06a916385676a09bc0e20bbe5b807b3aef4b2 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 29 Aug 2020 02:21:36 +0000 Subject: fix 'handover:*' counters: remove bogus increments To handle cases of unknown handover type (like failure to find the target cell), return -1 as counter code; treat -1 as skipping in ho_count_bsc() and ho_count_bts(). The handover:* counters indicate overall counts, without knowing whether inter- or intra-BSC, or whether the target ARFCN even exists. So they need to be counted separately, and must not serve as fallback category in result_counter_bsc() and result_counter_bts(). Related: OS#4736 Change-Id: Ie311e599d7bd35d33cf471c6c63e649246e8396a --- src/osmo-bsc/handover_fsm.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c index 9ab96e316..7e461477b 100644 --- a/src/osmo-bsc/handover_fsm.c +++ b/src/osmo-bsc/handover_fsm.c @@ -81,6 +81,9 @@ /* 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_bsc(counter) do { \ + /* If a handover target could not be found, the counter index may be -1. */ \ + if (counter < 0) \ + break; \ LOG_HO(conn, LOGL_DEBUG, "(BSC) incrementing rate counter: %s %s\n", \ bsc_ctr_description[counter].name, \ bsc_ctr_description[counter].description); \ @@ -91,6 +94,9 @@ * 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 { \ + /* If a handover target could not be found, the counter index may be -1. */ \ + if (counter < 0) \ + break; \ LOG_HO(conn, LOGL_DEBUG, "(BTS) incrementing rate counter: %s %s\n", \ bts_ctr_description[counter].name, \ bts_ctr_description[counter].description); \ @@ -724,11 +730,7 @@ static int result_counter_bsc(enum handover_scope scope, enum handover_result re { switch (scope) { default: - LOGP(DHO, LOGL_ERROR, "invalid enum handover_scope value: %s\n", - handover_scope_name(scope)); - /* use "normal" HO counter... */ - case HO_NO_HANDOVER: - return result_counter_BSC_HANDOVER(result); + return -1; case HO_INTRA_CELL: return result_counter_BSC_INTRA_CELL_HO(result); case HO_INTRA_BSC: @@ -763,11 +765,7 @@ static int result_counter_bts(enum handover_scope scope, enum handover_result re { switch (scope) { default: - LOGP(DHO, LOGL_ERROR, "invalid enum handover_scope value: %s\n", - handover_scope_name(scope)); - /* use "normal" HO counter... */ - case HO_NO_HANDOVER: - return result_counter_BTS_HANDOVER(result); + return -1; case HO_INTRA_CELL: return result_counter_BTS_INTRA_CELL_HO(result); case HO_INTRA_BSC: -- cgit v1.2.3