diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-11-25 23:51:19 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-11-26 21:00:51 +0100 |
commit | 7f3e662b3412a028254796420d7761d8c84c8fd2 (patch) | |
tree | 3a09faa65d348b5db2264726c6175bc1c5b98b86 /src/rlc.cpp | |
parent | cbb00ebd04c11aade8503e407ab97ee8b632e99f (diff) |
tbf/rlc: Move raising of V(Q) into the ul window code
Diffstat (limited to 'src/rlc.cpp')
-rw-r--r-- | src/rlc.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp index ecc7b9a5..dc5cf8b0 100644 --- a/src/rlc.cpp +++ b/src/rlc.cpp @@ -151,7 +151,7 @@ void gprs_rlc_v_n::reset() } /* Raise V(R) to highest received sequence number not received. */ -void gprs_rlc_ul_window::raise(const uint16_t bsn, gprs_rlc_v_n *v_n) +void gprs_rlc_ul_window::raise_v_r(const uint16_t bsn, gprs_rlc_v_n *v_n) { uint16_t offset_v_r; offset_v_r = (bsn + 1 - v_r()) & mod_sns(); @@ -160,8 +160,29 @@ void gprs_rlc_ul_window::raise(const uint16_t bsn, gprs_rlc_v_n *v_n) while (offset_v_r--) { if (offset_v_r) /* all except the received block */ v_n->mark_missing(v_r() & mod_sns_half()); - raise(1); + raise_v_r(1); } LOGP(DRLCMACUL, LOGL_DEBUG, "- Raising V(R) to %d\n", v_r()); } } + +/* + * Raise V(Q) if possible. This is looped until there is a gap + * (non received block) or the window is empty. + */ +uint16_t gprs_rlc_ul_window::raise_v_q(gprs_rlc_v_n *v_n) +{ + uint16_t count = 0; + + while (v_q() != v_r()) { + uint16_t index = v_q() & mod_sns_half(); + if (!v_n->is_received(index)) + break; + LOGP(DRLCMACUL, LOGL_DEBUG, "- Taking block %d out, raising " + "V(Q) to %d\n", v_q(), (v_q() + 1) & mod_sns()); + raise_v_q(1); + count += 1; + } + + return count; +} |