aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_vty_functions.cpp
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-10-09 21:52:50 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-10-09 22:00:54 +0700
commitcef2f843b4236517c6b43365de4c6a8f119a20be (patch)
treee37211fd6a3aba90bce5d9fb674bed4de9497b6d /src/pcu_vty_functions.cpp
parentafbf189ef28a3f9fd7a95bdf88b90be8e7eb0c5b (diff)
VTY: fix command 'show tbf all': properly filter TBFs
For a long time the VTY command to show all active TBFs was broken. The TBF filtering (by allocation origin) logic allows one to show TBFs allocated on CCCH, PACCH, or on both of them. In the latter case we have been checking whether a TBF was allocated on both logical channels at the same time. Let's fix this by passing a flag-mask instead of boolean arguments. To be able to use GPRS_RLCMAC_FLAG_* definitions from "tbf.h", let's exclude them from "#ifdef __cplusplus ... #endif" block. Change-Id: I1c9f401368af880a97d32905c4cce0da481ffc21
Diffstat (limited to 'src/pcu_vty_functions.cpp')
-rw-r--r--src/pcu_vty_functions.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index fd8474be..7b6c84fd 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -45,17 +45,11 @@ extern "C" {
#include "coding_scheme.h"
}
-static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf, bool show_ccch, bool show_pacch)
+static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf)
{
gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf);
gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
- if (show_ccch && !(tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
- return;
-
- if (show_pacch && !(tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH)))
- return;
-
vty_out(vty, "TBF: TFI=%d TLLI=0x%08x (%s) TA=%u DIR=%s IMSI=%s%s", tbf->tfi(),
tbf->tlli(), tbf->is_tlli_valid() ? "valid" : "invalid",
tbf->ta(),
@@ -108,18 +102,22 @@ static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf, bool show_
vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE);
}
-int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data, bool show_ccch, bool show_pacch)
+int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data, uint32_t flags)
{
BTS *bts = bts_data->bts;
- LListHead<gprs_rlcmac_tbf> *ms_iter;
+ LListHead<gprs_rlcmac_tbf> *iter;
vty_out(vty, "UL TBFs%s", VTY_NEWLINE);
- llist_for_each(ms_iter, &bts->ul_tbfs())
- tbf_print_vty_info(vty, ms_iter->entry(), show_ccch, show_pacch);
+ llist_for_each(iter, &bts->ul_tbfs()) {
+ if (iter->entry()->state_flags & flags)
+ tbf_print_vty_info(vty, iter->entry());
+ }
vty_out(vty, "%sDL TBFs%s", VTY_NEWLINE, VTY_NEWLINE);
- llist_for_each(ms_iter, &bts->dl_tbfs())
- tbf_print_vty_info(vty, ms_iter->entry(), show_ccch, show_pacch);
+ llist_for_each(iter, &bts->dl_tbfs()) {
+ if (iter->entry()->state_flags & flags)
+ tbf_print_vty_info(vty, iter->entry());
+ }
return CMD_SUCCESS;
}