<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/23197">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">tbf_dl: Fix m_last_dl_drained_fn not set under some conditions<br><br>Old commit getting rid of LLC UI dummy and updating create_new_bsn()<br>function introduced a bug by not moving update of value m_last_dl_drained_fn<br>prior to a new break introduced.<br>As a result, the value is not updated in the case LLC queue becomes<br>drained but last few bytes are drained at exactly that moment.<br>Furthermore, then the IDLE tbf timer (X2031, keep_open())) returns always<br>true since according to it the drain never happened.<br><br>The impact of the bug is basically delaying a bit more than expected the<br>time the TBF stays in IDLE state with the TBF release process yet<br>to be started.<br><br>Related: OS#4849<br>Fixes: 7d0f9a0ec383fcfca934731bd6979b6be6629c90<br>Change-Id: I7420aeffda3500bcdc990291e4a56511af433ff9<br>---<br>M src/tbf_dl.cpp<br>M tests/tbf/TbfTest.err<br>2 files changed, 8 insertions(+), 8 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/97/23197/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp</span><br><span>index 2896378..d963644 100644</span><br><span>--- a/src/tbf_dl.cpp</span><br><span>+++ b/src/tbf_dl.cpp</span><br><span>@@ -684,6 +684,10 @@</span><br><span>               int payload_written = 0;</span><br><span> </span><br><span>                 if (llc_frame_length(&m_llc) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      /* The data just drained, store the current fn */</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (m_last_dl_drained_fn < 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                              m_last_dl_drained_fn = fn;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>                         /* It is not clear, when the next real data will</span><br><span>                      * arrive, so request a DL ack/nack now */</span><br><span>                   request_dl_ack();</span><br><span>@@ -715,10 +719,6 @@</span><br><span>                      * space-1 octets */</span><br><span>                         m_llc.put_dummy_frame(space - 1);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-                   /* The data just drained, store the current fn */</span><br><span style="color: hsl(0, 100%, 40%);">-                       if (m_last_dl_drained_fn < 0)</span><br><span style="color: hsl(0, 100%, 40%);">-                                m_last_dl_drained_fn = fn;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>                   LOGPTBFDL(this, LOGL_DEBUG,</span><br><span>                            "Empty chunk, added LLC dummy command of size %d, drained_since=%d\n",</span><br><span>                             llc_frame_length(&m_llc), frames_since_last_drain(fn));</span><br><span>diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err</span><br><span>index 1b0739f..515b649 100644</span><br><span>--- a/tests/tbf/TbfTest.err</span><br><span>+++ b/tests/tbf/TbfTest.err</span><br><span>@@ -431,8 +431,8 @@</span><br><span> Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4 mcs_mode_restrict=EGPRS</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==21 .. V(S)==21) mcs_mode_restrict=EGPRS</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Sending new dummy block at BSN 21, CS=CS-1</span><br><span style="color: hsl(0, 100%, 40%);">-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=0</span><br><span style="color: hsl(0, 100%, 40%);">-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 0/43 -> yes</span><br><span style="color: hsl(120, 100%, 40%);">+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=4</span><br><span style="color: hsl(120, 100%, 40%);">+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 4/43 -> yes</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Complete DL frame, len=19</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) data block (BSN 21, CS-1): 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b </span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) need_padding 0 spb_status 0 spb 0 (BSN1 21 BSN2 -1)</span><br><span>@@ -448,8 +448,8 @@</span><br><span> Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4 mcs_mode_restrict=EGPRS</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==22 .. V(S)==22) mcs_mode_restrict=EGPRS</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Sending new dummy block at BSN 22, CS=CS-1</span><br><span style="color: hsl(0, 100%, 40%);">-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=108</span><br><span style="color: hsl(0, 100%, 40%);">-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 108/43 -> no</span><br><span style="color: hsl(120, 100%, 40%);">+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=112</span><br><span style="color: hsl(120, 100%, 40%);">+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 112/43 -> no</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Complete DL frame, len=19</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) changes state from FLOW to FINISHED</span><br><span> TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FINISHED) data block (BSN 22, CS-1): 4d 43 c0 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/23197">change 23197</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/+/23197"/><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: I7420aeffda3500bcdc990291e4a56511af433ff9 </div>
<div style="display:none"> Gerrit-Change-Number: 23197 </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>