From e358ff8fa4865be81cd0fbf46ddd6baee3856e9b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 24 Nov 2013 17:13:10 +0100 Subject: tbf/rlc: Move the moving of V(A) into the V_B code Move the code that moves the V_B to the first not acked frame. Return how many indexes the V_B was moved and update the V_A in the caller. --- src/rlc.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/rlc.cpp') diff --git a/src/rlc.cpp b/src/rlc.cpp index d33e206..24ffc17 100644 --- a/src/rlc.cpp +++ b/src/rlc.cpp @@ -97,3 +97,22 @@ void gprs_rlc_v_b::update(BTS *bts, char *show_rbb, uint8_t ssn, } } } + +int gprs_rlc_v_b::move_window(const uint16_t v_a, const uint16_t v_s, + const uint16_t mod_sns, const uint16_t mod_sns_half) +{ + int i; + uint16_t bsn; + int moved = 0; + + for (i = 0, bsn = v_a; bsn != v_s; i++, bsn = (bsn + 1) & mod_sns) { + uint16_t index = (bsn & mod_sns_half); + if (is_acked(index)) { + mark_invalid(index); + moved += 1; + } else + break; + } + + return moved; +} -- cgit v1.2.3