From 2df65db3dab8545bd31dcbbed88fc156630ee246 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 25 Nov 2021 12:14:09 +0100 Subject: stats: add bsc.paging:expired Similar to paging:attempted, count paging:expired not only per BTS, but also for the whole BSC. Add active_paging_requests to struct bsc_subscr, to increase the counter only once if paging expires, and not once per BTS where paging expired. Related: SYS#4878 Change-Id: I9c118e7e3d61ed8c9f1951111255b196905eba4d --- include/osmocom/bsc/bsc_stats.h | 1 + include/osmocom/bsc/bsc_subscriber.h | 2 ++ src/osmo-bsc/bsc_stats.c | 1 + src/osmo-bsc/paging.c | 7 +++++++ 4 files changed, 11 insertions(+) diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h index 9140f852e..801a2c153 100644 --- a/include/osmocom/bsc/bsc_stats.h +++ b/include/osmocom/bsc/bsc_stats.h @@ -76,6 +76,7 @@ enum { BSC_CTR_PAGING_ATTEMPTED, BSC_CTR_PAGING_DETACHED, BSC_CTR_PAGING_RESPONDED, + BSC_CTR_PAGING_EXPIRED, BSC_CTR_PAGING_NO_ACTIVE_PAGING, BSC_CTR_UNKNOWN_UNIT_ID, BSC_CTR_MSCPOOL_SUBSCR_NO_MSC, diff --git a/include/osmocom/bsc/bsc_subscriber.h b/include/osmocom/bsc/bsc_subscriber.h index 6fffafdb3..f9e8eb2a8 100644 --- a/include/osmocom/bsc/bsc_subscriber.h +++ b/include/osmocom/bsc/bsc_subscriber.h @@ -17,6 +17,8 @@ struct bsc_subscr { char imsi[GSM23003_IMSI_MAX_DIGITS+1]; uint32_t tmsi; + + uint32_t active_paging_requests; }; const char *bsc_subscr_name(struct bsc_subscr *bsub); diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c index c789aead4..b48c90a00 100644 --- a/src/osmo-bsc/bsc_stats.c +++ b/src/osmo-bsc/bsc_stats.c @@ -93,6 +93,7 @@ const struct rate_ctr_desc bsc_ctr_description[] = { [BSC_CTR_PAGING_ATTEMPTED] = {"paging:attempted", "Paging attempts for a subscriber"}, [BSC_CTR_PAGING_DETACHED] = {"paging:detached", "Paging request send failures because no responsible BTS was found"}, [BSC_CTR_PAGING_RESPONDED] = {"paging:responded", "Paging attempts with successful response"}, + [BSC_CTR_PAGING_EXPIRED] = {"paging:expired", "Paging Request expired because of timeout T3113"}, [BSC_CTR_PAGING_NO_ACTIVE_PAGING] = {"paging:no_active_paging", "Paging response without an active paging request (arrived after paging expiration?)"}, [BSC_CTR_UNKNOWN_UNIT_ID] = {"abis:unknown_unit_id", "Connection attempts from unknown IPA CCM Unit ID"}, diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index 04512be92..721ea31f2 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -66,6 +66,7 @@ void *tall_paging_ctx = NULL; static void paging_remove_request(struct gsm_bts_paging_state *paging_bts, struct gsm_paging_request *to_be_deleted) { + to_be_deleted->bsub->active_paging_requests--; osmo_timer_del(&to_be_deleted->T3113); llist_del(&to_be_deleted->entry); bsc_subscr_put(to_be_deleted->bsub, BSUB_USE_PAGING_REQUEST); @@ -284,6 +285,11 @@ static void paging_T3113_expired(void *data) /* must be destroyed before calling cbfn, to prevent double free */ rate_ctr_inc(rate_ctr_group_get_ctr(req->bts->bts_ctrs, BTS_CTR_PAGING_EXPIRED)); + /* If last BTS paging times out (active_paging_requests will be + * decremented in paging_remove_request below): */ + if (req->bsub->active_paging_requests == 1) + rate_ctr_inc(rate_ctr_group_get_ctr(bsc_gsmnet->bsc_ctrs, BSC_CTR_PAGING_EXPIRED)); + /* destroy it now. Do not access req afterwards */ paging_remove_request(&req->bts->paging, req); @@ -341,6 +347,7 @@ static int _paging_request(const struct bsc_paging_params *params, struct gsm_bt } LOG_PAGING_BTS(params, bts, DPAG, LOGL_DEBUG, "Start paging\n"); + params->bsub->active_paging_requests++; req = talloc_zero(tall_paging_ctx, struct gsm_paging_request); OSMO_ASSERT(req); req->reason = params->reason; -- cgit v1.2.3