aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_rlcmac.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-09-29 07:27:13 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-30 14:45:57 +0100
commit96173aec93104a23d3989da9bdf770a535701fef (patch)
tree9e3db2341dc7b330875ab696b9b9793dcea96a99 /src/gprs_rlcmac.cpp
parent1c344e26689fc84ceb1fda1ab9e061462af2678b (diff)
alloc: Move the "assignment" of the slot into a common function
Vladimir Rolbin pointed out that in case of the alloc_algorithm_a the usf has not been assigned. For now move all the assignment into a method and call it from the A and B algorithm.
Diffstat (limited to 'src/gprs_rlcmac.cpp')
-rw-r--r--src/gprs_rlcmac.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 9b4e6436..e8041d2f 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -253,6 +253,17 @@ static inline int8_t find_free_usf(struct gprs_rlcmac_pdch *pdch, uint8_t ts)
return -1;
}
+static void assign_uplink_tbf_usf(struct gprs_rlcmac_bts *bts,
+ struct gprs_rlcmac_pdch *pdch,
+ int ts,
+ struct gprs_rlcmac_tbf *tbf, int8_t usf)
+{
+ bts->trx[tbf->trx].ul_tbf[tbf->tfi] = tbf;
+ pdch->ul_tbf[tbf->tfi] = tbf;
+ tbf->pdch[ts] = pdch;
+ tbf->dir.ul.usf[ts] = usf;
+}
+
/* Slot Allocation: Algorithm A
*
* Assign single slot for uplink and downlink
@@ -284,17 +295,14 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts,
if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
/* if USF available */
usf = find_free_usf(pdch, ts);
- if (usf >= 0) {
- LOGP(DRLCMAC, LOGL_DEBUG, "- Assign uplink "
- "TS=%d USF=%d\n", ts, usf);
- bts->trx[tbf->trx].ul_tbf[tbf->tfi] = tbf;
- pdch->ul_tbf[tbf->tfi] = tbf;
- tbf->pdch[ts] = pdch;
- } else {
+ if (usf < 0) {
LOGP(DRLCMAC, LOGL_NOTICE, "- Failed "
"allocating TS=%d, no USF available\n", ts);
return -EBUSY;
}
+ LOGP(DRLCMAC, LOGL_DEBUG, "- Assign uplink "
+ "TS=%d USF=%d\n", ts, usf);
+ assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf);
} else {
LOGP(DRLCMAC, LOGL_DEBUG, "- Assign downlink TS=%d\n", ts);
bts->trx[tbf->trx].dl_tbf[tbf->tfi] = tbf;
@@ -710,10 +718,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning UL TS "
"%d\n", ts);
pdch = &bts->trx[tbf->trx].pdch[ts];
- bts->trx[tbf->trx].ul_tbf[tbf->tfi] = tbf;
- pdch->ul_tbf[tbf->tfi] = tbf;
- tbf->pdch[ts] = pdch;
- tbf->dir.ul.usf[ts] = usf[ts];
+ assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf[ts]);
slotcount++;
if (slotcount == 1)
tbf->first_ts = ts;