aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-27 13:18:24 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-28 12:23:07 +0200
commitac49d0943a2a384ef99cce0933cac74d80563407 (patch)
tree21a064aeef6c371b95811c85ef20f129eb66af59
parent16d29c7da4ee516b4ef0a6ec18cec18f8a76d7fa (diff)
poll: Add a max_delay parameter to PollController::expireTimedout
Currently the maximum additional delay is hard coded to 13. This value depends on the source of the frame number value. This commit adds the max_delay parameter to make it caller dependant. Sponsored-by: On-Waves ehf
-rw-r--r--src/bts.cpp10
-rw-r--r--src/poll_controller.cpp15
-rw-r--r--src/poll_controller.h3
3 files changed, 15 insertions, 13 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 141431a..661c511 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -136,8 +136,16 @@ BTS::~BTS()
void BTS::set_current_frame_number(int fn)
{
+ /* The UL frame numbers lag 3 behind the DL frames and the data
+ * indication is only sent after all 4 frames of the block have been
+ * received. Sometimes there is an idle frame between the end of one
+ * and start of another frame (every 3 blocks). So the timeout should
+ * definitely be there if we're more than 8 frames past poll_fn. Let's
+ * stay on the safe side and say 13 or more. */
+ const static int max_delay = 13;
+
m_cur_fn = fn;
- m_pollController.expireTimedout(m_cur_fn);
+ m_pollController.expireTimedout(m_cur_fn, max_delay);
}
int BTS::add_paging(uint8_t chan_needed, uint8_t *identity_lv)
diff --git a/src/poll_controller.cpp b/src/poll_controller.cpp
index 0bf616e..8108f74 100644
--- a/src/poll_controller.cpp
+++ b/src/poll_controller.cpp
@@ -28,7 +28,7 @@ PollController::PollController(BTS& bts)
: m_bts(bts)
{}
-void PollController::expireTimedout(int frame_number)
+void PollController::expireTimedout(int frame_number, unsigned max_delay)
{
struct gprs_rlcmac_bts *bts = m_bts.bts_data();
struct gprs_rlcmac_dl_tbf *dl_tbf;
@@ -37,18 +37,11 @@ void PollController::expireTimedout(int frame_number)
struct llist_pods *lpods;
uint32_t elapsed;
- /* check for poll timeout
- * The UL frame numbers lag 3 behind the DL frames and the data
- * indication is only sent after all 4 frames of the block have been
- * received. Sometimes there is an idle frame between the end of one
- * and start of another frame (every 3 blocks). So the timeout should
- * definitely be there if we're more than 8 frames past poll_fn. Let's
- * stay on the safe side and say 13 or more. */
llist_pods_for_each_entry(ul_tbf, &bts->ul_tbfs, list, lpods) {
if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
elapsed = (frame_number + 2715648 - ul_tbf->poll_fn)
% 2715648;
- if (elapsed >= 13 && elapsed < 2715400)
+ if (elapsed > max_delay && elapsed < 2715400)
ul_tbf->poll_timeout();
}
}
@@ -56,13 +49,13 @@ void PollController::expireTimedout(int frame_number)
if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
elapsed = (frame_number + 2715648 - dl_tbf->poll_fn)
% 2715648;
- if (elapsed >= 13 && elapsed < 2715400)
+ if (elapsed > max_delay && elapsed < 2715400)
dl_tbf->poll_timeout();
}
}
llist_for_each_entry_safe(sba, sba2, &m_bts.sba()->m_sbas, list) {
elapsed = (frame_number + 2715648 - sba->fn) % 2715648;
- if (elapsed >= 13 && elapsed < 2715400) {
+ if (elapsed > max_delay && elapsed < 2715400) {
/* sba will be freed here */
m_bts.sba()->timeout(sba);
}
diff --git a/src/poll_controller.h b/src/poll_controller.h
index dac3e6d..b9ae80e 100644
--- a/src/poll_controller.h
+++ b/src/poll_controller.h
@@ -34,7 +34,8 @@ class PollController {
public:
PollController(BTS& bts);
- void expireTimedout(int frame_number);
+ /* check for poll timeout */
+ void expireTimedout(int frame_number, unsigned max_delay);
private:
BTS& m_bts;