<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/19196">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pdch.cpp: Fix wrong annoying log line about non-scheduled ResourceReq received<br><br>It's perfectly fine receiving a Resource Request message under some<br>circumstances (as stated in the comment added in the commit).<br><br>To print issues only under non-expected circumstances, the function<br>rcv_resource_request need to be refactored:<br>* Destroying older UL_TBF is delayed because it is needed further<br>  down.<br>* When the old UL_TBF is FINISHED, it's an acceptable time to receive a<br>  Resource request, so we check if that's the case and don't print a<br>  warning in that case.<br><br>Change-Id: I4b4367126d6a16055cd2f45afc4a6b9c15a7c980<br>---<br>M src/pdch.cpp<br>M tests/tbf/TbfTest.err<br>2 files changed, 22 insertions(+), 21 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/96/19196/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/pdch.cpp b/src/pdch.cpp</span><br><span>index 3436e5b..cee92dc 100644</span><br><span>--- a/src/pdch.cpp</span><br><span>+++ b/src/pdch.cpp</span><br><span>@@ -550,42 +550,35 @@</span><br><span>        if (request->ID.UnionType) {</span><br><span>              struct gprs_rlcmac_ul_tbf *ul_tbf;</span><br><span>           uint32_t tlli = request->ID.u.TLLI;</span><br><span style="color: hsl(0, 100%, 40%);">-          bool found = true;</span><br><span style="color: hsl(120, 100%, 40%);">+            bool ms_found = true;</span><br><span> </span><br><span>            GprsMs *ms = bts()->ms_by_tlli(tlli);</span><br><span>             if (!ms) {</span><br><span style="color: hsl(0, 100%, 40%);">-                      found = false;</span><br><span style="color: hsl(120, 100%, 40%);">+                        ms_found = false;</span><br><span>                    ms = bts()->ms_alloc(0, 0); /* ms class updated later */</span><br><span>          }</span><br><span style="color: hsl(120, 100%, 40%);">+             ul_tbf = ms->ul_tbf(); /* hence ul_tbf may be NULL */</span><br><span> </span><br><span>                 /* Keep the ms, even if it gets idle temporarily */</span><br><span>          GprsMs::Guard guard(ms);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-            if (found) {</span><br><span style="color: hsl(0, 100%, 40%);">-                    ul_tbf = ms->ul_tbf();</span><br><span style="color: hsl(0, 100%, 40%);">-                       /* We got a RACH so the MS was in packet idle mode and thus</span><br><span style="color: hsl(0, 100%, 40%);">-                      * didn't have any active TBFs */</span><br><span style="color: hsl(0, 100%, 40%);">-                   if (ul_tbf) {</span><br><span style="color: hsl(0, 100%, 40%);">-                           LOGPTBFUL(ul_tbf, LOGL_NOTICE,</span><br><span style="color: hsl(0, 100%, 40%);">-                                    "Got RACH from TLLI=0x%08x while TBF still exists. Killing pending UL TBF\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                                         tlli);</span><br><span style="color: hsl(0, 100%, 40%);">-                                tbf_free(ul_tbf);</span><br><span style="color: hsl(0, 100%, 40%);">-                       }</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>            LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF "</span><br><span>                    "in packet resource request of single "</span><br><span>                    "block, so we provide one:\n");</span><br><span>            sba = bts()->sba()->find(this, fn);</span><br><span style="color: hsl(0, 100%, 40%);">-               if (!sba) {</span><br><span style="color: hsl(0, 100%, 40%);">-                     LOGP(DRLCMAC, LOGL_NOTICE, "MS requests UL TBF "</span><br><span style="color: hsl(0, 100%, 40%);">-                              "in packet resource request of single "</span><br><span style="color: hsl(0, 100%, 40%);">-                               "block, but there is no resource request "</span><br><span style="color: hsl(0, 100%, 40%);">-                            "scheduled!\n");</span><br><span style="color: hsl(0, 100%, 40%);">-              } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              if (sba) {</span><br><span>                   ms->set_ta(sba->ta);</span><br><span>                   bts()->sba()->free_sba(sba);</span><br><span style="color: hsl(120, 100%, 40%);">+            } else if (!ul_tbf || !ul_tbf->state_is(GPRS_RLCMAC_FINISHED)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   LOGPTBFUL(ul_tbf, LOGL_NOTICE,</span><br><span style="color: hsl(120, 100%, 40%);">+                                  "MS requests UL TBF in PACKET RESOURCE REQ of "</span><br><span style="color: hsl(120, 100%, 40%);">+                             "single block, but there is no resource request "</span><br><span style="color: hsl(120, 100%, 40%);">+                           "scheduled!\n");</span><br><span>                 }</span><br><span style="color: hsl(120, 100%, 40%);">+             /* else: Resource Request can be received even if not scheduled</span><br><span style="color: hsl(120, 100%, 40%);">+                  by the network since it's used by MS to re-establish a new UL</span><br><span style="color: hsl(120, 100%, 40%);">+             TBF when last one has finished. */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>              if (request->Exist_MS_Radio_Access_capability2) {</span><br><span>                         uint8_t ms_class, egprs_ms_class;</span><br><span>                    ms_class = Decoding::get_ms_class_by_capability(&request->MS_Radio_Access_capability2);</span><br><span>@@ -596,6 +589,14 @@</span><br><span>                                ms->set_egprs_ms_class(egprs_ms_class);</span><br><span>           }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+         /* Get rid of previous finished UL TBF before providing a new one */</span><br><span style="color: hsl(120, 100%, 40%);">+          if (ms_found && ul_tbf) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (!ul_tbf->state_is(GPRS_RLCMAC_FINISHED))</span><br><span style="color: hsl(120, 100%, 40%);">+                               LOGPTBFUL(ul_tbf, LOGL_NOTICE,</span><br><span style="color: hsl(120, 100%, 40%);">+                                          "Got PACKET RESOURCE REQ while TBF not finished, killing pending UL TBF\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                      tbf_free(ul_tbf);</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          ul_tbf = tbf_alloc_ul(bts_data(), ms, trx_no(), tlli);</span><br><span>               if (!ul_tbf) {</span><br><span>                       handle_tbf_reject(bts_data(), ms, tlli,</span><br><span>diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err</span><br><span>index 800d4f8..29c8eb3 100644</span><br><span>--- a/tests/tbf/TbfTest.err</span><br><span>+++ b/tests/tbf/TbfTest.err</span><br><span>@@ -7902,7 +7902,7 @@</span><br><span> ------------------------- RX : Uplink Control Block -------------------------</span><br><span> Creating MS object, TLLI = 0x00000000</span><br><span> MS requests UL TBF in packet resource request of single block, so we provide one:</span><br><span style="color: hsl(0, 100%, 40%);">-MS requests UL TBF in packet resource request of single block, but there is no resource request scheduled!</span><br><span style="color: hsl(120, 100%, 40%);">+(no TBF) MS requests UL TBF in PACKET RESOURCE REQ of single block, but there is no resource request scheduled!</span><br><span> Modifying MS object, TLLI = 0x00000000, MS class 0 -> 11</span><br><span> Modifying MS object, TLLI = 0x00000000, EGPRS MS class 0 -> 11</span><br><span> ********** UL-TBF starts here **********</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/19196">change 19196</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-pcu/+/19196"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I4b4367126d6a16055cd2f45afc4a6b9c15a7c980 </div>
<div style="display:none"> Gerrit-Change-Number: 19196 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>