aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/tbf.h6
-rw-r--r--src/tbf_dl.cpp24
2 files changed, 25 insertions, 5 deletions
diff --git a/src/tbf.h b/src/tbf.h
index 8a2da96..ba7af36 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -323,6 +323,12 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
int rcvd_dl_ack(uint8_t final, uint8_t ssn, uint8_t *rbb);
struct msgb *create_dl_acked_block(uint32_t fn, uint8_t ts);
void request_dl_ack();
+ bool need_control_ts() const;
+ bool have_data() const;
+
+ bool is_control_ts(uint8_t ts) const {
+ return ts == control_ts;
+ }
/* TODO: add the gettimeofday as parameter */
struct msgb *llc_dequeue(bssgp_bvc_ctx *bctx);
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 @@ 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);
+}