aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-16 10:06:22 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-16 10:06:22 +0100
commitb293043e2d7a8205959ddfc31a723427eeffaa55 (patch)
tree2e1089f16ee8830a21cf9e8865955d754f4573c2 /src
parent85c1ea5cb6ff71b72ec8ff51f6d5c2546c96384a (diff)
parent80367aae175dbd171a77d1cde85924db68642e1b (diff)
Merge remote-tracking branch 'sysmocom/tbf-vty' into sysmocom/master
Diffstat (limited to 'src')
-rw-r--r--src/pcu_vty.c24
-rw-r--r--src/tbf.cpp22
-rw-r--r--src/tbf.h23
3 files changed, 68 insertions, 1 deletions
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 8a9255c5..041d5294 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -282,7 +282,28 @@ DEFUN(show_bts_stats,
{
vty_out_rate_ctr_group(vty, "", bts_main_data_stats());
return CMD_SUCCESS;
-}
+}
+
+DEFUN(show_tbf,
+ show_tbf_cmd,
+ "show tbf all",
+ SHOW_STR "information about all current TBFs\n")
+{
+ struct gprs_rlcmac_bts *bts = bts_main_data();
+ struct llist_head *tbf;
+
+ vty_out(vty, "UL TBFs%s", VTY_NEWLINE);
+ llist_for_each(tbf, &bts->ul_tbfs) {
+ tbf_print_vty_info(vty, tbf);
+ }
+
+ vty_out(vty, "%sDL TBFs%s", VTY_NEWLINE, VTY_NEWLINE);
+ llist_for_each(tbf, &bts->dl_tbfs) {
+ tbf_print_vty_info(vty, tbf);
+ }
+
+ return CMD_SUCCESS;
+}
static const char pcu_copyright[] =
"Copyright (C) 2012 by Ivan Kluchnikov <kluchnikovi@gmail.com> and \r\n"
@@ -322,6 +343,7 @@ int pcu_vty_init(const struct log_info *cat)
install_element(PCU_NODE, &ournode_end_cmd);
install_element_ve(&show_bts_stats_cmd);
+ install_element_ve(&show_tbf_cmd);
return 0;
}
diff --git a/src/tbf.cpp b/src/tbf.cpp
index dfd1c67b..fa9d2638 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -508,6 +508,7 @@ struct gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts,
if (!tbf)
return NULL;
+ tbf->m_create_ts = time(NULL);
tbf->bts = bts->bts;
tbf->direction = dir;
tbf->m_tfi = tfi;
@@ -1753,3 +1754,24 @@ uint8_t gprs_rlcmac_tbf::tsc() const
{
return trx->pdch[first_ts].tsc;
}
+
+void tbf_print_vty_info(struct vty *vty, llist_head *ltbf)
+{
+ gprs_rlcmac_tbf *tbf = llist_entry(ltbf, gprs_rlcmac_tbf, list);
+
+ vty_out(vty, "TBF: TFI=%d TLLI=0x%08x (%s) DIR=%s IMSI=%s%s", tbf->tfi(),
+ tbf->tlli(), tbf->is_tlli_valid() ? "valid" : "invalid",
+ tbf->direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL",
+ tbf->imsi(), VTY_NEWLINE);
+ vty_out(vty, " created=%lu state=%08x 1st_TS=%d 1st_cTS=%d ctrl_TS=%d "
+ "MS_CLASS=%d%s",
+ tbf->create_ts(), tbf->state_flags, tbf->first_ts,
+ tbf->first_common_ts, tbf->control_ts, tbf->ms_class,
+ VTY_NEWLINE);
+ vty_out(vty, " TS_alloc=");
+ for (int i = 0; i < 8; i++) {
+ if (tbf->pdch[i])
+ vty_out(vty, "%d ", i);
+ }
+ vty_out(vty, " CS=%d%s%s", tbf->cs, VTY_NEWLINE, VTY_NEWLINE);
+}
diff --git a/src/tbf.h b/src/tbf.h
index 02f0b444..5c8ec623 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -18,6 +18,8 @@
#pragma once
+#ifdef __cplusplus
+
#include "gprs_rlcmac.h"
#include "llc.h"
#include "rlc.h"
@@ -136,6 +138,8 @@ struct gprs_rlcmac_tbf {
uint16_t sns() const;
+ time_t create_ts() const;
+
/* attempt to make things a bit more fair */
void rotate_in_list();
@@ -223,6 +227,7 @@ struct gprs_rlcmac_tbf {
uint32_t m_tlli;
uint8_t m_tlli_valid;
uint8_t m_tfi;
+ time_t m_create_ts;
/* store IMSI for look-up and PCH retransmission */
char m_imsi[16];
@@ -309,3 +314,21 @@ inline uint16_t gprs_rlcmac_tbf::sns() const
const char *tbf_name(gprs_rlcmac_tbf *tbf);
+inline time_t gprs_rlcmac_tbf::create_ts() const
+{
+ return m_create_ts;
+}
+
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <osmocom/vty/command.h>
+#include <osmocom/vty/vty.h>
+
+
+ void tbf_print_vty_info(struct vty *vty, llist_head *tbf);
+#ifdef __cplusplus
+}
+#endif