From 60f77033ad15da909cdbc0682c781151a23c170c Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 24 Aug 2015 14:35:14 +0200 Subject: poll: Use the data_ind FN as time source for current frame The FN of the data_ind taken from the DSP are monotonic, so latency does not affect the detection of poll timeouts if these FN are used. If the FN is larger than a poll_fn value, it can safely be assumed that the poll response will not arrive later on. Currently a max_delay of 60 frames is used, which has the drawback that additional ~250ms will pass until a lost ACK is detected. Using the data_ind's FN alone breaks the poll timeout detection if there are no other MS sending data blocks. This commit adds BTS::set_current_block_frame_number that is called with the FN taken from data_ind messages. The max_delay is set to 0 which removes the additional delay, when this FN is used to detect poll timeouts. So the average additional delay decreases with the number of data_ind per time. The current_frame is updated unless it seems to have been updated already (assumed if 0 < cur_fn - block_fn < 500). Thus the time_ind has still priority to update the current_frame value. Sponsored-by: On-Waves ehf --- src/bts.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/bts.cpp') diff --git a/src/bts.cpp b/src/bts.cpp index 6248348f..0786e73c 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -103,6 +103,7 @@ struct rate_ctr_group *bts_main_data_stats() BTS::BTS() : m_cur_fn(0) + , m_cur_blk_fn(-1) , m_pollController(*this) , m_sba(*this) , m_ms_store(this) @@ -151,6 +152,38 @@ void BTS::set_current_frame_number(int fn) m_pollController.expireTimedout(m_cur_fn, max_delay); } +void BTS::set_current_block_frame_number(int fn) +{ + int delay = 0; + const int late_block_delay_thresh = 13; + const int fn_update_ok_min_delay = -500; + const int fn_update_ok_max_delay = 0; + + /* frame numbers in the received blocks are assumed to be strongly + * monotonic. */ + if (m_cur_blk_fn >= 0) { + int delta = (fn + 2715648 * 3 / 2 - m_cur_blk_fn) % 2715648 - 2715648/2; + if (delta <= 0) + return; + } + + /* Check block delay vs. the current frame number */ + if (current_frame_number() != 0) + delay = (fn + 2715648 * 3 / 2 - current_frame_number()) % 2715648 + - 2715648/2; + if (delay <= -late_block_delay_thresh) + LOGP(DRLCMAC, LOGL_NOTICE, + "Late RLC block, FN delta: %d FN: %d curFN: %d\n", + delay, fn, current_frame_number()); + + m_cur_blk_fn = fn; + if (delay < fn_update_ok_min_delay || delay > fn_update_ok_max_delay || + current_frame_number() == 0) + m_cur_fn = fn; + + m_pollController.expireTimedout(fn, 0); +} + int BTS::add_paging(uint8_t chan_needed, uint8_t *identity_lv) { uint8_t l, trx, ts, any_tbf = 0; @@ -1084,6 +1117,8 @@ int gprs_rlcmac_pdch::rcv_block(uint8_t *data, uint8_t len, uint32_t fn, bitvec *block; int rc = 0; + bts()->set_current_block_frame_number(fn); + switch (payload) { case GPRS_RLCMAC_DATA_BLOCK: rc = rcv_data_block_acknowledged(data, len, meas); -- cgit v1.2.3