aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2013-11-27 17:08:35 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-12-12 10:59:56 +0100
commit8a31f9e016067991b426e0be7637dd38002f1c3e (patch)
tree356939ed571058eefa01b3b049948c06b2440908
parent11f2d58dbd0f590da3612a9f587a23b92857436f (diff)
rlc: Manage the received block bitmap in the ul_window
Added two methods to gprs_rlc_ul_window * ssn() returns the starting sequence number * update_rbb() returns an array of chars representing the state of the received block bitmap. Each element is either 'I'nvalid or 'R'eceived. The rbb is generated from v_n rbb[63] relates to BSN ssn-1 ... rbb[0] relates to BSN ssn-64
-rw-r--r--src/rlc.cpp12
-rw-r--r--src/rlc.h8
2 files changed, 20 insertions, 0 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp
index 915da87f..4ee5f610 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -146,6 +146,18 @@ void gprs_rlc_v_n::reset()
memset(m_v_n, 0x0, sizeof(m_v_n));
}
+/* Update the receive block bitmap */
+void gprs_rlc_ul_window::update_rbb(const gprs_rlc_v_n *v_n, char *rbb)
+{
+ int i;
+ for (i=0; i < ws(); i++) {
+ if (v_n->is_received(ssn()-1-i))
+ rbb[ws()-1-i] = 'R';
+ else
+ rbb[ws()-1-i] = 'I';
+ }
+}
+
/* Raise V(R) to highest received sequence number not received. */
void gprs_rlc_ul_window::raise_v_r(const uint16_t bsn, gprs_rlc_v_n *v_n)
{
diff --git a/src/rlc.h b/src/rlc.h
index 0ecce407..d68afab8 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -89,8 +89,11 @@ struct gprs_rlc_ul_window {
const uint16_t v_r() const;
const uint16_t v_q() const;
+ const uint16_t ssn() const;
+
bool is_in_window(uint8_t bsn) const;
+ void update_rbb(const gprs_rlc_v_n *v_n, char *rbb);
void raise_v_r(int moves);
void raise_v_r(const uint16_t bsn, gprs_rlc_v_n *v_n);
uint16_t raise_v_q(gprs_rlc_v_n *v_n);
@@ -339,6 +342,11 @@ inline const uint16_t gprs_rlc_ul_window::v_q() const
return m_v_q;
}
+inline const uint16_t gprs_rlc_ul_window::ssn() const
+{
+ return m_v_r;
+}
+
inline void gprs_rlc_ul_window::raise_v_r(int moves)
{
m_v_r = (m_v_r + moves) & mod_sns();