alloc: Introduce a backpointer from the tbf to the trx and simplify code
Kill all the level of indirections where one needs to have the BTS the TBF to find the TRX.
This commit is contained in:
parent
96efa70a9e
commit
743bafa50c
|
@ -98,12 +98,12 @@ static inline int8_t find_free_usf(struct gprs_rlcmac_pdch *pdch, uint8_t ts)
|
|||
}
|
||||
|
||||
|
||||
static void assign_uplink_tbf_usf(struct gprs_rlcmac_bts *bts,
|
||||
static void assign_uplink_tbf_usf(
|
||||
struct gprs_rlcmac_pdch *pdch,
|
||||
int ts,
|
||||
struct gprs_rlcmac_tbf *tbf, int8_t usf)
|
||||
{
|
||||
bts->trx[tbf->trx_no].ul_tbf[tbf->tfi] = tbf;
|
||||
tbf->trx->ul_tbf[tbf->tfi] = tbf;
|
||||
pdch->ul_tbf[tbf->tfi] = tbf;
|
||||
tbf->pdch[ts] = pdch;
|
||||
tbf->dir.ul.usf[ts] = usf;
|
||||
|
@ -126,7 +126,7 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts,
|
|||
"%d\n", tbf->ms_class);
|
||||
|
||||
for (ts = 0; ts < 8; ts++) {
|
||||
pdch = &bts->trx[tbf->trx_no].pdch[ts];
|
||||
pdch = &tbf->trx->pdch[ts];
|
||||
if (!pdch->enable) {
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, because "
|
||||
"not enabled\n", ts);
|
||||
|
@ -148,10 +148,10 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts,
|
|||
}
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Assign uplink "
|
||||
"TS=%d USF=%d\n", ts, usf);
|
||||
assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf);
|
||||
assign_uplink_tbf_usf(pdch, ts, tbf, usf);
|
||||
} else {
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Assign downlink TS=%d\n", ts);
|
||||
bts->trx[tbf->trx_no].dl_tbf[tbf->tfi] = tbf;
|
||||
tbf->trx->dl_tbf[tbf->tfi] = tbf;
|
||||
pdch->dl_tbf[tbf->tfi] = tbf;
|
||||
tbf->pdch[ts] = pdch;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
|
|||
* This must be done for uplink TBF also, because it is the basis
|
||||
* for calculating control slot and uplink slot(s). */
|
||||
for (ts = 0, i = 0; ts < 8; ts++) {
|
||||
pdch = &bts->trx[tbf->trx_no].pdch[ts];
|
||||
pdch = &tbf->trx->pdch[ts];
|
||||
/* check if enabled */
|
||||
if (!pdch->enable) {
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, because "
|
||||
|
@ -436,7 +436,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
|
|||
* slot. */
|
||||
if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
|
||||
for (ts = tx_win_min, i = 0; i < tx_range; ts = (ts + 1) & 7) {
|
||||
pdch = &bts->trx[tbf->trx_no].pdch[ts];
|
||||
pdch = &tbf->trx->pdch[ts];
|
||||
/* check if enabled */
|
||||
if (!pdch->enable) {
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, "
|
||||
|
@ -508,7 +508,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
|
|||
/* assign the first common ts, which is used for control or
|
||||
* single slot. */
|
||||
for (ts = tx_win_min, i = 0; i < tx_range; ts = (ts + 1) & 7) {
|
||||
pdch = &bts->trx[tbf->trx_no].pdch[ts];
|
||||
pdch = &tbf->trx->pdch[ts];
|
||||
/* check if enabled */
|
||||
if (!pdch->enable) {
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, "
|
||||
|
@ -541,8 +541,8 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
|
|||
continue;
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning DL TS "
|
||||
"%d\n", ts);
|
||||
pdch = &bts->trx[tbf->trx_no].pdch[ts];
|
||||
bts->trx[tbf->trx_no].dl_tbf[tbf->tfi] = tbf;
|
||||
pdch = &tbf->trx->pdch[ts];
|
||||
tbf->trx->dl_tbf[tbf->tfi] = tbf;
|
||||
pdch->dl_tbf[tbf->tfi] = tbf;
|
||||
tbf->pdch[ts] = pdch;
|
||||
slotcount++;
|
||||
|
@ -563,8 +563,8 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
|
|||
if ((tx_window & (1 << ts))) {
|
||||
LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning UL TS "
|
||||
"%d\n", ts);
|
||||
pdch = &bts->trx[tbf->trx_no].pdch[ts];
|
||||
assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf[ts]);
|
||||
pdch = &tbf->trx->pdch[ts];
|
||||
assign_uplink_tbf_usf(pdch, ts, tbf, usf[ts]);
|
||||
slotcount++;
|
||||
if (slotcount == 1)
|
||||
tbf->first_ts = ts;
|
||||
|
|
|
@ -503,6 +503,7 @@ next_diagram:
|
|||
tbf->direction = dir;
|
||||
tbf->tfi = tfi;
|
||||
tbf->trx_no = trx;
|
||||
tbf->trx = &bts->trx[trx];
|
||||
tbf->arfcn = bts->trx[trx].arfcn;
|
||||
tbf->ms_class = ms_class;
|
||||
tbf->ws = 64;
|
||||
|
|
Loading…
Reference in New Issue