diff options
author | Daniel Willmann <daniel@totalueberwachung.de> | 2013-12-28 13:59:24 +0100 |
---|---|---|
committer | Daniel Willmann <daniel@totalueberwachung.de> | 2014-01-15 15:23:21 +0100 |
commit | 7c3751b10bff1887e4981aa787c913aa4c812da2 (patch) | |
tree | 725302590546aa3ffb712200ef63863db3ecc209 /src | |
parent | f4a1ec6ce7bd38b829309fe7e04ef3d534d24581 (diff) |
rlc/tbf: Move v_n into gprs_rlc_ul_window and adapt the tests
v_n is part of the UL window handling so move it inside the ul_window
Diffstat (limited to 'src')
-rw-r--r-- | src/encoding.cpp | 2 | ||||
-rw-r--r-- | src/rlc.cpp | 12 | ||||
-rw-r--r-- | src/rlc.h | 38 | ||||
-rw-r--r-- | src/tbf.cpp | 6 | ||||
-rw-r--r-- | src/tbf.h | 1 |
5 files changed, 30 insertions, 29 deletions
diff --git a/src/encoding.cpp b/src/encoding.cpp index 8ec93c98..51b0fbe5 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -382,7 +382,7 @@ void Encoding::write_packet_uplink_ack(struct gprs_rlcmac_bts *bts, char rbb[65]; - tbf->dir.ul.window.update_rbb(&tbf->dir.ul.v_n, rbb); + tbf->dir.ul.window.update_rbb(rbb); LOGP(DRLCMACUL, LOGL_DEBUG, "Encoding Ack/Nack for %s " "(final=%d)\n", tbf_name(tbf), final); diff --git a/src/rlc.cpp b/src/rlc.cpp index 0f481afc..90944659 100644 --- a/src/rlc.cpp +++ b/src/rlc.cpp @@ -151,11 +151,11 @@ void gprs_rlc_v_n::reset() } /* Update the receive block bitmap */ -void gprs_rlc_ul_window::update_rbb(const gprs_rlc_v_n *v_n, char *rbb) +void gprs_rlc_ul_window::update_rbb(char *rbb) { int i; for (i=0; i < ws(); i++) { - if (v_n->is_received(ssn()-1-i)) + if (m_v_n.is_received(ssn()-1-i)) rbb[ws()-1-i] = 'R'; else rbb[ws()-1-i] = 'I'; @@ -163,7 +163,7 @@ void gprs_rlc_ul_window::update_rbb(const gprs_rlc_v_n *v_n, char *rbb) } /* 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) +void gprs_rlc_ul_window::raise_v_r(const uint16_t bsn) { uint16_t offset_v_r; offset_v_r = (bsn + 1 - v_r()) & mod_sns(); @@ -171,7 +171,7 @@ void gprs_rlc_ul_window::raise_v_r(const uint16_t bsn, gprs_rlc_v_n *v_n) if (offset_v_r < (sns() >> 1)) { while (offset_v_r--) { if (offset_v_r) /* all except the received block */ - v_n->mark_missing(v_r()); + m_v_n.mark_missing(v_r()); raise_v_r_to(1); } LOGP(DRLCMACUL, LOGL_DEBUG, "- Raising V(R) to %d\n", v_r()); @@ -182,12 +182,12 @@ void gprs_rlc_ul_window::raise_v_r(const uint16_t bsn, gprs_rlc_v_n *v_n) * 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 gprs_rlc_ul_window::raise_v_q() { uint16_t count = 0; while (v_q() != v_r()) { - if (!v_n->is_received(v_q())) + if (!m_v_n.is_received(v_q())) break; LOGP(DRLCMACUL, LOGL_DEBUG, "- Taking block %d out, raising " "V(Q) to %d\n", v_q(), (v_q() + 1) & mod_sns()); @@ -81,6 +81,21 @@ struct gprs_rlc_dl_window { uint16_t m_v_a; /* ack state */ }; +struct gprs_rlc_v_n { + void reset(); + + void mark_received(int bsn); + void mark_missing(int bsn); + + bool is_received(int bsn) const; + + char state(int bsn) const; +private: + bool is_state(int bsn, const char state) const; + void mark(int bsn, const char state); + char m_v_n[RLC_MAX_SNS/2]; /* receive state array */ +}; + struct gprs_rlc_ul_window { const uint16_t mod_sns() const; const uint16_t sns() const; @@ -93,15 +108,17 @@ struct gprs_rlc_ul_window { bool is_in_window(uint8_t bsn) const; - void update_rbb(const gprs_rlc_v_n *v_n, char *rbb); + void update_rbb(char *rbb); void raise_v_r_to(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); + void raise_v_r(const uint16_t bsn); + uint16_t raise_v_q(); void raise_v_q(int); uint16_t m_v_r; /* receive state */ uint16_t m_v_q; /* receive window state */ + + gprs_rlc_v_n m_v_n; }; /** @@ -141,21 +158,6 @@ private: char m_v_b[RLC_MAX_SNS/2]; /* acknowledge state array */ }; -struct gprs_rlc_v_n { - void reset(); - - void mark_received(int bsn); - void mark_missing(int bsn); - - bool is_received(int bsn) const; - - char state(int bsn) const; -private: - bool is_state(int bsn, const char state) const; - void mark(int bsn, const char state); - char m_v_n[RLC_MAX_SNS/2]; /* receive state array */ -}; - extern "C" { /* TS 04.60 10.2.2 */ struct rlc_ul_header { diff --git a/src/tbf.cpp b/src/tbf.cpp index a91193d2..9276c416 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -1606,14 +1606,14 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len rh->bsn, dir.ul.window.v_q(), (dir.ul.window.v_q() + ws - 1) & mod_sns); - dir.ul.v_n.mark_received(rh->bsn); - dir.ul.window.raise_v_r(rh->bsn, &dir.ul.v_n); + dir.ul.window.m_v_n.mark_received(rh->bsn); + dir.ul.window.raise_v_r(rh->bsn); /* Raise V(Q) if possible, and retrieve LLC frames from blocks. * This is looped until there is a gap (non received block) or * the window is empty.*/ const uint16_t v_q_beg = dir.ul.window.v_q(); - const uint16_t count = dir.ul.window.raise_v_q(&dir.ul.v_n); + const uint16_t count = dir.ul.window.raise_v_q(); /* Retrieve LLC frames from blocks that are ready */ for (uint16_t i = 0; i < count; ++i) { @@ -174,7 +174,6 @@ struct gprs_rlcmac_tbf { } dl; struct { gprs_rlc_ul_window window; - gprs_rlc_v_n v_n; int32_t rx_counter; /* count all received blocks */ uint8_t n3103; /* N3103 counter */ uint8_t usf[8]; /* list USFs per PDCH (timeslot) */ |