<div dir="ltr"><div>I paid attention that when mode "a" used ( 1 ts configuration)  0  is the only usf value allocated in spite of two MSs are involved in the test. I understand that it may be OK if they haven't opened UL TBFs at the same time, but analyzing the source code I didn't find that the local variable usf after getting value delivers it further to   tbf->dir.ul.usf[ts] or I'm missing something. I'll try the patch later (in several days).</div>
<div> </div><div>Regards,</div><div>Vladimir Rolbin</div><div> </div><div> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 25, 2013 at 1:11 PM, Holger Hans Peter Freyther <span dir="ltr"><<a href="mailto:hfreyther@sysmocom.de" target="_blank">hfreyther@sysmocom.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Sep 24, 2013 at 01:26:17PM +0300, Vladimir Rolbin wrote:<br>
> Hi all,<br>
><br>
> It looks like usf found (allocated) is never used. I guess something<br>
> like tbf->dir.ul.usf[ts] = usf is missed.<br>
<br>
Hi!<br>
<br>
can you indicate on how to re-produce the problem and how much time<br>
you have spent in analyzing this problem? I have indicated the lack<br>
of test cases in the past.<br>
<br>
I moved the "assignment" (having to pass trx, bts, pdch, ts just<br>
indicates the lack of structure in this code...) into a new method.<br>
It kills code duplication and could fix the issue. I have only compile<br>
tested it. Could you give it a try?<br>
<br>
holger<br>
<br>
<br>
<br>
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp<br>
index 1d1a8c6..695bf47 100644<br>
--- a/src/gprs_rlcmac.cpp<br>
+++ b/src/gprs_rlcmac.cpp<br>
@@ -402,6 +402,17 @@ next_diagram:<br>
        return tbf;<br>
 }<br>
<br>
+static void assign_uplink_tbf_usf(struct gprs_rlcmac_bts *bts,<br>
+                               struct gprs_rlcmac_pdch *pdch,<br>
+                               int ts,<br>
+                               struct gprs_rlcmac_tbf *tbf, int8_t usf)<br>
+{<br>
+       bts->trx[tbf->trx].ul_tbf[tbf->tfi] = tbf;<br>
+       pdch->ul_tbf[tbf->tfi] = tbf;<br>
+       tbf->pdch[ts] = pdch;<br>
+       tbf->dir.ul.usf[ts] = usf;<br>
+}<br>
+<br>
 /* Slot Allocation: Algorithm A<br>
  *<br>
  * Assign single slot for uplink and downlink<br>
@@ -433,17 +444,14 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts,<br>
        if (tbf->direction == GPRS_RLCMAC_UL_TBF) {<br>
                /* if USF available */<br>
                usf = find_free_usf(pdch, ts);<br>
-               if (usf >= 0) {<br>
-                       LOGP(DRLCMAC, LOGL_DEBUG, "- Assign uplink "<br>
-                               "TS=%d USF=%d\n", ts, usf);<br>
-                       bts->trx[tbf->trx].ul_tbf[tbf->tfi] = tbf;<br>
-                       pdch->ul_tbf[tbf->tfi] = tbf;<br>
-                       tbf->pdch[ts] = pdch;<br>
-               } else {<br>
+               if (usf < 0) {<br>
                        LOGP(DRLCMAC, LOGL_NOTICE, "- Failed "<br>
                                "allocating TS=%d, no USF available\n", ts);<br>
                        return -EBUSY;<br>
                }<br>
+               LOGP(DRLCMAC, LOGL_DEBUG, "- Assign uplink "<br>
+                       "TS=%d USF=%d\n", ts, usf);<br>
+               assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf);<br>
        } else {<br>
                LOGP(DRLCMAC, LOGL_DEBUG, "- Assign downlink TS=%d\n", ts);<br>
                bts->trx[tbf->trx].dl_tbf[tbf->tfi] = tbf;<br>
@@ -859,10 +867,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,<br>
                                LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning UL TS "<br>
                                        "%d\n", ts);<br>
                                pdch = &bts->trx[tbf->trx].pdch[ts];<br>
-                               bts->trx[tbf->trx].ul_tbf[tbf->tfi] = tbf;<br>
-                               pdch->ul_tbf[tbf->tfi] = tbf;<br>
-                               tbf->pdch[ts] = pdch;<br>
-                               tbf->dir.ul.usf[ts] = usf[ts];<br>
+                               assign_uplink_tbf_usf(bts, pdch, ts, tbf, usf[ts]);<br>
                                slotcount++;<br>
                                if (slotcount == 1)<br>
                                        tbf->first_ts = ts;<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
- Holger Freyther <<a href="mailto:hfreyther@sysmocom.de">hfreyther@sysmocom.de</a>>       <a href="http://www.sysmocom.de/" target="_blank">http://www.sysmocom.de/</a><br>
=======================================================================<br>
* sysmocom - systems for mobile communications GmbH<br>
* Schivelbeiner Str. 5<br>
* 10439 Berlin, Germany<br>
* Sitz / Registered office: Berlin, HRB 134158 B<br>
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte<br>
<br>
</font></span></blockquote></div><br></div>