aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-13 20:45:40 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-19 21:26:43 +0100
commit58db60c68ebf137ae2a886ec3bd1188431c84721 (patch)
tree7f7ad8e152d20fdd338e6ccf0ebeb2df8096d9ee /src/tbf.cpp
parentc3d5325fc85eba3110f229546bc2b4fe91e3e1c2 (diff)
rlc: Start to move things out of the tbf into the rlc
Add remarks of possible broken behavior inside the tbf routines. Move the preparation (and init) into the new rlc.cpp file.
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r--src/tbf.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 3fd24815..0226691f 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -878,8 +878,6 @@ struct msgb *gprs_rlcmac_tbf::create_dl_acked_block(uint32_t fn, uint8_t ts)
{
struct rlc_dl_header *rh;
struct rlc_li_field *li;
- uint8_t block_length; /* total length of block, including spare bits */
- uint8_t block_data; /* usable data of block, w/o spare bits, inc. MAC */
struct msgb *msg;
uint8_t bsn;
uint16_t mod_sns = sns - 1;
@@ -966,18 +964,21 @@ do_resend:
LOGP(DRLCMACDL, LOGL_DEBUG, "- Sending new block at BSN %d\n",
dir.dl.v_s);
- /* now we still have untransmitted LLC data, so we fill mac block */
- index = dir.dl.v_s & mod_sns_half;
- data = m_rlc.blocks[index].block;
#warning "Selection of the CS doesn't belong here"
if (cs == 0) {
cs = bts_data()->initial_cs_dl;
if (cs < 1 || cs > 4)
cs = 1;
}
- block_length = gprs_rlcmac_cs[cs].block_length;
- block_data = gprs_rlcmac_cs[cs].block_data;
- memset(data, 0x2b, block_data); /* spare bits will be left 0 */
+ /* total length of block, including spare bits */
+ const uint8_t block_length = gprs_rlcmac_cs[cs].block_length;
+ /* length of usable data of block, w/o spare bits, inc. MAC */
+ const uint8_t block_data_len = gprs_rlcmac_cs[cs].block_data;
+
+ /* now we still have untransmitted LLC data, so we fill mac block */
+ index = dir.dl.v_s & mod_sns_half;
+ data = m_rlc.blocks[index].prepare(block_data_len);
+
rh = (struct rlc_dl_header *)data;
rh->pt = 0; /* Data Block */
rh->rrbp = rh->s_p = 0; /* Polling, set later, if required */
@@ -988,9 +989,9 @@ do_resend:
rh->bsn = dir.dl.v_s; /* Block Sequence Number */
rh->e = 0; /* Extension bit, maybe set later */
e_pointer = data + 2; /* points to E of current chunk */
- data += 3;
+ data += sizeof(*rh);
delimiter = data; /* where next length header would be stored */
- space = block_data - 3;
+ space = block_data_len - sizeof(*rh);
while (1) {
chunk = m_llc.chunk_size();
/* if chunk will exceed block limit */
@@ -1107,6 +1108,7 @@ do_resend:
}
LOGP(DRLCMACDL, LOGL_DEBUG, "data block: %s\n",
osmo_hexdump(m_rlc.blocks[index].block, block_length));
+#warning "move this up?"
m_rlc.blocks[index].len = block_length;
/* raise send state and set ack state array */
dir.dl.v_b[index] = 'U'; /* unacked */
@@ -1152,6 +1154,7 @@ struct msgb *gprs_rlcmac_tbf::create_dl_acked_block(
LOGP(DRLCMAC, LOGL_DEBUG, "Polling cannot be "
"sheduled in this TS %d, waiting for "
"TS %d\n", ts, control_ts);
+#warning "What happens to the first_fin_ack in case something is already scheduled?"
else if (bts->sba()->find(trx->trx_no, ts, (fn + 13) % 2715648))
LOGP(DRLCMAC, LOGL_DEBUG, "Polling cannot be "
"sheduled, because single block alllocation "