<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/14112">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cbch: Keep SMSCB queue length counter<br><br>This avoids having to iterate the list to count the number of elements.<br><br>Change-Id: I72c47affeb87c9b898bc2290dc7ed113945f1805<br>---<br>M include/osmo-bts/gsm_data_shared.h<br>M src/common/cbch.c<br>M src/common/vty.c<br>3 files changed, 6 insertions(+), 14 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/12/14112/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h</span><br><span>index 9378730..860c296 100644</span><br><span>--- a/include/osmo-bts/gsm_data_shared.h</span><br><span>+++ b/include/osmo-bts/gsm_data_shared.h</span><br><span>@@ -541,6 +541,7 @@</span><br><span> </span><br><span> struct bts_smscb_state {</span><br><span>        struct llist_head queue; /* list of struct smscb_msg */</span><br><span style="color: hsl(120, 100%, 40%);">+       int queue_len;</span><br><span>       struct smscb_msg *cur_msg; /* current SMS-CB */</span><br><span>      struct smscb_msg *default_msg; /* default broadcast message; NULL if none */</span><br><span> };</span><br><span>diff --git a/src/common/cbch.c b/src/common/cbch.c</span><br><span>index 6092e46..2107f11 100644</span><br><span>--- a/src/common/cbch.c</span><br><span>+++ b/src/common/cbch.c</span><br><span>@@ -183,6 +183,7 @@</span><br><span>    case RSL_CB_CMD_TYPE_NULL:</span><br><span>           /* def_bcast is ignored as per Section 9.3.41 of 3GPP TS 48.058 */</span><br><span>           llist_add_tail(&scm->list, &bts_ss->queue);</span><br><span style="color: hsl(120, 100%, 40%);">+             bts_ss->queue_len++;</span><br><span>              /* FIXME: limit queue size and optionally send CBCH LOAD Information (overflow) via RSL */</span><br><span>           break;</span><br><span>       case RSL_CB_CMD_TYPE_DEFAULT:</span><br><span>@@ -215,6 +216,7 @@</span><br><span>  msg = llist_first_entry_or_null(&bts_ss->queue, struct smscb_msg, list);</span><br><span>      if (msg) {</span><br><span>           llist_del(&msg->list);</span><br><span style="color: hsl(120, 100%, 40%);">+         bts_ss->queue_len--;</span><br><span>              DEBUGP(DLSMS, "%s: Dequeued msg\n", __func__);</span><br><span>             return msg;</span><br><span>  }</span><br><span>diff --git a/src/common/vty.c b/src/common/vty.c</span><br><span>index 53a8674..fab5516 100644</span><br><span>--- a/src/common/vty.c</span><br><span>+++ b/src/common/vty.c</span><br><span>@@ -803,17 +803,6 @@</span><br><span>                abis_nm_avail_name(nms->availability), VTY_NEWLINE);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static unsigned int llist_length(struct llist_head *list)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-      unsigned int len = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-   struct llist_head *pos;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- llist_for_each(pos, list)</span><br><span style="color: hsl(0, 100%, 40%);">-               len++;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-  return len;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static void bts_dump_vty_features(struct vty *vty, struct gsm_bts *bts)</span><br><span> {</span><br><span>         unsigned int i;</span><br><span>@@ -865,10 +854,10 @@</span><br><span>              bts->agch_queue.rejected_msgs, bts->agch_queue.agch_msgs,</span><br><span>              bts->agch_queue.pch_msgs,</span><br><span>                 VTY_NEWLINE);</span><br><span style="color: hsl(0, 100%, 40%);">-   vty_out(vty, "  CBCH backlog queue length (BASIC): %u%s",</span><br><span style="color: hsl(0, 100%, 40%);">-             llist_length(&bts->smscb_basic.queue), VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+   vty_out(vty, "  CBCH backlog queue length (BASIC): %d%s",</span><br><span style="color: hsl(120, 100%, 40%);">+           bts->smscb_basic.queue_len, VTY_NEWLINE);</span><br><span>         vty_out(vty, "  CBCH backlog queue length (EXTENDED): %u%s",</span><br><span style="color: hsl(0, 100%, 40%);">-          llist_length(&bts->smscb_extended.queue), VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+                bts->smscb_extended.queue_len, VTY_NEWLINE);</span><br><span>      vty_out(vty, "  Paging: queue length %d, buffer space %d%s",</span><br><span>               paging_queue_length(bts->paging_state), paging_buffer_space(bts->paging_state),</span><br><span>                VTY_NEWLINE);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/14112">change 14112</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/14112"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I72c47affeb87c9b898bc2290dc7ed113945f1805 </div>
<div style="display:none"> Gerrit-Change-Number: 14112 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>