From 9f972a5fb01d98c920f577c60e5995bd42a3a26e Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 14 Jun 2010 17:00:35 +0800 Subject: vty: Add show lchan-status to show the status... Sometimes we see channels being allocated and never be freed. This command should help to understand why this is happening and in which state this channel is. --- openbsc/src/vty_interface.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'openbsc') diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c index 880c9910d..945b571a6 100644 --- a/openbsc/src/vty_interface.c +++ b/openbsc/src/vty_interface.c @@ -779,6 +779,17 @@ static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan) VTY_NEWLINE); } +static void lchan_dump_status_vty(struct vty *vty, struct gsm_lchan *lchan) +{ + vty_out(vty, "Lchan: %u/%u/%u/%u Type: %s State: %s ref: %u Subscriber: %d " + "Time: %lu %s", + lchan->nr, lchan->ts->nr, lchan->ts->trx->nr, + lchan->ts->trx->bts->nr, gsm_lchant_name(lchan->type), + gsm_lchans_name(lchan->state), lchan->conn.use_count, + lchan->conn.subscr != NULL, (unsigned long) lchan->alloc_time.tv_sec, + VTY_NEWLINE); +} + static int lchan_summary(struct vty *vty, int argc, const char **argv, void (*dump_cb)(struct vty *, struct gsm_lchan *)) { @@ -865,6 +876,14 @@ DEFUN(show_lchan_summary, return lchan_summary(vty, argc, argv, lchan_dump_short_vty); } +DEFUN(show_lchan_status, + show_lchan_status_cmd, + "show lchan-status [bts_nr] [trx_nr] [ts_nr] [lchan_nr]", + SHOW_STR "Display a short stat about a logical channel\n") +{ + return lchan_summary(vty, argc, argv, lchan_dump_status_vty); +} + static void e1drv_dump_vty(struct vty *vty, struct e1inp_driver *drv) { vty_out(vty, "E1 Input Driver %s%s", drv->name, VTY_NEWLINE); @@ -2171,6 +2190,7 @@ int bsc_vty_init(struct gsm_network *net) install_element(VIEW_NODE, &show_ts_cmd); install_element(VIEW_NODE, &show_lchan_cmd); install_element(VIEW_NODE, &show_lchan_summary_cmd); + install_element(VIEW_NODE, &show_lchan_status_cmd); install_element(VIEW_NODE, &show_e1drv_cmd); install_element(VIEW_NODE, &show_e1line_cmd); -- cgit v1.2.3