aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-25 23:26:06 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-26 21:00:51 +0100
commitcbb00ebd04c11aade8503e407ab97ee8b632e99f (patch)
tree0ed727d825e1ac410910575746fe8f787fcc928c
parent423dd2286befbaa29f63c65e739bbe894daa65e1 (diff)
rlc/tbf: Move the code to raise V(R) into the ul_window handling
-rw-r--r--src/rlc.cpp16
-rw-r--r--src/rlc.h3
-rw-r--r--src/tbf.cpp17
3 files changed, 22 insertions, 14 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp
index 838554a..ecc7b9a 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -149,3 +149,19 @@ void gprs_rlc_v_n::reset()
{
memset(m_v_n, 0x0, sizeof(m_v_n));
}
+
+/* Raise V(R) to highest received sequence number not received. */
+void gprs_rlc_ul_window::raise(const uint16_t bsn, gprs_rlc_v_n *v_n)
+{
+ uint16_t offset_v_r;
+ offset_v_r = (bsn + 1 - v_r()) & mod_sns();
+ /* Positive offset, so raise. */
+ 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() & mod_sns_half());
+ raise(1);
+ }
+ LOGP(DRLCMACUL, LOGL_DEBUG, "- Raising V(R) to %d\n", v_r());
+ }
+}
diff --git a/src/rlc.h b/src/rlc.h
index 9d78280..328af6c 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -26,6 +26,7 @@
#define RLC_MAX_LEN 54 /* CS-4 including spare bits */
class BTS;
+struct gprs_rlc_v_n;
struct gprs_rlc_data {
uint8_t *prepare(size_t block_data_length);
@@ -87,6 +88,8 @@ struct gprs_rlc_ul_window {
bool is_in_window(uint8_t bsn) const;
void raise(int moves);
+ void raise(const uint16_t bsn, gprs_rlc_v_n *v_n);
+
void increment_q(int);
uint16_t m_v_r; /* receive state */
diff --git a/src/tbf.cpp b/src/tbf.cpp
index edba28a..a2667e4 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1553,7 +1553,7 @@ int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len)
int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len, int8_t rssi)
{
- uint16_t offset_v_r, index;
+ uint16_t index;
struct rlc_ul_header *rh = (struct rlc_ul_header *)data;
int rc;
@@ -1608,23 +1608,12 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len
/* Write block to buffer and set receive state array. */
index = rh->bsn & mod_sns_half; /* memory index of block */
m_rlc.blocks[index].put_data(data, len);
- dir.ul.v_n.mark_received(index);
LOGP(DRLCMACUL, LOGL_DEBUG, "- BSN %d storing in window (%d..%d)\n",
rh->bsn, dir.ul.window.v_q(),
(dir.ul.window.v_q() + ws - 1) & mod_sns);
- /* Raise V(R) to highest received sequence number not received. */
- offset_v_r = (rh->bsn + 1 - dir.ul.window.v_r()) & mod_sns;
- if (offset_v_r < (sns() >> 1)) { /* Positive offset, so raise. */
- while (offset_v_r--) {
- if (offset_v_r) /* all except the received block */
- dir.ul.v_n.mark_missing(dir.ul.window.v_r() & mod_sns_half);
- this->dir.ul.window.raise(1);
- /* Inc V(R). */
- }
- LOGP(DRLCMACUL, LOGL_DEBUG, "- Raising V(R) to %d\n",
- this->dir.ul.window.v_r());
- }
+ dir.ul.v_n.mark_received(index);
+ dir.ul.window.raise(rh->bsn, &dir.ul.v_n);
/* Raise V(Q) if possible, and retrieve LLC frames from blocks.
* This is looped until there is a gap (non received block) or