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
This commit is contained in:
parent
4b3fe16200
commit
487feeb0ff
|
@ -662,18 +662,7 @@ static void trx_sched_clean_ts(struct gsm_bts_trx_ts *ts)
|
|||
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);
|
||||
|
|
|
@ -58,8 +58,7 @@ int rx_pdtch_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
|
|||
|
||||
/* 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 @@ int tx_pdtch_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
|
|||
|
||||
/* 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 @@ int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
|
|||
/* 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 {
|
||||
|
|
|
@ -83,7 +83,7 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
|
|||
|
||||
/* 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 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
|
|||
/* 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 {
|
||||
|
|
|
@ -71,7 +71,7 @@ int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
|
|||
|
||||
/* 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 @@ int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
|
|||
/* 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 @@ got_msg:
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue