diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-05-21 01:36:51 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-05-21 02:42:00 +0200 |
commit | 0f9595f462230a6100f2f92f92ed0bc11d7b596b (patch) | |
tree | 2603edb07753b74ace12b196285c1e300b0975e3 /src | |
parent | 067824841f6b1139e3a926b355826454a3f371b2 (diff) |
cbch: Keep SMSCB queue length counter
This avoids having to iterate the list to count the number of elements.
Change-Id: I72c47affeb87c9b898bc2290dc7ed113945f1805
Diffstat (limited to 'src')
-rw-r--r-- | src/common/cbch.c | 2 | ||||
-rw-r--r-- | src/common/vty.c | 17 |
2 files changed, 5 insertions, 14 deletions
diff --git a/src/common/cbch.c b/src/common/cbch.c index 6092e464..2107f115 100644 --- a/src/common/cbch.c +++ b/src/common/cbch.c @@ -183,6 +183,7 @@ int bts_process_smscb_cmd(struct gsm_bts *bts, struct rsl_ie_cb_cmd_type cmd_typ case RSL_CB_CMD_TYPE_NULL: /* def_bcast is ignored as per Section 9.3.41 of 3GPP TS 48.058 */ llist_add_tail(&scm->list, &bts_ss->queue); + bts_ss->queue_len++; /* FIXME: limit queue size and optionally send CBCH LOAD Information (overflow) via RSL */ break; case RSL_CB_CMD_TYPE_DEFAULT: @@ -215,6 +216,7 @@ static struct smscb_msg *select_next_smscb(struct gsm_bts *bts, uint8_t tb) msg = llist_first_entry_or_null(&bts_ss->queue, struct smscb_msg, list); if (msg) { llist_del(&msg->list); + bts_ss->queue_len--; DEBUGP(DLSMS, "%s: Dequeued msg\n", __func__); return msg; } diff --git a/src/common/vty.c b/src/common/vty.c index 53a86743..fab55161 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -803,17 +803,6 @@ static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms) abis_nm_avail_name(nms->availability), VTY_NEWLINE); } -static unsigned int llist_length(struct llist_head *list) -{ - unsigned int len = 0; - struct llist_head *pos; - - llist_for_each(pos, list) - len++; - - return len; -} - static void bts_dump_vty_features(struct vty *vty, struct gsm_bts *bts) { unsigned int i; @@ -865,10 +854,10 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) bts->agch_queue.rejected_msgs, bts->agch_queue.agch_msgs, bts->agch_queue.pch_msgs, VTY_NEWLINE); - vty_out(vty, " CBCH backlog queue length (BASIC): %u%s", - llist_length(&bts->smscb_basic.queue), VTY_NEWLINE); + vty_out(vty, " CBCH backlog queue length (BASIC): %d%s", + bts->smscb_basic.queue_len, VTY_NEWLINE); vty_out(vty, " CBCH backlog queue length (EXTENDED): %u%s", - llist_length(&bts->smscb_extended.queue), VTY_NEWLINE); + bts->smscb_extended.queue_len, VTY_NEWLINE); vty_out(vty, " Paging: queue length %d, buffer space %d%s", paging_queue_length(bts->paging_state), paging_buffer_space(bts->paging_state), VTY_NEWLINE); |