blob: 59eef762d810582ddaaee4ba266ee90182f67048 [file] [log] [blame]
Holger Hans Peter Freytherb78adcd2013-10-17 20:12:37 +02001/* poll_controller.h
2 *
3 * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu>
4 * Copyright (C) 2013 by Holger Hans Peter Freyther
5 *
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include <poll_controller.h>
24#include <tbf.h>
25
26PollController::PollController(BTS& bts)
27 : m_bts(bts)
28{}
29
30void PollController::expireTimedout(int frame_number)
31{
32 struct gprs_rlcmac_bts *bts = m_bts.bts_data();
33 struct gprs_rlcmac_tbf *tbf;
34 struct gprs_rlcmac_sba *sba, *sba2;
35 uint32_t elapsed;
36
37 /* check for poll timeout */
38 llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) {
39 if (tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
40 elapsed = (frame_number + 2715648 - tbf->poll_fn)
41 % 2715648;
42 if (elapsed >= 20 && elapsed < 2715400)
43 gprs_rlcmac_poll_timeout(bts, tbf);
44 }
45 }
46 llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) {
47 if (tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
48 elapsed = (frame_number + 2715648 - tbf->poll_fn)
49 % 2715648;
50 if (elapsed >= 20 && elapsed < 2715400)
51 gprs_rlcmac_poll_timeout(bts, tbf);
52 }
53 }
54 llist_for_each_entry_safe(sba, sba2, &gprs_rlcmac_sbas, list) {
55 elapsed = (frame_number + 2715648 - sba->fn) % 2715648;
56 if (elapsed >= 20 && elapsed < 2715400) {
57 /* sba will be freed here */
58 gprs_rlcmac_sba_timeout(sba);
59 }
60 }
61
62}