aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_vty.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-07-21 21:56:23 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-21 22:15:28 +0200
commit717cdf540558b95f31e4c8ea58d0fc9e06429228 (patch)
treedd55b087f46cdd03418b6338bfcfdae3da5a1bff /src/pcu_vty.c
parent9530a404ce50fce6762dc64c12bb014fcfd43918 (diff)
Introduce GSMTAP categories
When looking at GSMTAP output so far, one is easily overwhelmed by way too much information being presented. A lot of is consists of DUMMY frames, which are probably of lowest interest, ever. A concept similar to the "gsmtap-sapi" of OsmoBTS is introduced, by which the user can configure which particular categories (uplink or downlink control or data, gprs or egprs, ...) he actually wants to see in his logs. Change-Id: I297183690e98a7234dfc1608c18847d8981306e4
Diffstat (limited to 'src/pcu_vty.c')
-rw-r--r--src/pcu_vty.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 3b5996c8..fc57a5f4 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -16,6 +16,70 @@
#include "pcu_vty_functions.h"
+extern void *tall_pcu_ctx;
+
+static const struct value_string pcu_gsmtap_categ_names[] = {
+ { PCU_GSMTAP_C_DL_UNKNOWN, "dl-unknown" },
+ { PCU_GSMTAP_C_DL_DUMMY, "dl-dummy" },
+ { PCU_GSMTAP_C_DL_CTRL, "dl-ctrl" },
+ { PCU_GSMTAP_C_DL_DATA_GPRS, "dl-data-gprs" },
+ { PCU_GSMTAP_C_DL_DATA_EGPRS, "dl-data-egprs" },
+
+ { PCU_GSMTAP_C_UL_UNKNOWN, "ul-unknown" },
+ { PCU_GSMTAP_C_UL_DUMMY, "ul-dummy" },
+ { PCU_GSMTAP_C_UL_CTRL, "ul-ctrl" },
+ { PCU_GSMTAP_C_UL_DATA_GPRS, "ul-data-gprs" },
+ { PCU_GSMTAP_C_UL_DATA_EGPRS, "ul-data-egprs" },
+
+ { 0, NULL }
+};
+
+static const struct value_string pcu_gsmtap_categ_help[] = {
+ { PCU_GSMTAP_C_DL_UNKNOWN, "Unknown / Unparseable / Erroneous Downlink Blocks" },
+ { PCU_GSMTAP_C_DL_DUMMY, "Downlink Dummy Blocks" },
+ { PCU_GSMTAP_C_DL_CTRL, "Downlink Control Blocks" },
+ { PCU_GSMTAP_C_DL_DATA_GPRS, "Downlink Data Blocks (GPRS)" },
+ { PCU_GSMTAP_C_DL_DATA_EGPRS, "Downlink Data Blocks (EGPRS)" },
+
+ { PCU_GSMTAP_C_UL_UNKNOWN, "Unknown / Unparseable / Erroneous Downlink Blocks" },
+ { PCU_GSMTAP_C_UL_DUMMY, "Uplink Dummy Blocks" },
+ { PCU_GSMTAP_C_UL_CTRL, "Uplink Control Blocks" },
+ { PCU_GSMTAP_C_UL_DATA_GPRS, "Uplink Data Blocks (GPRS)" },
+ { PCU_GSMTAP_C_UL_DATA_EGPRS, "Uplink Data Blocks (EGPRS)" },
+
+ { 0, NULL }
+};
+
+
+DEFUN(cfg_pcu_gsmtap_categ, cfg_pcu_gsmtap_categ_cmd, "HIDDEN", "HIDDEN")
+{
+ struct gprs_rlcmac_bts *bts = bts_main_data();
+ int categ;
+
+ categ = get_string_value(pcu_gsmtap_categ_names, argv[0]);
+ if (categ < 0)
+ return CMD_WARNING;
+
+ bts->gsmtap_categ_mask |= (1 << categ);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_pcu_no_gsmtap_categ, cfg_pcu_no_gsmtap_categ_cmd, "HIDDEN", "HIDDEN")
+{
+ struct gprs_rlcmac_bts *bts = bts_main_data();
+ int categ;
+
+ categ = get_string_value(pcu_gsmtap_categ_names, argv[0]);
+ if (categ < 0)
+ return CMD_WARNING;
+
+ bts->gsmtap_categ_mask &= ~(1 << categ);
+
+ return CMD_SUCCESS;
+}
+
+
int pcu_vty_go_parent(struct vty *vty)
{
switch (vty->node) {
@@ -53,6 +117,7 @@ static struct cmd_node pcu_node = {
static int config_write_pcu(struct vty *vty)
{
struct gprs_rlcmac_bts *bts = bts_main_data();
+ unsigned int i;
vty_out(vty, "pcu%s", VTY_NEWLINE);
if (bts->egprs_enabled)
@@ -167,6 +232,14 @@ static int config_write_pcu(struct vty *vty)
vty_out(vty, " dl-tbf-idle-time %d%s", bts->dl_tbf_idle_msec,
VTY_NEWLINE);
+ for (i = 0; i < 32; i++) {
+ unsigned int cs = (1 << i);
+ if (bts->gsmtap_categ_mask & cs) {
+ vty_out(vty, " gsmtap-category %s%s",
+ get_value_string(pcu_gsmtap_categ_names, i), VTY_NEWLINE);
+ }
+ }
+
return pcu_vty_config_write_pcu_ext(vty);
}
@@ -953,6 +1026,19 @@ int pcu_vty_init(const struct log_info *cat)
{
// install_element_ve(&show_pcu_cmd);
+ cfg_pcu_gsmtap_categ_cmd.string = vty_cmd_string_from_valstr(tall_pcu_ctx, pcu_gsmtap_categ_names,
+ "gsmtap-category (",
+ "|",")", VTY_DO_LOWER);
+ cfg_pcu_gsmtap_categ_cmd.doc = vty_cmd_string_from_valstr(tall_pcu_ctx, pcu_gsmtap_categ_help,
+ "GSMTAP Category\n",
+ "\n", "", 0);
+ cfg_pcu_no_gsmtap_categ_cmd.string = vty_cmd_string_from_valstr(tall_pcu_ctx, pcu_gsmtap_categ_names,
+ "no gsmtap-category (",
+ "|",")", VTY_DO_LOWER);
+ cfg_pcu_no_gsmtap_categ_cmd.doc = vty_cmd_string_from_valstr(tall_pcu_ctx, pcu_gsmtap_categ_help,
+ NO_STR "GSMTAP Category\n",
+ "\n", "", 0);
+
logging_vty_add_cmds(cat);
osmo_stats_vty_add_cmds(cat);
@@ -1006,6 +1092,8 @@ int pcu_vty_init(const struct log_info *cat)
install_element(PCU_NODE, &cfg_pcu_no_dl_tbf_idle_time_cmd);
install_element(PCU_NODE, &cfg_pcu_ms_idle_time_cmd);
install_element(PCU_NODE, &cfg_pcu_no_ms_idle_time_cmd);
+ install_element(PCU_NODE, &cfg_pcu_gsmtap_categ_cmd);
+ install_element(PCU_NODE, &cfg_pcu_no_gsmtap_categ_cmd);
install_element_ve(&show_bts_stats_cmd);
install_element_ve(&show_tbf_cmd);