Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 1 | /* Paging helper and manager.... */ |
| 2 | /* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | * Relevant specs: |
| 23 | * 12.21: |
| 24 | * - 9.4.12 for CCCH Local Threshold |
| 25 | * |
| 26 | * 05.58: |
| 27 | * - 8.5.2 CCCH Load indication |
| 28 | * - 9.3.15 Paging Load |
| 29 | * |
| 30 | * Approach: |
| 31 | * - Send paging command to subscriber |
| 32 | * - On Channel Request we will remember the reason |
| 33 | * - After the ACK we will request the identity |
| 34 | * - Then we will send assign the gsm_subscriber and |
| 35 | * - and call a callback |
| 36 | */ |
| 37 | |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 38 | #include <stdio.h> |
| 39 | #include <stdlib.h> |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 40 | #include <assert.h> |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 41 | |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 42 | #include <openbsc/paging.h> |
Harald Welte | 2cf161b | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 43 | #include <openbsc/talloc.h> |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 44 | #include <openbsc/debug.h> |
Holger Freyther | 4af2b48 | 2009-02-14 22:51:03 +0000 | [diff] [blame] | 45 | #include <openbsc/signal.h> |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 46 | #include <openbsc/abis_rsl.h> |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 47 | #include <openbsc/gsm_data.h> |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 48 | |
Holger Freyther | d4ec528 | 2009-02-03 23:18:46 +0000 | [diff] [blame] | 49 | #define PAGING_TIMEOUT 1, 75000 |
Holger Freyther | df892da | 2009-02-03 21:05:49 +0000 | [diff] [blame] | 50 | #define MAX_PAGING_REQUEST 750 |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 51 | |
Harald Welte | 2cf161b | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 52 | static void *tall_paging_ctx; |
| 53 | |
Holger Freyther | 3aa8d6c | 2009-02-04 02:14:45 +0000 | [diff] [blame] | 54 | static unsigned int calculate_group(struct gsm_bts *bts, struct gsm_subscriber *subscr) |
| 55 | { |
| 56 | int ccch_conf; |
| 57 | int bs_cc_chans; |
| 58 | int blocks; |
| 59 | unsigned int group; |
| 60 | |
| 61 | ccch_conf = bts->chan_desc.ccch_conf; |
| 62 | bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf); |
| 63 | /* code word + 2, as 2 channels equals 0x0 */ |
Holger Freyther | 152a147 | 2009-02-04 13:38:26 +0000 | [diff] [blame] | 64 | blocks = rsl_number_of_paging_subchannels(bts); |
Holger Freyther | 3aa8d6c | 2009-02-04 02:14:45 +0000 | [diff] [blame] | 65 | group = get_paging_group(str_to_imsi(subscr->imsi), |
| 66 | bs_cc_chans, blocks); |
| 67 | return group; |
| 68 | } |
| 69 | |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 70 | /* |
| 71 | * Kill one paging request update the internal list... |
| 72 | */ |
Holger Freyther | 1fd3414 | 2009-02-09 23:42:03 +0000 | [diff] [blame] | 73 | static void paging_remove_request(struct gsm_bts_paging_state *paging_bts, |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 74 | struct gsm_paging_request *to_be_deleted) |
Holger Freyther | 3d94924 | 2009-02-06 18:08:18 +0000 | [diff] [blame] | 75 | { |
| 76 | /* Update the last_request if that is necessary */ |
| 77 | if (to_be_deleted == paging_bts->last_request) { |
| 78 | paging_bts->last_request = |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 79 | (struct gsm_paging_request *)paging_bts->last_request->entry.next; |
Holger Freyther | 3d94924 | 2009-02-06 18:08:18 +0000 | [diff] [blame] | 80 | if (&to_be_deleted->entry == &paging_bts->pending_requests) |
| 81 | paging_bts->last_request = NULL; |
| 82 | } |
| 83 | |
Harald Welte | ff117a8 | 2009-05-23 05:22:08 +0000 | [diff] [blame] | 84 | bsc_del_timer(&to_be_deleted->T3113); |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 85 | llist_del(&to_be_deleted->entry); |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 86 | subscr_put(to_be_deleted->subscr); |
Harald Welte | 2cf161b | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 87 | talloc_free(to_be_deleted); |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 88 | } |
| 89 | |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 90 | static void page_ms(struct gsm_paging_request *request) |
| 91 | { |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 92 | u_int8_t mi[128]; |
| 93 | unsigned long int tmsi; |
| 94 | unsigned int mi_len; |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 95 | unsigned int page_group; |
| 96 | |
| 97 | DEBUGP(DPAG, "Going to send paging commands: '%s'\n", |
| 98 | request->subscr->imsi); |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 99 | |
| 100 | page_group = calculate_group(request->bts, request->subscr); |
| 101 | tmsi = strtoul(request->subscr->tmsi, NULL, 10); |
| 102 | mi_len = generate_mid_from_tmsi(mi, tmsi); |
| 103 | rsl_paging_cmd(request->bts, page_group, mi_len, mi, |
| 104 | request->chan_type); |
| 105 | } |
| 106 | |
Holger Freyther | 334f236 | 2009-02-11 03:00:20 +0000 | [diff] [blame] | 107 | static void paging_move_to_next(struct gsm_bts_paging_state *paging_bts) |
| 108 | { |
| 109 | paging_bts->last_request = |
| 110 | (struct gsm_paging_request *)paging_bts->last_request->entry.next; |
| 111 | if (&paging_bts->last_request->entry == &paging_bts->pending_requests) |
| 112 | paging_bts->last_request = NULL; |
| 113 | } |
| 114 | |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 115 | /* |
| 116 | * This is kicked by the periodic PAGING LOAD Indicator |
| 117 | * coming from abis_rsl.c |
| 118 | * |
| 119 | * We attempt to iterate once over the list of items but |
| 120 | * only upto available_slots. |
| 121 | */ |
Holger Freyther | b1ffbb6 | 2009-02-11 01:49:15 +0000 | [diff] [blame] | 122 | static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_bts) |
| 123 | { |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 124 | struct gsm_paging_request *initial_request = NULL; |
| 125 | struct gsm_paging_request *current_request = NULL; |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 126 | |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 127 | /* |
| 128 | * Determine if the pending_requests list is empty and |
| 129 | * return then. |
| 130 | */ |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 131 | if (llist_empty(&paging_bts->pending_requests)) { |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 132 | paging_bts->last_request = NULL; |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 133 | /* since the list is empty, no need to reschedule the timer */ |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 134 | return; |
| 135 | } |
| 136 | |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 137 | if (!paging_bts->last_request) |
Holger Freyther | 531c0de | 2009-02-14 23:35:09 +0000 | [diff] [blame] | 138 | paging_bts->last_request = |
| 139 | (struct gsm_paging_request *)paging_bts->pending_requests.next; |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 140 | |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 141 | assert(paging_bts->last_request); |
| 142 | initial_request = paging_bts->last_request; |
| 143 | current_request = initial_request; |
| 144 | |
| 145 | do { |
| 146 | /* handle the paging request now */ |
| 147 | page_ms(current_request); |
| 148 | paging_bts->available_slots--; |
| 149 | |
| 150 | /* |
| 151 | * move to the next item. We might wrap around |
| 152 | * this means last_request will be NULL and we just |
| 153 | * call paging_page_to_next again. It it guranteed |
| 154 | * that the list is not empty. |
| 155 | */ |
| 156 | paging_move_to_next(paging_bts); |
| 157 | if (!paging_bts->last_request) |
Holger Freyther | 531c0de | 2009-02-14 23:35:09 +0000 | [diff] [blame] | 158 | paging_bts->last_request = |
| 159 | (struct gsm_paging_request *)paging_bts->pending_requests.next; |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 160 | current_request = paging_bts->last_request; |
| 161 | } while (paging_bts->available_slots > 0 |
| 162 | && initial_request != current_request); |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 163 | |
Harald Welte | ff117a8 | 2009-05-23 05:22:08 +0000 | [diff] [blame] | 164 | bsc_schedule_timer(&paging_bts->work_timer, 1, 0); |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | static void paging_worker(void *data) |
| 168 | { |
| 169 | struct gsm_bts_paging_state *paging_bts = data; |
| 170 | |
| 171 | paging_handle_pending_requests(paging_bts); |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 172 | } |
| 173 | |
Holger Freyther | 1fd3414 | 2009-02-09 23:42:03 +0000 | [diff] [blame] | 174 | void paging_init(struct gsm_bts *bts) |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 175 | { |
| 176 | bts->paging.bts = bts; |
| 177 | INIT_LLIST_HEAD(&bts->paging.pending_requests); |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 178 | bts->paging.work_timer.cb = paging_worker; |
| 179 | bts->paging.work_timer.data = &bts->paging; |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 180 | |
| 181 | /* Large number, until we get a proper message */ |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 182 | bts->paging.available_slots = 100; |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 183 | } |
| 184 | |
Holger Freyther | 1fd3414 | 2009-02-09 23:42:03 +0000 | [diff] [blame] | 185 | static int paging_pending_request(struct gsm_bts_paging_state *bts, |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 186 | struct gsm_subscriber *subscr) { |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 187 | struct gsm_paging_request *req; |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 188 | |
| 189 | llist_for_each_entry(req, &bts->pending_requests, entry) { |
| 190 | if (subscr == req->subscr) |
| 191 | return 1; |
| 192 | } |
| 193 | |
| 194 | return 0; |
| 195 | } |
| 196 | |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 197 | static void paging_T3113_expired(void *data) |
| 198 | { |
Holger Freyther | 83e44b0 | 2009-02-14 18:04:59 +0000 | [diff] [blame] | 199 | struct gsm_paging_request *req = (struct gsm_paging_request *)data; |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 200 | struct paging_signal_data sig_data; |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 201 | |
| 202 | DEBUGP(DPAG, "T3113 expired for request %p (%s)\n", |
| 203 | req, req->subscr->imsi); |
| 204 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 205 | sig_data.subscr = req->subscr, |
| 206 | sig_data.bts = req->bts, |
| 207 | sig_data.lchan = NULL, |
Holger Freyther | 4af2b48 | 2009-02-14 22:51:03 +0000 | [diff] [blame] | 208 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 209 | dispatch_signal(SS_PAGING, S_PAGING_COMPLETED, &sig_data); |
Harald Welte | 09e38af | 2009-02-16 22:52:23 +0000 | [diff] [blame] | 210 | if (req->cbfn) |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 211 | req->cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_EXPIRED, NULL, NULL, |
Harald Welte | 09e38af | 2009-02-16 22:52:23 +0000 | [diff] [blame] | 212 | req->cbfn_param); |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 213 | paging_remove_request(&req->bts->paging, req); |
| 214 | } |
| 215 | |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 216 | static void _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, |
| 217 | int type, gsm_cbfn *cbfn, void *data) |
Harald Welte | 09e38af | 2009-02-16 22:52:23 +0000 | [diff] [blame] | 218 | { |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 219 | struct gsm_bts_paging_state *bts_entry = &bts->paging; |
| 220 | struct gsm_paging_request *req; |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 221 | |
Holger Freyther | 49314f6 | 2009-02-14 23:53:20 +0000 | [diff] [blame] | 222 | if (paging_pending_request(bts_entry, subscr)) { |
| 223 | DEBUGP(DPAG, "Paging request already pending\n"); |
| 224 | return; |
| 225 | } |
| 226 | |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 227 | DEBUGP(DPAG, "Start paging on bts %d.\n", bts->nr); |
Harald Welte | 470ec29 | 2009-06-26 20:25:23 +0200 | [diff] [blame] | 228 | req = talloc_zero(tall_paging_ctx, struct gsm_paging_request); |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 229 | req->subscr = subscr_get(subscr); |
| 230 | req->bts = bts; |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 231 | req->chan_type = type; |
Harald Welte | 09e38af | 2009-02-16 22:52:23 +0000 | [diff] [blame] | 232 | req->cbfn = cbfn; |
| 233 | req->cbfn_param = data; |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 234 | req->T3113.cb = paging_T3113_expired; |
| 235 | req->T3113.data = req; |
Harald Welte | ff117a8 | 2009-05-23 05:22:08 +0000 | [diff] [blame] | 236 | bsc_schedule_timer(&req->T3113, T3113_VALUE); |
Holger Freyther | 49314f6 | 2009-02-14 23:53:20 +0000 | [diff] [blame] | 237 | llist_add_tail(&req->entry, &bts_entry->pending_requests); |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 238 | |
Harald Welte | ff117a8 | 2009-05-23 05:22:08 +0000 | [diff] [blame] | 239 | if (!bsc_timer_pending(&bts_entry->work_timer)) |
| 240 | bsc_schedule_timer(&bts_entry->work_timer, 1, 0); |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 241 | } |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 242 | |
Holger Freyther | 04866d4 | 2009-03-31 04:35:19 +0200 | [diff] [blame] | 243 | void paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 244 | int type, gsm_cbfn *cbfn, void *data) |
| 245 | { |
| 246 | struct gsm_bts *bts = NULL; |
| 247 | |
Harald Welte | a1b2858 | 2009-08-01 19:31:47 +0200 | [diff] [blame] | 248 | /* start paging subscriber on all BTS within Location Area */ |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 249 | do { |
Holger Freyther | 04866d4 | 2009-03-31 04:35:19 +0200 | [diff] [blame] | 250 | bts = gsm_bts_by_lac(network, subscr->lac, bts); |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 251 | if (!bts) |
| 252 | break; |
| 253 | |
| 254 | /* Trigger paging */ |
| 255 | _paging_request(bts, subscr, RSL_CHANNEED_TCH_F, cbfn, data); |
| 256 | } while (1); |
| 257 | } |
| 258 | |
| 259 | |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 260 | /* we consciously ignore the type of the request here */ |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 261 | static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, |
| 262 | struct gsm_lchan *lchan) |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 263 | { |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 264 | struct gsm_bts_paging_state *bts_entry = &bts->paging; |
| 265 | struct gsm_paging_request *req, *req2; |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 266 | |
| 267 | llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests, |
| 268 | entry) { |
Holger Freyther | 3d94924 | 2009-02-06 18:08:18 +0000 | [diff] [blame] | 269 | if (req->subscr == subscr) { |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 270 | if (lchan && req->cbfn) { |
| 271 | DEBUGP(DPAG, "Stop paging on bts %d, calling cbfn.\n", bts->nr); |
Harald Welte | 09e38af | 2009-02-16 22:52:23 +0000 | [diff] [blame] | 272 | req->cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_SUCCEEDED, |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 273 | NULL, lchan, req->cbfn_param); |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 274 | } else |
| 275 | DEBUGP(DPAG, "Stop paging on bts %d silently.\n", bts->nr); |
Holger Freyther | 1fd3414 | 2009-02-09 23:42:03 +0000 | [diff] [blame] | 276 | paging_remove_request(&bts->paging, req); |
Holger Freyther | 3d94924 | 2009-02-06 18:08:18 +0000 | [diff] [blame] | 277 | break; |
| 278 | } |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 279 | } |
| 280 | } |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 281 | |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 282 | /* Stop paging on all other bts' */ |
| 283 | void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr, |
| 284 | struct gsm_lchan *lchan) |
| 285 | { |
| 286 | struct gsm_bts *bts = NULL; |
| 287 | |
Holger Hans Peter Freyther | fdac4cc | 2009-06-10 11:46:58 +0200 | [diff] [blame] | 288 | _paging_request_stop(_bts, subscr, lchan); |
| 289 | |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 290 | do { |
| 291 | /* |
| 292 | * FIXME: Don't use the lac of the subscriber... |
| 293 | * as it might have magically changed the lac.. use the |
| 294 | * location area of the _bts as reconfiguration of the |
| 295 | * network is probably happening less often. |
| 296 | */ |
| 297 | bts = gsm_bts_by_lac(_bts->network, subscr->lac, bts); |
| 298 | if (!bts) |
| 299 | break; |
| 300 | |
| 301 | /* Stop paging */ |
Holger Hans Peter Freyther | fdac4cc | 2009-06-10 11:46:58 +0200 | [diff] [blame] | 302 | if (bts != _bts) |
| 303 | _paging_request_stop(bts, subscr, NULL); |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 304 | } while (1); |
| 305 | } |
| 306 | |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 307 | void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots) |
| 308 | { |
| 309 | bts->paging.available_slots = free_slots; |
| 310 | } |
Harald Welte | 7bfc267 | 2009-07-28 00:41:45 +0200 | [diff] [blame] | 311 | |
| 312 | static __attribute__((constructor)) void on_dso_load_paging(void) |
| 313 | { |
| 314 | tall_paging_ctx = talloc_named_const(NULL, 1, "paging_request"); |
| 315 | } |