aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlc.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-24 17:05:48 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-26 20:57:24 +0100
commitdf6b4f52e05e699b9a96a920973bff6241b5a853 (patch)
tree433c1d5a236191f6ed4cb500054447ffae0712f6 /src/rlc.cpp
parent9eb8ace2608980f6c5e68610210fc6dd921b41ff (diff)
tbf/rlc: Move the parsing of RBB to Decoding, move window marking out
Move the parsing of the bitbmap out of the TBF code into Decoding. Move the updating of the V_B into the V_B class. Add some comments about handling the mod_sns, mod_sns_half parameters by using template code.
Diffstat (limited to 'src/rlc.cpp')
-rw-r--r--src/rlc.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp
index f6b13623..d33e2067 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -17,6 +17,8 @@
*/
#include "tbf.h"
+#include "bts.h"
+#include "gprs_debug.h"
extern "C" {
#include <osmocom/core/utils.h>
@@ -68,3 +70,30 @@ int gprs_rlc_v_b::mark_for_resend(const uint16_t v_a, const uint16_t v_s,
return resend;
}
+
+void gprs_rlc_v_b::update(BTS *bts, char *show_rbb, uint8_t ssn,
+ const uint16_t v_a,
+ const uint16_t mod_sns, const uint16_t mod_sns_half,
+ uint16_t *lost, uint16_t *received)
+{
+ uint16_t bsn;
+ int i;
+
+ /* SSN - 1 is in range V(A)..V(S)-1 */
+ for (i = 63, bsn = (ssn - 1) & mod_sns;
+ i >= 0 && bsn != ((v_a - 1) & mod_sns);
+ i--, bsn = (bsn - 1) & mod_sns) {
+
+ if (show_rbb[i] == '1') {
+ LOGP(DRLCMACDL, LOGL_DEBUG, "- got ack for BSN=%d\n", bsn);
+ if (!is_acked(bsn & mod_sns_half))
+ *received += 1;
+ mark_acked(bsn & mod_sns_half);
+ } else {
+ LOGP(DRLCMACDL, LOGL_DEBUG, "- got NACK for BSN=%d\n", bsn);
+ mark_nacked(bsn & mod_sns_half);
+ bts->rlc_nacked();
+ *lost += 1;
+ }
+ }
+}