[PATCH 4/5] agch: Keep track of AGCH queue length

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/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Fri Feb 21 14:09:14 UTC 2014


This patch adds and updates btsb->agch_queue_length to keep track of
the queue length.

Sponsored-by: On-Waves ehf
---
 include/osmo-bts/gsm_data.h |    1 +
 src/common/bts.c            |    8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index c6cd7e4..aee56a9 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -49,6 +49,7 @@ struct gsm_bts_role_bts {
 	uint8_t ny1;
 	uint8_t max_ta;
 	struct llist_head agch_queue;
+	int agch_queue_length;
 	struct paging_state *paging_state;
 	char *bsc_oml_host;
 	unsigned int rtp_jitter_buf_ms;
diff --git a/src/common/bts.c b/src/common/bts.c
index 2ac411d..35fc302 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -65,6 +65,7 @@ int bts_init(struct gsm_bts *bts)
 	bts->role = btsb = talloc_zero(bts, struct gsm_bts_role_bts);
 
 	INIT_LLIST_HEAD(&btsb->agch_queue);
+	btsb->agch_queue_length = 0;
 
 	/* configurable via VTY */
 	btsb->paging_state = paging_init(btsb, 200, 0);
@@ -214,6 +215,7 @@ int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg)
 
 	/* FIXME: implement max queue length */
 	msgb_enqueue(&btsb->agch_queue, msg);
+	btsb->agch_queue_length++;
 
 	return 0;
 }
@@ -221,8 +223,12 @@ int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg)
 struct msgb *bts_agch_dequeue(struct gsm_bts *bts)
 {
 	struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+	struct msgb *msg = msgb_dequeue(&btsb->agch_queue);
+	if (!msg)
+		return NULL;
 
-	return msgb_dequeue(&btsb->agch_queue);
+	btsb->agch_queue_length--;
+	return msg;
 }
 
 int bts_supports_cipher(struct gsm_bts_role_bts *bts, int rsl_cipher)
-- 
1.7.9.5





More information about the OpenBSC mailing list