Change in osmo-bts[master]: scheduler: reduce nesting in trx_sched_set_lchan()

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

laforge gerrit-no-reply at lists.osmocom.org
Mon Oct 19 15:04:23 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/20697 )

Change subject: scheduler: reduce nesting in trx_sched_set_lchan()
......................................................................

scheduler: reduce nesting in trx_sched_set_lchan()

Change-Id: I476dabb059325058a4327bb96430ce6ade199580
---
M src/common/scheduler.c
1 file changed, 30 insertions(+), 28 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 9af67c8..3dc4db5 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -979,36 +979,38 @@
 
 	/* look for all matching chan_nr/link_id */
 	for (i = 0; i < _TRX_CHAN_MAX; i++) {
-		struct l1sched_chan_state *chan_state;
-		chan_state = &l1ts->chan_state[i];
-		if (trx_chan_desc[i].chan_nr == (chan_nr & RSL_CHAN_NR_MASK)
-		 && trx_chan_desc[i].link_id == link_id) {
-			rc = 0;
-			if (chan_state->active == active)
-				continue;
-			LOGP(DL1C, LOGL_NOTICE, "%s %s on trx=%d ts=%d\n",
-				(active) ? "Activating" : "Deactivating",
-				trx_chan_desc[i].name, l1t->trx->nr, tn);
-			/* free burst memory, to cleanly start with burst 0 */
-			if (chan_state->dl_bursts) {
-				talloc_free(chan_state->dl_bursts);
-				chan_state->dl_bursts = NULL;
-			}
-			if (chan_state->ul_bursts) {
-				talloc_free(chan_state->ul_bursts);
-				chan_state->ul_bursts = NULL;
-			}
+		struct l1sched_chan_state *chan_state = &l1ts->chan_state[i];
 
-			if (active)
-				memset(chan_state, 0, sizeof(*chan_state));
-			else
-				chan_state->ho_rach_detect = 0;
-			chan_state->active = active;
+		if (trx_chan_desc[i].chan_nr != (chan_nr & RSL_CHAN_NR_MASK))
+			continue;
+		if (trx_chan_desc[i].link_id != link_id)
+			continue;
 
-			if (active) {
-				chan_state->lchan = get_lchan_by_chan_nr(l1t->trx, chan_nr);
-				OSMO_ASSERT(chan_state->lchan != NULL);
-			}
+		rc = 0;
+		if (chan_state->active == active)
+			continue;
+		LOGP(DL1C, LOGL_NOTICE, "%s %s on trx=%d ts=%d\n",
+			(active) ? "Activating" : "Deactivating",
+			trx_chan_desc[i].name, l1t->trx->nr, tn);
+		/* free burst memory, to cleanly start with burst 0 */
+		if (chan_state->dl_bursts) {
+			talloc_free(chan_state->dl_bursts);
+			chan_state->dl_bursts = NULL;
+		}
+		if (chan_state->ul_bursts) {
+			talloc_free(chan_state->ul_bursts);
+			chan_state->ul_bursts = NULL;
+		}
+
+		if (active)
+			memset(chan_state, 0, sizeof(*chan_state));
+		else
+			chan_state->ho_rach_detect = 0;
+		chan_state->active = active;
+
+		if (active) {
+			chan_state->lchan = get_lchan_by_chan_nr(l1t->trx, chan_nr);
+			OSMO_ASSERT(chan_state->lchan != NULL);
 		}
 	}
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I476dabb059325058a4327bb96430ce6ade199580
Gerrit-Change-Number: 20697
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201019/420ecfbb/attachment.htm>


More information about the gerrit-log mailing list