Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 1 | /* 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> |
Holger Hans Peter Freyther | 34bd8bd | 2013-10-19 21:10:38 +0200 | [diff] [blame] | 24 | #include <bts.h> |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 25 | #include <tbf.h> |
| 26 | |
| 27 | PollController::PollController(BTS& bts) |
| 28 | : m_bts(bts) |
| 29 | {} |
| 30 | |
Jacob Erlbeck | ac49d09 | 2015-08-27 13:18:24 +0200 | [diff] [blame] | 31 | void PollController::expireTimedout(int frame_number, unsigned max_delay) |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 32 | { |
| 33 | struct gprs_rlcmac_bts *bts = m_bts.bts_data(); |
Daniel Willmann | 93d1711 | 2014-08-07 13:05:43 +0200 | [diff] [blame] | 34 | struct gprs_rlcmac_dl_tbf *dl_tbf; |
| 35 | struct gprs_rlcmac_ul_tbf *ul_tbf; |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 36 | struct gprs_rlcmac_sba *sba, *sba2; |
Daniel Willmann | 1b3864f | 2014-07-30 13:25:19 +0200 | [diff] [blame] | 37 | struct llist_pods *lpods; |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 38 | uint32_t elapsed; |
| 39 | |
Daniel Willmann | 93d1711 | 2014-08-07 13:05:43 +0200 | [diff] [blame] | 40 | llist_pods_for_each_entry(ul_tbf, &bts->ul_tbfs, list, lpods) { |
| 41 | if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) { |
| 42 | elapsed = (frame_number + 2715648 - ul_tbf->poll_fn) |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 43 | % 2715648; |
Jacob Erlbeck | ac49d09 | 2015-08-27 13:18:24 +0200 | [diff] [blame] | 44 | if (elapsed > max_delay && elapsed < 2715400) |
Daniel Willmann | 93d1711 | 2014-08-07 13:05:43 +0200 | [diff] [blame] | 45 | ul_tbf->poll_timeout(); |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 46 | } |
| 47 | } |
Daniel Willmann | 93d1711 | 2014-08-07 13:05:43 +0200 | [diff] [blame] | 48 | llist_pods_for_each_entry(dl_tbf, &bts->dl_tbfs, list, lpods) { |
| 49 | if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) { |
| 50 | elapsed = (frame_number + 2715648 - dl_tbf->poll_fn) |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 51 | % 2715648; |
Jacob Erlbeck | ac49d09 | 2015-08-27 13:18:24 +0200 | [diff] [blame] | 52 | if (elapsed > max_delay && elapsed < 2715400) |
Daniel Willmann | 93d1711 | 2014-08-07 13:05:43 +0200 | [diff] [blame] | 53 | dl_tbf->poll_timeout(); |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 54 | } |
| 55 | } |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 56 | llist_for_each_entry_safe(sba, sba2, &m_bts.sba()->m_sbas, list) { |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 57 | elapsed = (frame_number + 2715648 - sba->fn) % 2715648; |
Jacob Erlbeck | ac49d09 | 2015-08-27 13:18:24 +0200 | [diff] [blame] | 58 | if (elapsed > max_delay && elapsed < 2715400) { |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 59 | /* sba will be freed here */ |
Holger Hans Peter Freyther | cedf890 | 2013-10-19 20:47:12 +0200 | [diff] [blame] | 60 | m_bts.sba()->timeout(sba); |
Holger Hans Peter Freyther | b78adcd | 2013-10-17 20:12:37 +0200 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | |
| 64 | } |