aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-24 00:44:21 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-26 20:57:24 +0100
commita6ba67cb3a8696cbb251ba32c5b8daa877cd2b04 (patch)
tree279b24afe30b1f166a58f7c72a3dd3eea7669289
parent8b16ae30fe0d6353ac7d39a2884f6716ff3efc5f (diff)
tbf: Simplify the create_dl_acked_block into two parts
Separate the resend from creating a new block. It shows that the first_fin_ack is always set to FALSE for re-sending. This might not be what we want.
-rw-r--r--src/tbf.cpp34
-rw-r--r--src/tbf.h1
2 files changed, 22 insertions, 13 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 3dc4146..5e1cee0 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -876,16 +876,8 @@ int gprs_rlcmac_tbf::assemble_forward_llc(const gprs_rlc_data *_data)
*/
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;
- struct msgb *msg;
- uint8_t bsn;
const uint16_t mod_sns = m_sns - 1;
const uint16_t mod_sns_half = (m_sns >> 1) - 1;
- uint16_t index;
- uint8_t *delimiter, *data, *e_pointer;
- uint16_t space, chunk;
- bool first_fin_ack = false;
LOGP(DRLCMACDL, LOGL_DEBUG, "%s downlink (V(A)==%d .. "
"V(S)==%d)\n", tbf_name(this), dir.dl.v_a, dir.dl.v_s);
@@ -901,7 +893,7 @@ do_resend:
/* re-send block with negative aknowlegement */
dir.dl.v_b.mark_unacked(index);
bts->rlc_resent();
- return create_dl_acked_block(fn, ts, index, first_fin_ack);
+ return create_dl_acked_block(fn, ts, index, false);
}
/* if the window has stalled, or transfer is complete,
@@ -928,9 +920,9 @@ do_resend:
LOGP(DRLCMACDL, LOGL_DEBUG, "- MS acked all blocks, "
"so we re-transmit final block!\n");
/* we just send final block again */
- index = ((dir.dl.v_s - 1) & mod_sns_half);
+ int16_t index = (dir.dl.v_s - 1) & mod_sns_half;
bts->rlc_resent();
- return create_dl_acked_block(fn, ts, index, first_fin_ack);
+ return create_dl_acked_block(fn, ts, index, false);
}
/* cycle through all unacked blocks */
@@ -944,13 +936,29 @@ do_resend:
"There are no unacknowledged blocks, but V(A) "
" != V(S). PLEASE FIX!\n");
/* we just send final block again */
- index = ((dir.dl.v_s - 1) & mod_sns_half);
+ int16_t index = (dir.dl.v_s - 1) & mod_sns_half;
bts->rlc_resent();
- return create_dl_acked_block(fn, ts, index, first_fin_ack);
+ return create_dl_acked_block(fn, ts, index, false);
}
goto do_resend;
}
+ return create_new_bsn(fn, ts);
+}
+
+struct msgb *gprs_rlcmac_tbf::create_new_bsn(const uint32_t fn, const uint8_t ts)
+{
+ struct rlc_dl_header *rh;
+ struct rlc_li_field *li;
+ struct msgb *msg;
+ uint16_t index;
+ uint8_t *delimiter, *data, *e_pointer;
+ uint16_t space, chunk;
+ bool first_fin_ack = false;
+
+ const uint16_t mod_sns = m_sns - 1;
+ const uint16_t mod_sns_half = (m_sns >> 1) - 1;
+
LOGP(DRLCMACDL, LOGL_DEBUG, "- Sending new block at BSN %d\n",
dir.dl.v_s);
diff --git a/src/tbf.h b/src/tbf.h
index 1250b40..39e2507 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -249,6 +249,7 @@ protected:
struct msgb *create_dl_acked_block(const uint32_t fn, const uint8_t ts,
const int index, const bool fin_first_ack);
+ struct msgb *create_new_bsn(const uint32_t fn, const uint8_t ts);
};