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
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 55dade7..c9ad058 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -469,11 +469,6 @@
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 @@
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);
+}