osmo-bts-trx: store pointer to gsm_lchan in l1sched_chan_state

This change simplifies access to generic logical channel state
(struct gsm_lchan) from osmo-bts-trx specific state (struct
l1sched_chan_state), so there is no need to look it up using
get_lchan_by_chan_nr() on receipt of each Uplink burst.

Change-Id: Ic4378020f980845b962f71b9e4b7faea738bc174
This commit is contained in:
Vadim Yanitskiy 2020-06-15 20:19:08 +07:00
parent ae781bc5cd
commit b828b32f31
4 changed files with 12 additions and 4 deletions

View File

@ -71,6 +71,11 @@ enum trx_burst_type {
/* States each channel on a multiframe */
struct l1sched_chan_state {
/* Pointer to the associated logical channel state from gsm_data_shared.
* Initialized during channel activation, thus may be NULL for inactive
* or auto-active channels. Always check before dereferencing! */
struct gsm_lchan *lchan;
/* scheduler */
bool active; /* Channel is active */
ubit_t *dl_bursts; /* burst buffer for TX */

View File

@ -1000,6 +1000,11 @@ int trx_sched_set_lchan(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t link_i
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);
}
}
}

View File

@ -50,6 +50,7 @@ int rx_tchf_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
{
struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, bi->tn);
struct l1sched_chan_state *chan_state = &l1ts->chan_state[chan];
struct gsm_lchan *lchan = chan_state->lchan;
sbit_t *burst, **bursts_p = &chan_state->ul_bursts;
uint8_t *mask = &chan_state->ul_mask;
uint8_t rsl_cmode = chan_state->rsl_cmode;
@ -59,8 +60,6 @@ int rx_tchf_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
int n_errors = 0;
int n_bits_total = 0;
bool bfi_flag = false;
struct gsm_lchan *lchan =
get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);
unsigned int fn_begin;
uint16_t ber10k;
uint8_t is_sub = 0;

View File

@ -50,6 +50,7 @@ int rx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
{
struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, bi->tn);
struct l1sched_chan_state *chan_state = &l1ts->chan_state[chan];
struct gsm_lchan *lchan = chan_state->lchan;
sbit_t *burst, **bursts_p = &chan_state->ul_bursts;
uint8_t *mask = &chan_state->ul_mask;
uint8_t rsl_cmode = chan_state->rsl_cmode;
@ -59,8 +60,6 @@ int rx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
int n_errors = 0;
int n_bits_total = 0;
bool bfi_flag = false;
struct gsm_lchan *lchan =
get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);
/* Note on FN-10: If we are at FN 10, we decoded an even aligned
* TCH/FACCH frame, because our burst buffer carries 6 bursts.
* Even FN ending at: 10,11,19,20,2,3