diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-02-21 15:09:14 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-02-22 08:44:29 +0100 |
commit | d242ec2ed909e58d8f3905b185a1b1e14806f7da (patch) | |
tree | 294cf6c30252629462f64a96909eda0cfe31e403 | |
parent | 37c332e5bfdb9591a1cd3cc6746afffdb1cd13b9 (diff) |
agch: Keep track of AGCH queue length
This patch adds and updates btsb->agch_queue_length to keep track of
the queue length.
Sponsored-by: On-Waves ehf
-rw-r--r-- | include/osmo-bts/gsm_data.h | 1 | ||||
-rw-r--r-- | src/common/bts.c | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index c6cd7e40..aee56a9a 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 2ac411d0..35fc3024 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) |