aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-09-29 07:50:50 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-30 14:45:57 +0100
commit743bafa50ca4b577416774ecc2ac3b3986bfc97e (patch)
tree3d4ad64c78f432c71723262d3c115c9106d2e9d9 /src
parent96efa70a9e4df47f98fe6ce2450d33e0c0e27294 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/gprs_rlcmac_ts_alloc.cpp24
-rw-r--r--src/tbf.cpp1
-rw-r--r--src/tbf.h1
3 files changed, 14 insertions, 12 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 949041a..0cc0f37 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -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;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index ddb3fbb..9afa85d 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -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;
diff --git a/src/tbf.h b/src/tbf.h
index 0b97f80..f75121c 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -103,6 +103,7 @@ struct gprs_rlcmac_tbf {
uint8_t tfi;
uint32_t tlli;
uint8_t tlli_valid;
+ struct gprs_rlcmac_trx *trx;
uint8_t trx_no;
uint16_t arfcn;
uint8_t tsc;