Change in osmo-bts[master]: cbch: Keep SMSCB queue length counter

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
Tue May 21 00:42:18 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/14112


Change subject: cbch: Keep SMSCB queue length counter
......................................................................

cbch: Keep SMSCB queue length counter

This avoids having to iterate the list to count the number of elements.

Change-Id: I72c47affeb87c9b898bc2290dc7ed113945f1805
---
M include/osmo-bts/gsm_data_shared.h
M src/common/cbch.c
M src/common/vty.c
3 files changed, 6 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/12/14112/1

diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h
index 9378730..860c296 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -541,6 +541,7 @@
 
 struct bts_smscb_state {
 	struct llist_head queue; /* list of struct smscb_msg */
+	int queue_len;
 	struct smscb_msg *cur_msg; /* current SMS-CB */
 	struct smscb_msg *default_msg; /* default broadcast message; NULL if none */
 };
diff --git a/src/common/cbch.c b/src/common/cbch.c
index 6092e46..2107f11 100644
--- a/src/common/cbch.c
+++ b/src/common/cbch.c
@@ -183,6 +183,7 @@
 	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 @@
 	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 53a8674..fab5516 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -803,17 +803,6 @@
 		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 @@
 		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);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I72c47affeb87c9b898bc2290dc7ed113945f1805
Gerrit-Change-Number: 14112
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190521/6d3829bf/attachment.htm>


More information about the gerrit-log mailing list