aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2013-12-28 14:41:00 +0100
committerDaniel Willmann <daniel@totalueberwachung.de>2014-01-15 15:23:21 +0100
commit55844795be21e2e59ab6bcede2037f8c74d76505 (patch)
tree522545c0d413216dee9dfd6022bcd32ecd3ca6ee /src
parent7c3751b10bff1887e4981aa787c913aa4c812da2 (diff)
rlc/tbf: Add function receive_bsn that updates v_r, v_q, v_n
We don't need to expose the mecanics of updating the variables to the outside.
Diffstat (limited to 'src')
-rw-r--r--src/rlc.cpp8
-rw-r--r--src/rlc.h2
-rw-r--r--src/tbf.cpp6
3 files changed, 12 insertions, 4 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp
index 90944659..f3a25b23 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -197,3 +197,11 @@ uint16_t gprs_rlc_ul_window::raise_v_q()
return count;
}
+
+uint16_t gprs_rlc_ul_window::receive_bsn(const uint16_t bsn)
+{
+ m_v_n.mark_received(bsn);
+ raise_v_r(bsn);
+
+ return raise_v_q();
+}
diff --git a/src/rlc.h b/src/rlc.h
index 42ec6edd..158ec3de 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -115,6 +115,8 @@ struct gprs_rlc_ul_window {
void raise_v_q(int);
+ uint16_t receive_bsn(const uint16_t bsn);
+
uint16_t m_v_r; /* receive state */
uint16_t m_v_q; /* receive window state */
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 9276c416..6b0e779a 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1606,14 +1606,12 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len
rh->bsn, dir.ul.window.v_q(),
(dir.ul.window.v_q() + ws - 1) & mod_sns);
- dir.ul.window.m_v_n.mark_received(rh->bsn);
- dir.ul.window.raise_v_r(rh->bsn);
-
/* Raise V(Q) if possible, and retrieve LLC frames from blocks.
* This is looped until there is a gap (non received block) or
* the window is empty.*/
const uint16_t v_q_beg = dir.ul.window.v_q();
- const uint16_t count = dir.ul.window.raise_v_q();
+
+ const uint16_t count = dir.ul.window.receive_bsn(rh->bsn);
/* Retrieve LLC frames from blocks that are ready */
for (uint16_t i = 0; i < count; ++i) {