<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/6239">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Harald Welte: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">vty: add commands to show TBF of a certain kind<br><br>Add vty commands to show only TBFs allocated via PACCH or CCCH.<br><br>Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312<br>Related: OS#1759<br>---<br>M src/pcu_vty.c<br>M src/pcu_vty_functions.cpp<br>M src/pcu_vty_functions.h<br>3 files changed, 23 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/pcu_vty.c b/src/pcu_vty.c</span><br><span>index 960c90d..3a733ef 100644</span><br><span>--- a/src/pcu_vty.c</span><br><span>+++ b/src/pcu_vty.c</span><br><span>@@ -1083,11 +1083,20 @@</span><br><span> </span><br><span> DEFUN(show_tbf,</span><br><span>       show_tbf_cmd,</span><br><span style="color: hsl(0, 100%, 40%);">-      "show tbf all",</span><br><span style="color: hsl(0, 100%, 40%);">-      SHOW_STR "information about TBFs\n" "All TBFs\n")</span><br><span style="color: hsl(120, 100%, 40%);">+      "show tbf (all|ccch|pacch)",</span><br><span style="color: hsl(120, 100%, 40%);">+      SHOW_STR "information about TBFs\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "All TBFs\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "TBFs allocated via CCCH\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "TBFs allocated via PACCH\n")</span><br><span> {</span><br><span>  struct gprs_rlcmac_bts *bts = bts_main_data();</span><br><span style="color: hsl(0, 100%, 40%);">-  return pcu_vty_show_tbf_all(vty, bts);</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!strcmp(argv[0], "all"))</span><br><span style="color: hsl(120, 100%, 40%);">+                return pcu_vty_show_tbf_all(vty, bts, true, true);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if (!strcmp(argv[0], "ccch"))</span><br><span style="color: hsl(120, 100%, 40%);">+               return pcu_vty_show_tbf_all(vty, bts_main_data(), true, false);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     return pcu_vty_show_tbf_all(vty, bts_main_data(), false, true);</span><br><span> }</span><br><span> </span><br><span> DEFUN(show_ms_all,</span><br><span>diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp</span><br><span>index c93935d..98e8185 100644</span><br><span>--- a/src/pcu_vty_functions.cpp</span><br><span>+++ b/src/pcu_vty_functions.cpp</span><br><span>@@ -44,11 +44,17 @@</span><br><span>        #include "coding_scheme.h"</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf)</span><br><span style="color: hsl(120, 100%, 40%);">+static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf, bool show_ccch, bool show_pacch)</span><br><span> {</span><br><span>      gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf);</span><br><span>         gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      if (show_ccch && !(tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))</span><br><span style="color: hsl(120, 100%, 40%);">+             return;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     if (show_pacch && !(tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH)))</span><br><span style="color: hsl(120, 100%, 40%);">+           return;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>    vty_out(vty, "TBF: TFI=%d TLLI=0x%08x (%s) TA=%u DIR=%s IMSI=%s%s", tbf->tfi(),</span><br><span>                         tbf->tlli(), tbf->is_tlli_valid() ? "valid" : "invalid",</span><br><span>                   tbf->ta(),</span><br><span>@@ -101,18 +107,18 @@</span><br><span>        vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data)</span><br><span style="color: hsl(120, 100%, 40%);">+int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data, bool show_ccch, bool show_pacch)</span><br><span> {</span><br><span>     BTS *bts = bts_data->bts;</span><br><span>         LListHead<gprs_rlcmac_tbf> *ms_iter;</span><br><span> </span><br><span>       vty_out(vty, "UL TBFs%s", VTY_NEWLINE);</span><br><span>    llist_for_each(ms_iter, &bts->ul_tbfs())</span><br><span style="color: hsl(0, 100%, 40%);">-         tbf_print_vty_info(vty, ms_iter->entry());</span><br><span style="color: hsl(120, 100%, 40%);">+         tbf_print_vty_info(vty, ms_iter->entry(), show_ccch, show_pacch);</span><br><span> </span><br><span>     vty_out(vty, "%sDL TBFs%s", VTY_NEWLINE, VTY_NEWLINE);</span><br><span>     llist_for_each(ms_iter, &bts->dl_tbfs())</span><br><span style="color: hsl(0, 100%, 40%);">-         tbf_print_vty_info(vty, ms_iter->entry());</span><br><span style="color: hsl(120, 100%, 40%);">+         tbf_print_vty_info(vty, ms_iter->entry(), show_ccch, show_pacch);</span><br><span> </span><br><span>     return CMD_SUCCESS;</span><br><span> }</span><br><span>diff --git a/src/pcu_vty_functions.h b/src/pcu_vty_functions.h</span><br><span>index 470df0e..3fef208 100644</span><br><span>--- a/src/pcu_vty_functions.h</span><br><span>+++ b/src/pcu_vty_functions.h</span><br><span>@@ -27,7 +27,7 @@</span><br><span> struct vty;</span><br><span> struct gprs_rlcmac_bts;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data);</span><br><span style="color: hsl(120, 100%, 40%);">+int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data, bool show_ccch, bool show_pacch);</span><br><span> int pcu_vty_show_ms_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data);</span><br><span> int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts_data,</span><br><span>      uint32_t tlli);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/6239">change 6239</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/6239"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 </div>
<div style="display:none"> Gerrit-Change-Number: 6239 </div>
<div style="display:none"> Gerrit-PatchSet: 7 </div>
<div style="display:none"> Gerrit-Owner: Max <suraev@alumni.ntnu.no> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Max <suraev@alumni.ntnu.no> </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>