aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@espeweb.net>2021-03-02 13:19:39 +0100
committerPau Espin Pedrol <pespin@espeweb.net>2021-03-02 18:24:46 +0100
commit8afc6bad806ac6255a04f0aae8d01a9249a05b1f (patch)
tree1f5ff95b177c89386f2059610eb6a14ff3e1a15d
parent5b9d0bb8e5d75e705a6829055d2b6d142a3a200c (diff)
tbf_dl: Fix m_last_dl_drained_fn not set under some conditions
Old commit getting rid of LLC UI dummy and updating create_new_bsn() function introduced a bug by not moving update of value m_last_dl_drained_fn prior to a new break introduced. As a result, the value is not updated in the case LLC queue becomes drained but last few bytes are drained at exactly that moment. Furthermore, then the IDLE tbf timer (X2031, keep_open())) returns always true since according to it the drain never happened. The impact of the bug is basically delaying a bit more than expected the time the TBF stays in IDLE state with the TBF release process yet to be started. Related: OS#4849 Fixes: 7d0f9a0ec383fcfca934731bd6979b6be6629c90 Change-Id: I7420aeffda3500bcdc990291e4a56511af433ff9
-rw-r--r--src/tbf_dl.cpp8
-rw-r--r--tests/tbf/TbfTest.err8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 2896378..d963644 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -684,6 +684,10 @@ int gprs_rlcmac_dl_tbf::create_new_bsn(const uint32_t fn, enum CodingScheme cs)
int payload_written = 0;
if (llc_frame_length(&m_llc) == 0) {
+ /* The data just drained, store the current fn */
+ if (m_last_dl_drained_fn < 0)
+ m_last_dl_drained_fn = fn;
+
/* It is not clear, when the next real data will
* arrive, so request a DL ack/nack now */
request_dl_ack();
@@ -715,10 +719,6 @@ int gprs_rlcmac_dl_tbf::create_new_bsn(const uint32_t fn, enum CodingScheme cs)
* space-1 octets */
m_llc.put_dummy_frame(space - 1);
- /* The data just drained, store the current fn */
- if (m_last_dl_drained_fn < 0)
- m_last_dl_drained_fn = fn;
-
LOGPTBFDL(this, LOGL_DEBUG,
"Empty chunk, added LLC dummy command of size %d, drained_since=%d\n",
llc_frame_length(&m_llc), frames_since_last_drain(fn));
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 1b0739f..515b649 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -431,8 +431,8 @@ TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) V(B): (V(A)=21)""(V(S)-1=20) A=Ack
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4 mcs_mode_restrict=EGPRS
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==21 .. V(S)==21) mcs_mode_restrict=EGPRS
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Sending new dummy block at BSN 21, CS=CS-1
-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=0
-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 0/43 -> yes
+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=4
+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 4/43 -> yes
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Complete DL frame, len=19
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
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) need_padding 0 spb_status 0 spb 0 (BSN1 21 BSN2 -1)
@@ -448,8 +448,8 @@ TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) V(B): (V(A)=22)""(V(S)-1=21) A=Ack
Scheduling data message at RTS for DL TFI=0 (TRX=0, TS=4) prio=4 mcs_mode_restrict=EGPRS
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) downlink (V(A)==22 .. V(S)==22) mcs_mode_restrict=EGPRS
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Sending new dummy block at BSN 22, CS=CS-1
-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=108
-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 108/43 -> no
+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Empty chunk, added LLC dummy command of size 19, drained_since=112
+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Keep idle TBF open: 112/43 -> no
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) Complete DL frame, len=19
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW) changes state from FLOW to FINISHED
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