On Tue, Sep 24, 2013 at 01:26:17PM +0300, Vladimir Rolbin wrote:
Hi all,
It looks like usf found (allocated) is never used. I guess something
like tbf->dir.ul.usf[ts] = usf is missed.
Hi!
can you indicate on how to re-produce the problem and how much time
you have spent in analyzing this problem? I have indicated the lack
of test cases in the past.
I moved the "assignment" (having to pass trx, bts, pdch, ts just
indicates the lack of structure in this code...) into a new method.
It kills code duplication and could fix the issue. I have only compile
tested it. Could you give it a try?
holger
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 1d1a8c6..695bf47 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -402,6 +402,17 @@ next_diagram:
return tbf;
}
+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
@@ -433,17 +444,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;
@@ -859,10 +867,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;
--
- Holger Freyther <hfreyther(a)sysmocom.de>
http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Schivelbeiner Str. 5
* 10439 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte