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.
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 @@
 		}
 	}
 }
+
+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;
+}
diff --git a/src/rlc.h b/src/rlc.h
index 6905e2b..2bb512b 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -56,6 +56,8 @@
 	void 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);
+	int move_window(const uint16_t v_a, const uint16_t v_s,
+			const uint16_t mod_sns, const uint16_t mod_sns_half);
 
 	/* Check for an individual frame */
 	bool is_unacked(int index) const;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index c83ca96..0d6d19b 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1405,14 +1405,8 @@
 		gprs_rlcmac_received_lost(this, received, lost);
 
 		/* raise V(A), if possible */
-		for (i = 0, bsn = dir.dl.v_a; bsn != dir.dl.v_s;
-		     i++, bsn = (bsn + 1) & mod_sns) {
-			if (dir.dl.v_b.is_acked(bsn & mod_sns_half)) {
-				dir.dl.v_b.mark_invalid(bsn & mod_sns_half);
-				dir.dl.v_a = (dir.dl.v_a + 1) & mod_sns;
-			} else
-				break;
-		}
+		dir.dl.v_a += dir.dl.v_b.move_window(dir.dl.v_a, dir.dl.v_s,
+							mod_sns, mod_sns_half) & mod_sns;
 
 		/* show receive state array in debug (V(A)..V(S)-1) */
 		for (i = 0, bsn = dir.dl.v_a; bsn != dir.dl.v_s;