From 7cb6867ea3fa61d738c7878b329c84e73949be3f Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 19 Apr 2010 16:20:28 +0800 Subject: [vty] Count pending paging requests for the vty Implement a method to count the number of pending paging requests per bts and print it on the VTY. This helps to see how big the backlog of requests is for a given BTS. --- openbsc/include/openbsc/paging.h | 3 +++ openbsc/src/paging.c | 12 ++++++++++++ openbsc/src/vty_interface.c | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/openbsc/include/openbsc/paging.h b/openbsc/include/openbsc/paging.h index 6cbdca902..eae8b4a78 100644 --- a/openbsc/include/openbsc/paging.h +++ b/openbsc/include/openbsc/paging.h @@ -43,4 +43,7 @@ void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, /* update paging load */ void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t); +/* pending paging requests */ +unsigned int paging_pending_requests_nr(struct gsm_bts *bts); + #endif diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c index 9a4f3657b..f6cf1fd1d 100644 --- a/openbsc/src/paging.c +++ b/openbsc/src/paging.c @@ -326,3 +326,15 @@ void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots) { bts->paging.available_slots = free_slots; } + +unsigned int paging_pending_requests_nr(struct gsm_bts *bts) +{ + unsigned int requests = 0; + + struct gsm_paging_request *req; + + llist_for_each_entry(req, &bts->paging.pending_requests, entry) + ++requests; + + return requests; +} diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index 775ef1042..37126105a 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -40,6 +40,7 @@ #include #include #include +#include static struct gsm_network *gsmnet; @@ -196,7 +197,8 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) net_dump_nmstate(vty, &bts->nm_state); vty_out(vty, " Site Mgr NM State: "); net_dump_nmstate(vty, &bts->site_mgr.nm_state); - vty_out(vty, " Paging: FIXME pending requests, %u free slots%s", + vty_out(vty, " Paging: %u pending requests, %u free slots%s", + paging_pending_requests_nr(bts), bts->paging.available_slots, VTY_NEWLINE); if (!is_ipaccess_bts(bts)) { vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE); -- cgit v1.2.3