Change in osmo-bts[master]: lchan: Setup early_rr_ia timer only once during init

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/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Oct 14 12:42:35 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25779 )


Change subject: lchan: Setup early_rr_ia timer only once during init
......................................................................

lchan: Setup early_rr_ia timer only once during init

There's no need to re-setup it every time.

Mark the cb as static since its private to the module, and move it
above its use point so it can be referenced.

Change-Id: I90324f26d8ca09d425c7523a25b3e6c951fa49d6
---
M src/common/lchan.c
1 file changed, 29 insertions(+), 28 deletions(-)



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

diff --git a/src/common/lchan.c b/src/common/lchan.c
index f7ee33b..747e8b0 100644
--- a/src/common/lchan.c
+++ b/src/common/lchan.c
@@ -52,6 +52,33 @@
 	{ 0, NULL }
 };
 
+static void early_rr_ia_delay_cb(void *data)
+{
+	struct gsm_lchan *lchan = data;
+	struct gsm_bts *bts = lchan->ts->trx->bts;
+
+	if (!lchan->early_rr_ia) {
+		/* The IA message has disappeared since the timer was started. */
+		return;
+	}
+
+	if (lchan->state != LCHAN_S_ACTIVE) {
+		/* Release has happened since the timer was started. */
+		msgb_free(lchan->early_rr_ia);
+		lchan->early_rr_ia = NULL;
+		return;
+	}
+
+	/* Activation is done, send the RR IA now. Put RR IA msg into the AGCH queue of the BTS. */
+	if (bts_agch_enqueue(bts, lchan->early_rr_ia) < 0) {
+		/* if there is no space in the queue: send DELETE IND */
+		rsl_tx_delete_ind(bts, lchan->early_rr_ia->data, lchan->early_rr_ia->len);
+		rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_DELETED);
+		msgb_free(lchan->early_rr_ia);
+	}
+	lchan->early_rr_ia = NULL;
+}
+
 void gsm_lchan_init(struct gsm_lchan *lchan, struct gsm_bts_trx_ts *ts, unsigned int lchan_nr)
 {
 	lchan->ts = ts;
@@ -59,6 +86,8 @@
 	lchan->type = GSM_LCHAN_NONE;
 	gsm_lchan_name_update(lchan);
 
+	osmo_timer_setup(&lchan->early_rr_ia_delay, early_rr_ia_delay_cb, lchan);
+
 	INIT_LLIST_HEAD(&lchan->sapi_cmds);
 	INIT_LLIST_HEAD(&lchan->dl_tch_queue);
 }
@@ -150,33 +179,6 @@
 	return get_value_string(lchan_s_names, s);
 }
 
-void early_rr_ia_delay_cb(void *data)
-{
-	struct gsm_lchan *lchan = data;
-	struct gsm_bts *bts = lchan->ts->trx->bts;
-
-	if (!lchan->early_rr_ia) {
-		/* The IA message has disappeared since the timer was started. */
-		return;
-	}
-
-	if (lchan->state != LCHAN_S_ACTIVE) {
-		/* Release has happened since the timer was started. */
-		msgb_free(lchan->early_rr_ia);
-		lchan->early_rr_ia = NULL;
-		return;
-	}
-
-	/* Activation is done, send the RR IA now. Put RR IA msg into the AGCH queue of the BTS. */
-	if (bts_agch_enqueue(bts, lchan->early_rr_ia) < 0) {
-		/* if there is no space in the queue: send DELETE IND */
-		rsl_tx_delete_ind(bts, lchan->early_rr_ia->data, lchan->early_rr_ia->len);
-		rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_DELETED);
-		msgb_free(lchan->early_rr_ia);
-	}
-	lchan->early_rr_ia = NULL;
-}
-
 void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state)
 {
 	DEBUGP(DL1C, "%s state %s -> %s\n",
@@ -197,7 +199,6 @@
 			/* Activation is done, send the RR IA now. Delay a bit more to give Um time to let the lchan
 			 * light up for the MS */
 			osmo_timer_del(&lchan->early_rr_ia_delay);
-			osmo_timer_setup(&lchan->early_rr_ia_delay, early_rr_ia_delay_cb, lchan);
 			osmo_timer_schedule(&lchan->early_rr_ia_delay, 0,
 					    osmo_tdef_get(abis_T_defs, -15, OSMO_TDEF_US, -1));
 			break;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25779
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I90324f26d8ca09d425c7523a25b3e6c951fa49d6
Gerrit-Change-Number: 25779
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211014/06e01cb2/attachment.htm>


More information about the gerrit-log mailing list