aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf_dl.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-20 14:41:50 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-25 12:10:45 +0100
commiteceb910fef8b6ebfba5aa9b13ffbccfe322d9706 (patch)
treecec328c385d3a71da4c29e859a7b4ea7e7bc44e7 /src/tbf_dl.cpp
parent95340242ed1089e30b9a3045ea55bc9068432e0b (diff)
tbf: Add helper functions for DL TBFs
Some properties of a DL TBF are explicitly calculated within modules using DL TBFs. This commit introduces the methods need_control_ts(), have_data(), is_control_ts() to hide internals of the DL TBF implementation. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/tbf_dl.cpp')
-rw-r--r--src/tbf_dl.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 55dade70..c9ad058c 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -469,11 +469,6 @@ struct msgb *gprs_rlcmac_dl_tbf::create_new_bsn(const uint32_t fn, const uint8_t
return create_dl_acked_block(fn, ts, bsn);
}
-void gprs_rlcmac_dl_tbf::request_dl_ack()
-{
- m_dl_ack_requested = true;
-}
-
struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
const uint32_t fn, const uint8_t ts,
const int index)
@@ -716,3 +711,22 @@ bool gprs_rlcmac_dl_tbf::dl_window_stalled() const
return m_window.window_stalled();
}
+void gprs_rlcmac_dl_tbf::request_dl_ack()
+{
+ m_dl_ack_requested = true;
+}
+
+bool gprs_rlcmac_dl_tbf::need_control_ts() const
+{
+ if (poll_state != GPRS_RLCMAC_POLL_NONE)
+ return false;
+
+ return state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK) ||
+ m_tx_counter >= POLL_ACK_AFTER_FRAMES ||
+ m_dl_ack_requested;
+}
+
+bool gprs_rlcmac_dl_tbf::have_data() const
+{
+ return m_llc.chunk_size() > 0 || !llist_empty(&m_llc.queue);
+}