aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-24 00:18:47 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-26 20:57:19 +0100
commit15777795268ac0d0b53453afe80ce6d8e68f9a55 (patch)
tree84b531ae91e5aa45454a73478e19f36d21f8b7ae /src/tbf.cpp
parentef93bdb19b8ff93ef1ed6e858029df44da82982e (diff)
rlc/tbf: Move the loop into the gprs_rlc_v_b class
Diffstat (limited to 'src/tbf.cpp')
-rw-r--r--src/tbf.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 54eb3cb6..747678c6 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -880,8 +880,8 @@ struct msgb *gprs_rlcmac_tbf::create_dl_acked_block(uint32_t fn, uint8_t ts)
struct rlc_li_field *li;
struct msgb *msg;
uint8_t bsn;
- uint16_t mod_sns = m_sns - 1;
- uint16_t mod_sns_half = (m_sns >> 1) - 1;
+ 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;
@@ -892,17 +892,16 @@ struct msgb *gprs_rlcmac_tbf::create_dl_acked_block(uint32_t fn, uint8_t ts)
do_resend:
/* check if there is a block with negative acknowledgement */
- for (bsn = dir.dl.v_a; bsn != dir.dl.v_s;
- bsn = (bsn + 1) & mod_sns) {
- index = (bsn & mod_sns_half);
- if (dir.dl.v_b.is_nacked(index) || dir.dl.v_b.is_resend(index)) {
- LOGP(DRLCMACDL, LOGL_DEBUG, "- Resending BSN %d\n",
- bsn);
- /* 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);
- }
+ int resend_bsn = dir.dl.v_b.resend_needed(dir.dl.v_a, dir.dl.v_s,
+ mod_sns, mod_sns_half);
+ if (resend_bsn >= 0) {
+ LOGP(DRLCMACDL, LOGL_DEBUG, "- Resending BSN %d\n", resend_bsn);
+
+ uint16_t index = resend_bsn & mod_sns_half;
+ /* 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);
}
/* if the window has stalled, or transfer is complete,