Change in libosmocore[master]: bssgp: introduce flush queue functions

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Aug 10 07:00:17 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10371 )

Change subject: bssgp: introduce flush queue functions
......................................................................

bssgp: introduce flush queue functions

To reset the state of BSSGP allow to flush the BSSGP queues.
When testing (with TTCN3) the test object should be resetted between
each test.

Introduce the functions:
bssgp_fc_flush_queue() - flushs a single flow control object
bssgp_flush_all_queues() - flushs queues of all BSSGP connections

Change-Id: I29b6ad6742ddf9b0b58b4af37d9a1cf18e019325
---
M include/osmocom/gprs/gprs_bssgp.h
M src/gb/gprs_bssgp.c
M src/gb/libosmogb.map
3 files changed, 33 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h
index 2dead69..400c3e0 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -207,6 +207,9 @@
 int bssgp_fc_ms_init(struct bssgp_flow_control *fc_ms, uint16_t bvci,
 		     uint16_t nsei, uint32_t max_queue_depth);
 
+void bssgp_flush_all_queues();
+void bssgp_fc_flush_queue(struct bssgp_flow_control *fc);
+
 /* gprs_bssgp_vty.c */
 int bssgp_vty_init(void);
 void bssgp_set_log_ss(int ss);
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 5dfce16..3b9fbf9 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -1263,3 +1263,31 @@
 {
 	DBSSGP = ss;
 }
+
+/*!
+ * \brief Flush the queue of the bssgp_flow_control
+ * \param[in] The flow control object which holds the queue.
+ */
+void bssgp_fc_flush_queue(struct bssgp_flow_control *fc)
+{
+	struct bssgp_fc_queue_element *element, *tmp;
+
+	llist_for_each_entry_safe(element, tmp, &fc->queue, list) {
+		msgb_free(element->msg);
+		llist_del(&element->list);
+		talloc_free(element);
+	}
+}
+
+/*!
+ * \brief Flush the queues of all BSSGP contexts.
+ */
+void bssgp_flush_all_queues()
+{
+	struct bssgp_bvc_ctx *bctx;
+
+	llist_for_each_entry(bctx, &bssgp_bvc_ctxts, list) {
+		if (bctx->fc)
+			bssgp_fc_flush_queue(bctx->fc);
+	}
+}
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index d56e651..ec69670 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -6,6 +6,8 @@
 bssgp_fc_in;
 bssgp_fc_init;
 bssgp_fc_ms_init;
+bssgp_fc_flush_queue;
+bssgp_flush_all_queues;
 bssgp_msgb_alloc;
 bssgp_msgb_copy;
 bssgp_msgb_tlli_put;

-- 
To view, visit https://gerrit.osmocom.org/10371
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I29b6ad6742ddf9b0b58b4af37d9a1cf18e019325
Gerrit-Change-Number: 10371
Gerrit-PatchSet: 6
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180810/89354773/attachment.htm>


More information about the gerrit-log mailing list