Change in osmo-bts[master]: osmo-bts-trx: use l1ts as talloc context for burst buffers

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

fixeria gerrit-no-reply at lists.osmocom.org
Sun Dec 12 16:06:30 UTC 2021


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


Change subject: osmo-bts-trx: use l1ts as talloc context for burst buffers
......................................................................

osmo-bts-trx: use l1ts as talloc context for burst buffers

Before a massive refactoring of the scheduler structures [1] it was
impossible to have a clean hierarchy, in which the burst buffers
get allocated as children of their parent timeslot structures.

This change makes it easier to read talloc reports and simplifies
memory management, offloading free()ing of the burst bufferes to
talloc.

Change-Id: Idb1ceaf83c433d2d0eb84d77c2187a00a657905c
Related: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
---
M src/common/scheduler.c
M src/osmo-bts-trx/sched_lchan_pdtch.c
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
M src/osmo-bts-trx/sched_lchan_xcch.c
5 files changed, 10 insertions(+), 23 deletions(-)



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

diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index d8048b5..bd33ce1 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -662,18 +662,7 @@
 	msgb_queue_flush(&l1ts->dl_prims);
 	rate_ctr_group_free(l1ts->ctrs);
 	l1ts->ctrs = NULL;
-	for (i = 0; i < _TRX_CHAN_MAX; i++) {
-		struct l1sched_chan_state *chan_state;
-		chan_state = &l1ts->chan_state[i];
-		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;
-		}
-	}
+
 	/* clear lchan channel states */
 	for (i = 0; i < ARRAY_SIZE(ts->lchan); i++)
 		lchan_set_state(&ts->lchan[i], LCHAN_S_NONE);
diff --git a/src/osmo-bts-trx/sched_lchan_pdtch.c b/src/osmo-bts-trx/sched_lchan_pdtch.c
index 66be116..6a2ad0d 100644
--- a/src/osmo-bts-trx/sched_lchan_pdtch.c
+++ b/src/osmo-bts-trx/sched_lchan_pdtch.c
@@ -58,8 +58,7 @@
 
 	/* allocate burst memory, if not already */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx,
-					     GSM0503_EGPRS_BURSTS_NBITS);
+		*bursts_p = talloc_zero_size(l1ts, GSM0503_EGPRS_BURSTS_NBITS);
 		if (!*bursts_p)
 			return -ENOMEM;
 	}
@@ -174,8 +173,7 @@
 
 	/* allocate burst memory, if not already */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx,
-					     GSM0503_EGPRS_BURSTS_NBITS);
+		*bursts_p = talloc_zero_size(l1ts, GSM0503_EGPRS_BURSTS_NBITS);
 		if (!*bursts_p)
 			return -ENOMEM;
 	}
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 85ab321..08a58bb 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -76,7 +76,7 @@
 
 	/* allocate burst memory, if not already */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx, 928);
+		*bursts_p = talloc_zero_size(l1ts, 928);
 		if (!*bursts_p)
 			return -ENOMEM;
 	}
@@ -521,7 +521,7 @@
 	/* allocate burst memory, if not already,
 	 * otherwise shift buffer by 4 bursts for interleaving */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx, 928);
+		*bursts_p = talloc_zero_size(l1ts, 928);
 		if (!*bursts_p)
 			return -ENOMEM;
 	} else {
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 366c625..51a0b90 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -83,7 +83,7 @@
 
 	/* allocate burst memory, if not already */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx, 696);
+		*bursts_p = talloc_zero_size(l1ts, 696);
 		if (!*bursts_p)
 			return -ENOMEM;
 	}
@@ -417,7 +417,7 @@
 	/* allocate burst memory, if not already,
 	 * otherwise shift buffer by 2 bursts for interleaving */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx, 696);
+		*bursts_p = talloc_zero_size(l1ts, 696);
 		if (!*bursts_p)
 			return -ENOMEM;
 	} else {
diff --git a/src/osmo-bts-trx/sched_lchan_xcch.c b/src/osmo-bts-trx/sched_lchan_xcch.c
index e8f46c1..6a65574 100644
--- a/src/osmo-bts-trx/sched_lchan_xcch.c
+++ b/src/osmo-bts-trx/sched_lchan_xcch.c
@@ -71,7 +71,7 @@
 
 	/* allocate burst memory, if not already */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx, 464);
+		*bursts_p = talloc_zero_size(l1ts, 464);
 		if (!*bursts_p)
 			return -ENOMEM;
 	}
@@ -79,7 +79,7 @@
 	/* UL-SACCH requires additional memory to keep a copy of each previous
 	 * burst set. */
 	if (L1SAP_IS_LINK_SACCH(trx_chan_desc[bi->chan].link_id) && !chan_state->ul_bursts_prev) {
-		chan_state->ul_bursts_prev = talloc_zero_size(tall_bts_ctx, 464);
+		chan_state->ul_bursts_prev = talloc_zero_size(l1ts, 464);
 		if (!chan_state->ul_bursts_prev)
 			return -ENOMEM;
 	}
@@ -224,7 +224,7 @@
 
 	/* allocate burst memory, if not already */
 	if (!*bursts_p) {
-		*bursts_p = talloc_zero_size(tall_bts_ctx, 464);
+		*bursts_p = talloc_zero_size(l1ts, 464);
 		if (!*bursts_p)
 			return -ENOMEM;
 	}

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Idb1ceaf83c433d2d0eb84d77c2187a00a657905c
Gerrit-Change-Number: 26531
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211212/3dad1f0e/attachment.htm>


More information about the gerrit-log mailing list