aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-13 19:51:55 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-13 19:51:55 +0100
commit9241fd0957d44d2b60b74afd9022b01a1ea110ba (patch)
tree89e09b04248c289a91d1bfa285c1d69334e24d8c
parente9429b5d3ecb3176eaee45352d9b7d1d57fed1c5 (diff)
rlc: Begin to move the rlc block handling into a separate object
The secret of gprs_rlc will be the manipulation of the blocks for the current window. We might add the window handling in this class as well.
-rw-r--r--src/tbf.cpp18
-rw-r--r--src/tbf.h13
2 files changed, 20 insertions, 11 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 909f2a6..54bc539 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -964,7 +964,7 @@ do_resend:
/* now we still have untransmitted LLC data, so we fill mac block */
index = dir.dl.v_s & mod_sns_half;
- data = rlc_block[index];
+ data = m_rlc.block[index];
#warning "Selection of the CS doesn't belong here"
if (cs == 0) {
cs = bts_data()->initial_cs_dl;
@@ -1102,8 +1102,8 @@ do_resend:
break;
}
LOGP(DRLCMACDL, LOGL_DEBUG, "data block: %s\n",
- osmo_hexdump(rlc_block[index], block_length));
- rlc_block_len[index] = block_length;
+ osmo_hexdump(m_rlc.block[index], block_length));
+ m_rlc.block_len[index] = block_length;
/* raise send state and set ack state array */
dir.dl.v_b[index] = 'U'; /* unacked */
dir.dl.v_s = (dir.dl.v_s + 1) & mod_sns; /* inc send state */
@@ -1121,8 +1121,8 @@ struct msgb *gprs_rlcmac_tbf::create_dl_acked_block(
uint8_t len;
/* get data and header from current block */
- data = rlc_block[index];
- len = rlc_block_len[index];
+ data = m_rlc.block[index];
+ len = m_rlc.block_len[index];
rh = (struct rlc_dl_header *)data;
/* Clear Polling, if still set in history buffer */
@@ -1701,8 +1701,8 @@ 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 */
- memcpy(this->rlc_block[index], data, len); /* Copy block. */
- this->rlc_block_len[index] = len;
+ memcpy(m_rlc.block[index], data, len); /* Copy block. */
+ m_rlc.block_len[index] = len;
this->dir.ul.v_n[index] = 'R'; /* Mark received block. */
LOGP(DRLCMACUL, LOGL_DEBUG, "- BSN %d storing in window (%d..%d)\n",
rh->bsn, this->dir.ul.v_q,
@@ -1731,7 +1731,7 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len
"V(Q) to %d\n", this->dir.ul.v_q,
(this->dir.ul.v_q + 1) & mod_sns);
/* get LLC data from block */
- this->assemble_forward_llc(this->rlc_block[index], this->rlc_block_len[index]);
+ this->assemble_forward_llc(m_rlc.block[index], m_rlc.block_len[index]);
/* raise V(Q), because block already received */
this->dir.ul.v_q = (this->dir.ul.v_q + 1) & mod_sns;
}
@@ -1740,7 +1740,7 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len
if (this->state_is(GPRS_RLCMAC_FLOW) /* still in flow state */
&& this->dir.ul.v_q == this->dir.ul.v_r) { /* if complete */
struct rlc_ul_header *last_rh = (struct rlc_ul_header *)
- this->rlc_block[(this->dir.ul.v_r - 1) & mod_sns_half];
+ m_rlc.block[(this->dir.ul.v_r - 1) & mod_sns_half];
LOGP(DRLCMACUL, LOGL_DEBUG, "- No gaps in received block, "
"last block: BSN=%d CV=%d\n", last_rh->bsn,
last_rh->cv);
diff --git a/src/tbf.h b/src/tbf.h
index 9518670..1ea8c63 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -85,6 +85,15 @@ enum gprs_rlcmac_tbf_direction {
#define GPRS_RLCMAC_FLAG_TO_DL_ASS 7
#define GPRS_RLCMAC_FLAG_TO_MASK 0xf0 /* timeout bits */
+/*
+ * I hold the currently transferred blocks and will provide
+ * the routines to manipulate these arrays.
+ */
+struct gprs_rlc {
+ uint8_t block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */
+ uint8_t block_len[RLC_MAX_SNS/2]; /* block len of history */
+};
+
struct gprs_rlcmac_tbf {
static void free_all(struct gprs_rlcmac_trx *trx);
@@ -187,8 +196,8 @@ struct gprs_rlcmac_tbf {
uint8_t final_ack_sent; /* set if we sent final ack */
} ul;
} dir;
- uint8_t rlc_block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */
- uint8_t rlc_block_len[RLC_MAX_SNS/2]; /* block len of history */
+
+ gprs_rlc m_rlc;
uint8_t n3105; /* N3105 counter */