Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [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 | |
| 38 | #include <stdio.h> |
| 39 | #include <stdlib.h> |
| 40 | #include <assert.h> |
| 41 | |
| 42 | #include <openbsc/paging.h> |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 43 | #include <osmocore/talloc.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 44 | #include <openbsc/debug.h> |
| 45 | #include <openbsc/signal.h> |
| 46 | #include <openbsc/abis_rsl.h> |
| 47 | #include <openbsc/gsm_data.h> |
Holger Hans Peter Freyther | 8ecec25 | 2010-04-10 00:06:17 +0200 | [diff] [blame] | 48 | #include <openbsc/chan_alloc.h> |
Holger Hans Peter Freyther | 710157a | 2010-06-17 16:43:24 +0800 | [diff] [blame] | 49 | #include <openbsc/bsc_api.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 50 | |
Harald Welte (local) | 8751ee9 | 2009-08-15 02:30:58 +0200 | [diff] [blame] | 51 | void *tall_paging_ctx; |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 52 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 53 | static unsigned int calculate_group(struct gsm_bts *bts, struct gsm_subscriber *subscr) |
| 54 | { |
| 55 | int ccch_conf; |
| 56 | int bs_cc_chans; |
| 57 | int blocks; |
| 58 | unsigned int group; |
| 59 | |
Harald Welte | a54a2bb | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 60 | ccch_conf = bts->si_common.chan_desc.ccch_conf; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 61 | bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf); |
| 62 | /* code word + 2, as 2 channels equals 0x0 */ |
| 63 | blocks = rsl_number_of_paging_subchannels(bts); |
| 64 | group = get_paging_group(str_to_imsi(subscr->imsi), |
| 65 | bs_cc_chans, blocks); |
| 66 | return group; |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | * Kill one paging request update the internal list... |
| 71 | */ |
| 72 | static void paging_remove_request(struct gsm_bts_paging_state *paging_bts, |
| 73 | struct gsm_paging_request *to_be_deleted) |
| 74 | { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 75 | bsc_del_timer(&to_be_deleted->T3113); |
| 76 | llist_del(&to_be_deleted->entry); |
| 77 | subscr_put(to_be_deleted->subscr); |
Harald Welte | a837977 | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 78 | talloc_free(to_be_deleted); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | static void page_ms(struct gsm_paging_request *request) |
| 82 | { |
| 83 | u_int8_t mi[128]; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 84 | unsigned int mi_len; |
| 85 | unsigned int page_group; |
| 86 | |
Holger Hans Peter Freyther | b6a3394 | 2010-04-09 22:02:39 +0200 | [diff] [blame] | 87 | LOGP(DPAG, LOGL_INFO, "Going to send paging commands: imsi: '%s' tmsi: '0x%x'\n", |
Holger Hans Peter Freyther | 9b7911e | 2009-08-21 14:55:57 +0200 | [diff] [blame] | 88 | request->subscr->imsi, request->subscr->tmsi); |
| 89 | |
| 90 | if (request->subscr->tmsi == GSM_RESERVED_TMSI) |
| 91 | mi_len = gsm48_generate_mid_from_imsi(mi, request->subscr->imsi); |
| 92 | else |
| 93 | mi_len = gsm48_generate_mid_from_tmsi(mi, request->subscr->tmsi); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 94 | |
| 95 | page_group = calculate_group(request->bts, request->subscr); |
Holger Hans Peter Freyther | 897ad9a | 2010-06-16 14:10:45 +0800 | [diff] [blame] | 96 | gsm0808_page(request->bts, page_group, mi_len, mi, request->chan_type); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 97 | } |
| 98 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 99 | /* |
| 100 | * This is kicked by the periodic PAGING LOAD Indicator |
| 101 | * coming from abis_rsl.c |
| 102 | * |
| 103 | * We attempt to iterate once over the list of items but |
| 104 | * only upto available_slots. |
| 105 | */ |
| 106 | static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_bts) |
| 107 | { |
| 108 | struct gsm_paging_request *initial_request = NULL; |
| 109 | struct gsm_paging_request *current_request = NULL; |
| 110 | |
| 111 | /* |
| 112 | * Determine if the pending_requests list is empty and |
| 113 | * return then. |
| 114 | */ |
| 115 | if (llist_empty(&paging_bts->pending_requests)) { |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 116 | /* since the list is empty, no need to reschedule the timer */ |
| 117 | return; |
| 118 | } |
| 119 | |
Holger Hans Peter Freyther | 5fd943c | 2010-04-09 18:38:06 +0200 | [diff] [blame] | 120 | /* |
| 121 | * In case the BTS does not provide us with load indication just fill |
| 122 | * up our slots for this round. We should be able to page 20 subscribers |
| 123 | * every two seconds. So we will just give the BTS some extra credit. |
| 124 | * We will have to see how often we run out of this credit, so we might |
| 125 | * need a low watermark and then add credit or give 20 every run when |
| 126 | * the bts sets an option for that. |
| 127 | */ |
| 128 | if (paging_bts->available_slots == 0) { |
| 129 | LOGP(DPAG, LOGL_NOTICE, "No slots available on bts nr %d\n", |
| 130 | paging_bts->bts->nr); |
| 131 | paging_bts->available_slots = 20; |
| 132 | } |
| 133 | |
Holger Hans Peter Freyther | 5ded191 | 2010-04-09 21:53:35 +0200 | [diff] [blame] | 134 | initial_request = llist_entry(paging_bts->pending_requests.next, |
| 135 | struct gsm_paging_request, entry); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 136 | current_request = initial_request; |
| 137 | |
| 138 | do { |
| 139 | /* handle the paging request now */ |
| 140 | page_ms(current_request); |
| 141 | paging_bts->available_slots--; |
| 142 | |
Holger Hans Peter Freyther | 5ded191 | 2010-04-09 21:53:35 +0200 | [diff] [blame] | 143 | /* take the current and add it to the back */ |
| 144 | llist_del(¤t_request->entry); |
| 145 | llist_add_tail(¤t_request->entry, &paging_bts->pending_requests); |
| 146 | |
| 147 | /* take the next request */ |
| 148 | current_request = llist_entry(paging_bts->pending_requests.next, |
| 149 | struct gsm_paging_request, entry); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 150 | } while (paging_bts->available_slots > 0 |
| 151 | && initial_request != current_request); |
| 152 | |
Holger Hans Peter Freyther | c6b5f0e | 2010-01-27 09:10:05 +0100 | [diff] [blame] | 153 | bsc_schedule_timer(&paging_bts->work_timer, 2, 0); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | static void paging_worker(void *data) |
| 157 | { |
| 158 | struct gsm_bts_paging_state *paging_bts = data; |
| 159 | |
| 160 | paging_handle_pending_requests(paging_bts); |
| 161 | } |
| 162 | |
| 163 | void paging_init(struct gsm_bts *bts) |
| 164 | { |
| 165 | bts->paging.bts = bts; |
| 166 | INIT_LLIST_HEAD(&bts->paging.pending_requests); |
| 167 | bts->paging.work_timer.cb = paging_worker; |
| 168 | bts->paging.work_timer.data = &bts->paging; |
| 169 | |
| 170 | /* Large number, until we get a proper message */ |
Holger Hans Peter Freyther | c13d32f | 2010-04-09 22:55:55 +0200 | [diff] [blame] | 171 | bts->paging.available_slots = 20; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | static int paging_pending_request(struct gsm_bts_paging_state *bts, |
| 175 | struct gsm_subscriber *subscr) { |
| 176 | struct gsm_paging_request *req; |
| 177 | |
| 178 | llist_for_each_entry(req, &bts->pending_requests, entry) { |
| 179 | if (subscr == req->subscr) |
| 180 | return 1; |
| 181 | } |
| 182 | |
| 183 | return 0; |
| 184 | } |
| 185 | |
| 186 | static void paging_T3113_expired(void *data) |
| 187 | { |
| 188 | struct gsm_paging_request *req = (struct gsm_paging_request *)data; |
| 189 | struct paging_signal_data sig_data; |
Holger Hans Peter Freyther | 353e9b6 | 2009-11-17 10:16:46 +0100 | [diff] [blame] | 190 | void *cbfn_param; |
| 191 | gsm_cbfn *cbfn; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 192 | |
Holger Hans Peter Freyther | b6a3394 | 2010-04-09 22:02:39 +0200 | [diff] [blame] | 193 | LOGP(DPAG, LOGL_INFO, "T3113 expired for request %p (%s)\n", |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 194 | req, req->subscr->imsi); |
| 195 | |
Holger Hans Peter Freyther | a3a1666 | 2009-08-20 06:15:21 +0200 | [diff] [blame] | 196 | sig_data.subscr = req->subscr; |
| 197 | sig_data.bts = req->bts; |
Holger Hans Peter Freyther | d3aaf66 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 198 | sig_data.conn = NULL; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 199 | |
Holger Hans Peter Freyther | 353e9b6 | 2009-11-17 10:16:46 +0100 | [diff] [blame] | 200 | /* must be destroyed before calling cbfn, to prevent double free */ |
Holger Hans Peter Freyther | fad51da | 2010-04-08 16:48:46 +0200 | [diff] [blame] | 201 | counter_inc(req->bts->network->stats.paging.expired); |
Holger Hans Peter Freyther | 353e9b6 | 2009-11-17 10:16:46 +0100 | [diff] [blame] | 202 | cbfn_param = req->cbfn_param; |
| 203 | cbfn = req->cbfn; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 204 | paging_remove_request(&req->bts->paging, req); |
Holger Hans Peter Freyther | 353e9b6 | 2009-11-17 10:16:46 +0100 | [diff] [blame] | 205 | |
Harald Welte | 3edc5a9 | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 206 | |
Sylvain Munaut | 4ff936f | 2009-12-19 12:38:10 +0100 | [diff] [blame] | 207 | dispatch_signal(SS_PAGING, S_PAGING_EXPIRED, &sig_data); |
Holger Hans Peter Freyther | 353e9b6 | 2009-11-17 10:16:46 +0100 | [diff] [blame] | 208 | if (cbfn) |
| 209 | cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_EXPIRED, NULL, NULL, |
| 210 | cbfn_param); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 211 | } |
| 212 | |
Harald Welte | d363c95 | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 213 | static int _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 214 | int type, gsm_cbfn *cbfn, void *data) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 215 | { |
| 216 | struct gsm_bts_paging_state *bts_entry = &bts->paging; |
| 217 | struct gsm_paging_request *req; |
| 218 | |
| 219 | if (paging_pending_request(bts_entry, subscr)) { |
Holger Hans Peter Freyther | b6a3394 | 2010-04-09 22:02:39 +0200 | [diff] [blame] | 220 | LOGP(DPAG, LOGL_INFO, "Paging request already pending for %s\n", subscr->imsi); |
Harald Welte | d363c95 | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 221 | return -EEXIST; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 222 | } |
| 223 | |
Holger Hans Peter Freyther | b6a3394 | 2010-04-09 22:02:39 +0200 | [diff] [blame] | 224 | LOGP(DPAG, LOGL_DEBUG, "Start paging of subscriber %llu on bts %d.\n", |
Harald Welte | cd97c21 | 2009-08-08 15:08:19 +0200 | [diff] [blame] | 225 | subscr->id, bts->nr); |
Harald Welte | 857e00d | 2009-06-26 20:25:23 +0200 | [diff] [blame] | 226 | req = talloc_zero(tall_paging_ctx, struct gsm_paging_request); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 227 | req->subscr = subscr_get(subscr); |
| 228 | req->bts = bts; |
| 229 | req->chan_type = type; |
| 230 | req->cbfn = cbfn; |
| 231 | req->cbfn_param = data; |
| 232 | req->T3113.cb = paging_T3113_expired; |
| 233 | req->T3113.data = req; |
Holger Hans Peter Freyther | 4b9042a | 2009-11-21 21:48:53 +0100 | [diff] [blame] | 234 | bsc_schedule_timer(&req->T3113, bts->network->T3113, 0); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 235 | llist_add_tail(&req->entry, &bts_entry->pending_requests); |
| 236 | |
| 237 | if (!bsc_timer_pending(&bts_entry->work_timer)) |
Holger Hans Peter Freyther | c6b5f0e | 2010-01-27 09:10:05 +0100 | [diff] [blame] | 238 | bsc_schedule_timer(&bts_entry->work_timer, 2, 0); |
Harald Welte | d363c95 | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 239 | |
| 240 | return 0; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 241 | } |
| 242 | |
Harald Welte | d363c95 | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 243 | int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, |
| 244 | int type, gsm_cbfn *cbfn, void *data) |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 245 | { |
| 246 | struct gsm_bts *bts = NULL; |
Harald Welte (local) | dec08ee | 2009-08-15 11:25:45 +0200 | [diff] [blame] | 247 | int num_pages = 0; |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 248 | |
Harald Welte | bdbb744 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 249 | counter_inc(network->stats.paging.attempted); |
Harald Welte | 3edc5a9 | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 250 | |
Harald Welte | 2a3a81b | 2009-08-01 19:31:47 +0200 | [diff] [blame] | 251 | /* start paging subscriber on all BTS within Location Area */ |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 252 | do { |
Harald Welte (local) | dec08ee | 2009-08-15 11:25:45 +0200 | [diff] [blame] | 253 | int rc; |
| 254 | |
Holger Freyther | 93795ac | 2009-03-31 04:35:19 +0200 | [diff] [blame] | 255 | bts = gsm_bts_by_lac(network, subscr->lac, bts); |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 256 | if (!bts) |
| 257 | break; |
Harald Welte (local) | 43db2bf | 2009-12-28 16:36:28 +0100 | [diff] [blame] | 258 | |
| 259 | /* skip all currently inactive TRX */ |
| 260 | if (!trx_is_usable(bts->c0)) |
| 261 | continue; |
| 262 | |
Harald Welte (local) | dec08ee | 2009-08-15 11:25:45 +0200 | [diff] [blame] | 263 | num_pages++; |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 264 | |
Harald Welte | d363c95 | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 265 | /* Trigger paging, pass any error to caller */ |
| 266 | rc = _paging_request(bts, subscr, type, cbfn, data); |
| 267 | if (rc < 0) |
| 268 | return rc; |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 269 | } while (1); |
Harald Welte | d363c95 | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 270 | |
Harald Welte | 3edc5a9 | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 271 | if (num_pages == 0) |
Harald Welte | bdbb744 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 272 | counter_inc(network->stats.paging.detached); |
Harald Welte | 3edc5a9 | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 273 | |
Harald Welte (local) | dec08ee | 2009-08-15 11:25:45 +0200 | [diff] [blame] | 274 | return num_pages; |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 278 | /* we consciously ignore the type of the request here */ |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 279 | static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | d3aaf66 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 280 | struct gsm_subscriber_connection *conn) |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 281 | { |
| 282 | struct gsm_bts_paging_state *bts_entry = &bts->paging; |
| 283 | struct gsm_paging_request *req, *req2; |
| 284 | |
| 285 | llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests, |
| 286 | entry) { |
| 287 | if (req->subscr == subscr) { |
Holger Hans Peter Freyther | d3aaf66 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 288 | if (conn && req->cbfn) { |
Holger Hans Peter Freyther | b6a3394 | 2010-04-09 22:02:39 +0200 | [diff] [blame] | 289 | LOGP(DPAG, LOGL_DEBUG, "Stop paging on bts %d, calling cbfn.\n", bts->nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 290 | req->cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_SUCCEEDED, |
Holger Hans Peter Freyther | d3aaf66 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 291 | NULL, conn, req->cbfn_param); |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 292 | } else |
Holger Hans Peter Freyther | b6a3394 | 2010-04-09 22:02:39 +0200 | [diff] [blame] | 293 | LOGP(DPAG, LOGL_DEBUG, "Stop paging on bts %d silently.\n", bts->nr); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 294 | paging_remove_request(&bts->paging, req); |
| 295 | break; |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 300 | /* Stop paging on all other bts' */ |
| 301 | void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | d3aaf66 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 302 | struct gsm_subscriber_connection *conn) |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 303 | { |
| 304 | struct gsm_bts *bts = NULL; |
| 305 | |
Holger Hans Peter Freyther | b78507a | 2009-08-21 05:43:44 +0200 | [diff] [blame] | 306 | if (_bts) |
Holger Hans Peter Freyther | d3aaf66 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 307 | _paging_request_stop(_bts, subscr, conn); |
Holger Hans Peter Freyther | c51e333 | 2009-06-10 11:46:58 +0200 | [diff] [blame] | 308 | |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 309 | do { |
| 310 | /* |
| 311 | * FIXME: Don't use the lac of the subscriber... |
| 312 | * as it might have magically changed the lac.. use the |
| 313 | * location area of the _bts as reconfiguration of the |
| 314 | * network is probably happening less often. |
| 315 | */ |
Holger Hans Peter Freyther | b78507a | 2009-08-21 05:43:44 +0200 | [diff] [blame] | 316 | bts = gsm_bts_by_lac(subscr->net, subscr->lac, bts); |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 317 | if (!bts) |
| 318 | break; |
| 319 | |
| 320 | /* Stop paging */ |
Holger Hans Peter Freyther | 8c99434 | 2010-04-30 13:32:05 +0800 | [diff] [blame] | 321 | if (bts != _bts) |
Holger Hans Peter Freyther | c51e333 | 2009-06-10 11:46:58 +0200 | [diff] [blame] | 322 | _paging_request_stop(bts, subscr, NULL); |
Holger Hans Peter Freyther | 13d472d | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 323 | } while (1); |
| 324 | } |
| 325 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 326 | void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots) |
| 327 | { |
| 328 | bts->paging.available_slots = free_slots; |
| 329 | } |