<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/10371">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bssgp: introduce flush queue functions<br><br>To reset the state of BSSGP allow to flush the BSSGP queues.<br>When testing (with TTCN3) the test object should be resetted between<br>each test.<br><br>Introduce the functions:<br>bssgp_fc_flush_queue() - flushs a single flow control object<br>bssgp_flush_all_queues() - flushs queues of all BSSGP connections<br><br>Change-Id: I29b6ad6742ddf9b0b58b4af37d9a1cf18e019325<br>---<br>M include/osmocom/gprs/gprs_bssgp.h<br>M src/gb/gprs_bssgp.c<br>M src/gb/libosmogb.map<br>3 files changed, 33 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h</span><br><span>index 2dead69..400c3e0 100644</span><br><span>--- a/include/osmocom/gprs/gprs_bssgp.h</span><br><span>+++ b/include/osmocom/gprs/gprs_bssgp.h</span><br><span>@@ -207,6 +207,9 @@</span><br><span> int bssgp_fc_ms_init(struct bssgp_flow_control *fc_ms, uint16_t bvci,</span><br><span>                uint16_t nsei, uint32_t max_queue_depth);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void bssgp_flush_all_queues();</span><br><span style="color: hsl(120, 100%, 40%);">+void bssgp_fc_flush_queue(struct bssgp_flow_control *fc);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* gprs_bssgp_vty.c */</span><br><span> int bssgp_vty_init(void);</span><br><span> void bssgp_set_log_ss(int ss);</span><br><span>diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c</span><br><span>index 5dfce16..3b9fbf9 100644</span><br><span>--- a/src/gb/gprs_bssgp.c</span><br><span>+++ b/src/gb/gprs_bssgp.c</span><br><span>@@ -1263,3 +1263,31 @@</span><br><span> {</span><br><span>      DBSSGP = ss;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Flush the queue of the bssgp_flow_control</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] The flow control object which holds the queue.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void bssgp_fc_flush_queue(struct bssgp_flow_control *fc)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct bssgp_fc_queue_element *element, *tmp;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       llist_for_each_entry_safe(element, tmp, &fc->queue, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+            msgb_free(element->msg);</span><br><span style="color: hsl(120, 100%, 40%);">+           llist_del(&element->list);</span><br><span style="color: hsl(120, 100%, 40%);">+             talloc_free(element);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Flush the queues of all BSSGP contexts.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void bssgp_flush_all_queues()</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct bssgp_bvc_ctx *bctx;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ llist_for_each_entry(bctx, &bssgp_bvc_ctxts, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+              if (bctx->fc)</span><br><span style="color: hsl(120, 100%, 40%);">+                      bssgp_fc_flush_queue(bctx->fc);</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map</span><br><span>index d56e651..ec69670 100644</span><br><span>--- a/src/gb/libosmogb.map</span><br><span>+++ b/src/gb/libosmogb.map</span><br><span>@@ -6,6 +6,8 @@</span><br><span> bssgp_fc_in;</span><br><span> bssgp_fc_init;</span><br><span> bssgp_fc_ms_init;</span><br><span style="color: hsl(120, 100%, 40%);">+bssgp_fc_flush_queue;</span><br><span style="color: hsl(120, 100%, 40%);">+bssgp_flush_all_queues;</span><br><span> bssgp_msgb_alloc;</span><br><span> bssgp_msgb_copy;</span><br><span> bssgp_msgb_tlli_put;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10371">change 10371</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/10371"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I29b6ad6742ddf9b0b58b4af37d9a1cf18e019325 </div>
<div style="display:none"> Gerrit-Change-Number: 10371 </div>
<div style="display:none"> Gerrit-PatchSet: 6 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>