aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-24 14:35:14 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-28 12:23:07 +0200
commit60f77033ad15da909cdbc0682c781151a23c170c (patch)
tree09aacd91770c3cae04e159f89a7388d77bbf91b0
parente77d49f2a2c20202dbdc5386c7dfeed4e773a077 (diff)
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
-rw-r--r--src/bts.cpp35
-rw-r--r--src/bts.h2
-rw-r--r--tests/tbf/TbfTest.err4
3 files changed, 41 insertions, 0 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 6248348..0786e73 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);
diff --git a/src/bts.h b/src/bts.h
index e0f09b9..3dfe3f3 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -244,6 +244,7 @@ public:
/** TODO: change the number to unsigned */
void set_current_frame_number(int frame_number);
+ void set_current_block_frame_number(int frame_number);
int current_frame_number() const;
/** add paging to paging queue(s) */
@@ -301,6 +302,7 @@ public:
private:
int m_cur_fn;
+ int m_cur_blk_fn;
struct gprs_rlcmac_bts m_bts;
PollController m_pollController;
SBAController m_sba;
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index e49dd43..082b64d 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -1637,6 +1637,10 @@ TX: Immediate Assignment Uplink (AGCH)
Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 73 8c f6 07 00 c0 0c 68 ab 2b 2b 2b 2b 2b 2b 2b
Searching for first unallocated TFI: TRX=0
Found TFI=1.
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=FINISHED) poll timeout for FN=2654292 (curr FN 2654335)
+- Timeout for polling PACKET DOWNLINK ACK.
+- Assignment was on PACCH
+- No downlink ACK received yet
+++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++
------------------------- RX : Uplink Control Block -------------------------
MS requests UL TBF in packet resource request of single block, so we provide one: