diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-09-29 08:08:28 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-30 14:45:57 +0100 |
commit | 8481a0553d1f7289c6e63b7ab9200143b8691d96 (patch) | |
tree | 4ce4d1df6ab4840683d7fb6cf1c07b02f7146d41 /src/gprs_rlcmac_ts_alloc.cpp | |
parent | 743bafa50ca4b577416774ecc2ac3b3986bfc97e (diff) |
alloc: Remove code duplication for downlink assignment
There was no difference but there is no point in poking in the
internals of the tbf, pdch and trx from various places. Information
hiding has a real purpose, e.g. compare with reading "the mythical
man month".
Diffstat (limited to 'src/gprs_rlcmac_ts_alloc.cpp')
-rw-r--r-- | src/gprs_rlcmac_ts_alloc.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 0cc0f379..68f7bd6c 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -109,6 +109,16 @@ static void assign_uplink_tbf_usf( tbf->dir.ul.usf[ts] = usf; } +static void assign_dlink_tbf( + struct gprs_rlcmac_pdch *pdch, + int ts, + struct gprs_rlcmac_tbf *tbf) +{ + tbf->trx->dl_tbf[tbf->tfi] = tbf; + pdch->dl_tbf[tbf->tfi] = tbf; + tbf->pdch[ts] = pdch; +} + /* Slot Allocation: Algorithm A * @@ -151,9 +161,7 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, assign_uplink_tbf_usf(pdch, ts, tbf, usf); } else { LOGP(DRLCMAC, LOGL_DEBUG, "- Assign downlink TS=%d\n", ts); - tbf->trx->dl_tbf[tbf->tfi] = tbf; - pdch->dl_tbf[tbf->tfi] = tbf; - tbf->pdch[ts] = pdch; + assign_dlink_tbf(pdch, ts, tbf); } /* the only one TS is the common TS */ tbf->first_ts = tbf->first_common_ts = ts; @@ -542,9 +550,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning DL TS " "%d\n", ts); pdch = &tbf->trx->pdch[ts]; - tbf->trx->dl_tbf[tbf->tfi] = tbf; - pdch->dl_tbf[tbf->tfi] = tbf; - tbf->pdch[ts] = pdch; + assign_dlink_tbf(pdch, ts, tbf); slotcount++; if (slotcount == 1) tbf->first_ts = ts; |