Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 1 | /* Paging helper and manager.... */ |
Holger Hans Peter Freyther | dc03096 | 2013-01-07 17:30:13 +0100 | [diff] [blame] | 2 | /* (C) 2009,2013 by Holger Hans Peter Freyther <zecke@selfish.org> |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 3 | * All Rights Reserved |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 6 | * it under the terms of the GNU Affero General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 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 |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 13 | * GNU Affero General Public License for more details. |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 14 | * |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 15 | * You should have received a copy of the GNU Affero General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 17 | * |
| 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * Relevant specs: |
| 22 | * 12.21: |
| 23 | * - 9.4.12 for CCCH Local Threshold |
| 24 | * |
| 25 | * 05.58: |
| 26 | * - 8.5.2 CCCH Load indication |
| 27 | * - 9.3.15 Paging Load |
| 28 | * |
| 29 | * Approach: |
| 30 | * - Send paging command to subscriber |
| 31 | * - On Channel Request we will remember the reason |
| 32 | * - After the ACK we will request the identity |
| 33 | * - Then we will send assign the gsm_subscriber and |
| 34 | * - and call a callback |
| 35 | */ |
| 36 | |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 37 | #include <stdio.h> |
| 38 | #include <stdlib.h> |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 39 | #include <assert.h> |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 40 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 41 | #include <osmocom/core/talloc.h> |
Harald Welte | 457a081 | 2011-06-26 14:21:43 +0200 | [diff] [blame] | 42 | #include <osmocom/gsm/gsm48.h> |
Harald Welte | bc82f92 | 2011-06-26 14:41:58 +0200 | [diff] [blame] | 43 | #include <osmocom/gsm/gsm0502.h> |
Harald Welte | 457a081 | 2011-06-26 14:21:43 +0200 | [diff] [blame] | 44 | |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 45 | #include <osmocom/bsc/bsc_subscriber.h> |
| 46 | #include <osmocom/bsc/paging.h> |
| 47 | #include <osmocom/bsc/debug.h> |
| 48 | #include <osmocom/bsc/signal.h> |
| 49 | #include <osmocom/bsc/abis_rsl.h> |
| 50 | #include <osmocom/bsc/gsm_data.h> |
| 51 | #include <osmocom/bsc/chan_alloc.h> |
| 52 | #include <osmocom/bsc/bsc_api.h> |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 53 | |
Neels Hofmeyr | cc6240a | 2018-02-13 21:21:42 +0100 | [diff] [blame] | 54 | void *tall_paging_ctx = NULL; |
Harald Welte | 2cf161b | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 55 | |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 56 | #define PAGING_TIMER 0, 500000 |
| 57 | |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 58 | /* |
Neels Hofmeyr | c29505e | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 59 | * TODO MSCSPLIT: the paging in libbsc is closely tied to MSC land in that the |
| 60 | * MSC realm callback functions used to be invoked from the BSC/BTS level. So |
| 61 | * this entire file needs to be rewired for use with an A interface. |
| 62 | */ |
| 63 | |
| 64 | /* |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 65 | * Kill one paging request update the internal list... |
| 66 | */ |
Holger Freyther | 1fd3414 | 2009-02-09 23:42:03 +0000 | [diff] [blame] | 67 | static void paging_remove_request(struct gsm_bts_paging_state *paging_bts, |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 68 | struct gsm_paging_request *to_be_deleted) |
Holger Freyther | 3d94924 | 2009-02-06 18:08:18 +0000 | [diff] [blame] | 69 | { |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 70 | osmo_timer_del(&to_be_deleted->T3113); |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 71 | llist_del(&to_be_deleted->entry); |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 72 | bsc_subscr_put(to_be_deleted->bsub); |
Harald Welte | 2cf161b | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 73 | talloc_free(to_be_deleted); |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 76 | static void page_ms(struct gsm_paging_request *request) |
| 77 | { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 78 | uint8_t mi[128]; |
Harald Welte | 2f1311b | 2009-01-06 23:50:39 +0000 | [diff] [blame] | 79 | unsigned int mi_len; |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 80 | unsigned int page_group; |
Harald Welte | 1cf43ec | 2011-06-26 14:43:46 +0200 | [diff] [blame] | 81 | struct gsm_bts *bts = request->bts; |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 82 | |
Holger Hans Peter Freyther | 10049bc | 2012-12-22 19:27:27 +0100 | [diff] [blame] | 83 | /* the bts is down.. we will just wait for the paging to expire */ |
| 84 | if (!bts->oml_link) |
| 85 | return; |
| 86 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 87 | log_set_context(LOG_CTX_BSC_SUBSCR, request->bsub); |
Holger Hans Peter Freyther | b7ccac4 | 2014-12-28 15:00:36 +0100 | [diff] [blame] | 88 | |
Stefan Sperling | d2474ca | 2018-01-08 16:43:32 +0100 | [diff] [blame] | 89 | LOGP(DPAG, LOGL_INFO, "(bts=%d) Going to send paging commands: imsi: %s tmsi: " |
| 90 | "0x%08x for ch. type %d (attempt %d)\n", bts->nr, request->bsub->imsi, |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 91 | request->bsub->tmsi, request->chan_type, request->attempts); |
Holger Hans Peter Freyther | b28285d | 2009-08-21 14:55:57 +0200 | [diff] [blame] | 92 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 93 | if (request->bsub->tmsi == GSM_RESERVED_TMSI) |
| 94 | mi_len = gsm48_generate_mid_from_imsi(mi, request->bsub->imsi); |
Holger Hans Peter Freyther | b28285d | 2009-08-21 14:55:57 +0200 | [diff] [blame] | 95 | else |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 96 | mi_len = gsm48_generate_mid_from_tmsi(mi, request->bsub->tmsi); |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 97 | |
Harald Welte | 1cf43ec | 2011-06-26 14:43:46 +0200 | [diff] [blame] | 98 | page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc, |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 99 | str_to_imsi(request->bsub->imsi)); |
Harald Welte | 1cf43ec | 2011-06-26 14:43:46 +0200 | [diff] [blame] | 100 | gsm0808_page(bts, page_group, mi_len, mi, request->chan_type); |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 101 | log_set_context(LOG_CTX_BSC_SUBSCR, NULL); |
Holger Freyther | 33ba752 | 2009-02-06 22:33:25 +0000 | [diff] [blame] | 102 | } |
| 103 | |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 104 | static void paging_schedule_if_needed(struct gsm_bts_paging_state *paging_bts) |
| 105 | { |
| 106 | if (llist_empty(&paging_bts->pending_requests)) |
| 107 | return; |
| 108 | |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 109 | if (!osmo_timer_pending(&paging_bts->work_timer)) |
| 110 | osmo_timer_schedule(&paging_bts->work_timer, PAGING_TIMER); |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | |
Holger Hans Peter Freyther | 78fab29 | 2010-04-20 10:59:33 +0800 | [diff] [blame] | 114 | static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_bts); |
Holger Hans Peter Freyther | 6410d93 | 2010-04-19 19:41:26 +0800 | [diff] [blame] | 115 | static void paging_give_credit(void *data) |
| 116 | { |
| 117 | struct gsm_bts_paging_state *paging_bts = data; |
| 118 | |
| 119 | LOGP(DPAG, LOGL_NOTICE, "No slots available on bts nr %d\n", paging_bts->bts->nr); |
| 120 | paging_bts->available_slots = 20; |
Holger Hans Peter Freyther | 78fab29 | 2010-04-20 10:59:33 +0800 | [diff] [blame] | 121 | paging_handle_pending_requests(paging_bts); |
Holger Hans Peter Freyther | 6410d93 | 2010-04-19 19:41:26 +0800 | [diff] [blame] | 122 | } |
| 123 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 124 | /*! count the number of free channels for given RSL channel type required |
| 125 | * \param[in] BTS on which we shall count |
| 126 | * \param[in] rsl_type the RSL channel needed type |
| 127 | * \returns number of free channels matching \a rsl_type in \a bts */ |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 128 | static int can_send_pag_req(struct gsm_bts *bts, int rsl_type) |
| 129 | { |
| 130 | struct pchan_load pl; |
| 131 | int count; |
| 132 | |
| 133 | memset(&pl, 0, sizeof(pl)); |
Neels Hofmeyr | 2afffd5 | 2016-09-25 17:01:20 +0200 | [diff] [blame] | 134 | bts_chan_load(&pl, bts); |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 135 | |
| 136 | switch (rsl_type) { |
| 137 | case RSL_CHANNEED_TCH_F: |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 138 | case RSL_CHANNEED_TCH_ForH: |
Holger Hans Peter Freyther | 2e4447b | 2010-04-20 17:15:21 +0800 | [diff] [blame] | 139 | goto count_tch; |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 140 | break; |
| 141 | case RSL_CHANNEED_SDCCH: |
| 142 | goto count_sdcch; |
| 143 | break; |
| 144 | case RSL_CHANNEED_ANY: |
| 145 | default: |
| 146 | if (bts->network->pag_any_tch) |
Holger Hans Peter Freyther | 2e4447b | 2010-04-20 17:15:21 +0800 | [diff] [blame] | 147 | goto count_tch; |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 148 | else |
| 149 | goto count_sdcch; |
| 150 | break; |
| 151 | } |
| 152 | |
| 153 | return 0; |
| 154 | |
| 155 | /* could available SDCCH */ |
| 156 | count_sdcch: |
| 157 | count = 0; |
| 158 | count += pl.pchan[GSM_PCHAN_SDCCH8_SACCH8C].total |
| 159 | - pl.pchan[GSM_PCHAN_SDCCH8_SACCH8C].used; |
| 160 | count += pl.pchan[GSM_PCHAN_CCCH_SDCCH4].total |
| 161 | - pl.pchan[GSM_PCHAN_CCCH_SDCCH4].used; |
| 162 | return bts->paging.free_chans_need > count; |
Holger Hans Peter Freyther | 2e4447b | 2010-04-20 17:15:21 +0800 | [diff] [blame] | 163 | |
| 164 | count_tch: |
| 165 | count = 0; |
| 166 | count += pl.pchan[GSM_PCHAN_TCH_F].total |
| 167 | - pl.pchan[GSM_PCHAN_TCH_F].used; |
| 168 | if (bts->network->neci) |
| 169 | count += pl.pchan[GSM_PCHAN_TCH_H].total |
| 170 | - pl.pchan[GSM_PCHAN_TCH_H].used; |
| 171 | return bts->paging.free_chans_need > count; |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 172 | } |
| 173 | |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 174 | /* |
| 175 | * This is kicked by the periodic PAGING LOAD Indicator |
| 176 | * coming from abis_rsl.c |
| 177 | * |
| 178 | * We attempt to iterate once over the list of items but |
| 179 | * only upto available_slots. |
| 180 | */ |
Holger Freyther | b1ffbb6 | 2009-02-11 01:49:15 +0000 | [diff] [blame] | 181 | static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_bts) |
| 182 | { |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 183 | struct gsm_paging_request *request = NULL; |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 184 | |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 185 | /* |
| 186 | * Determine if the pending_requests list is empty and |
| 187 | * return then. |
| 188 | */ |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 189 | if (llist_empty(&paging_bts->pending_requests)) { |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 190 | /* since the list is empty, no need to reschedule the timer */ |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 191 | return; |
| 192 | } |
| 193 | |
Holger Hans Peter Freyther | 19722d4 | 2010-04-09 18:38:06 +0200 | [diff] [blame] | 194 | /* |
Holger Hans Peter Freyther | 6410d93 | 2010-04-19 19:41:26 +0800 | [diff] [blame] | 195 | * In case the BTS does not provide us with load indication and we |
| 196 | * ran out of slots, call an autofill routine. It might be that the |
| 197 | * BTS did not like our paging messages and then we have counted down |
| 198 | * to zero and we do not get any messages. |
Holger Hans Peter Freyther | 19722d4 | 2010-04-09 18:38:06 +0200 | [diff] [blame] | 199 | */ |
| 200 | if (paging_bts->available_slots == 0) { |
Pablo Neira Ayuso | 5121576 | 2017-05-08 20:57:52 +0200 | [diff] [blame] | 201 | osmo_timer_setup(&paging_bts->credit_timer, paging_give_credit, |
| 202 | paging_bts); |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 203 | osmo_timer_schedule(&paging_bts->credit_timer, 5, 0); |
Holger Hans Peter Freyther | 6410d93 | 2010-04-19 19:41:26 +0800 | [diff] [blame] | 204 | return; |
Holger Hans Peter Freyther | 19722d4 | 2010-04-09 18:38:06 +0200 | [diff] [blame] | 205 | } |
| 206 | |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 207 | request = llist_entry(paging_bts->pending_requests.next, |
| 208 | struct gsm_paging_request, entry); |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 209 | |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 210 | /* we need to determine the number of free channels */ |
| 211 | if (paging_bts->free_chans_need != -1) { |
| 212 | if (can_send_pag_req(request->bts, request->chan_type) != 0) |
| 213 | goto skip_paging; |
| 214 | } |
| 215 | |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 216 | /* handle the paging request now */ |
| 217 | page_ms(request); |
| 218 | paging_bts->available_slots--; |
Holger Hans Peter Freyther | d3baf41 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 219 | request->attempts++; |
Holger Freyther | e36e15e | 2009-02-14 18:05:03 +0000 | [diff] [blame] | 220 | |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 221 | /* take the current and add it to the back */ |
| 222 | llist_del(&request->entry); |
| 223 | llist_add_tail(&request->entry, &paging_bts->pending_requests); |
Holger Hans Peter Freyther | 754e801 | 2010-04-09 21:53:35 +0200 | [diff] [blame] | 224 | |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 225 | skip_paging: |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 226 | osmo_timer_schedule(&paging_bts->work_timer, PAGING_TIMER); |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | static void paging_worker(void *data) |
| 230 | { |
| 231 | struct gsm_bts_paging_state *paging_bts = data; |
| 232 | |
| 233 | paging_handle_pending_requests(paging_bts); |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 234 | } |
| 235 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 236 | /*! initialize the bts paging state, if it hasn't been initialized yet */ |
Holger Hans Peter Freyther | 5a081bb | 2011-04-26 15:44:57 +0200 | [diff] [blame] | 237 | static void paging_init_if_needed(struct gsm_bts *bts) |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 238 | { |
Holger Hans Peter Freyther | 5a081bb | 2011-04-26 15:44:57 +0200 | [diff] [blame] | 239 | if (bts->paging.bts) |
| 240 | return; |
| 241 | |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 242 | bts->paging.bts = bts; |
Neels Hofmeyr | 7193226 | 2017-12-13 19:05:36 +0100 | [diff] [blame] | 243 | |
| 244 | /* This should be initialized only once. There is currently no code that sets bts->paging.bts |
| 245 | * back to NULL, so let's just assert this one instead of graceful handling. */ |
| 246 | OSMO_ASSERT(llist_empty(&bts->paging.pending_requests)); |
| 247 | |
Pablo Neira Ayuso | 5121576 | 2017-05-08 20:57:52 +0200 | [diff] [blame] | 248 | osmo_timer_setup(&bts->paging.work_timer, paging_worker, |
| 249 | &bts->paging); |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 250 | |
| 251 | /* Large number, until we get a proper message */ |
Holger Hans Peter Freyther | 1469600 | 2010-04-09 22:55:55 +0200 | [diff] [blame] | 252 | bts->paging.available_slots = 20; |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 253 | } |
| 254 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 255 | /*! do we have any pending paging requests for given subscriber? */ |
Holger Freyther | 1fd3414 | 2009-02-09 23:42:03 +0000 | [diff] [blame] | 256 | static int paging_pending_request(struct gsm_bts_paging_state *bts, |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 257 | struct bsc_subscr *bsub) |
| 258 | { |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 259 | struct gsm_paging_request *req; |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 260 | |
| 261 | llist_for_each_entry(req, &bts->pending_requests, entry) { |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 262 | if (bsub == req->bsub) |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 263 | return 1; |
| 264 | } |
| 265 | |
| 266 | return 0; |
| 267 | } |
| 268 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 269 | /*! Call-back once T3113 (paging timeout) expires for given paging_request */ |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 270 | static void paging_T3113_expired(void *data) |
| 271 | { |
Holger Freyther | 83e44b0 | 2009-02-14 18:04:59 +0000 | [diff] [blame] | 272 | struct gsm_paging_request *req = (struct gsm_paging_request *)data; |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 273 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 274 | log_set_context(LOG_CTX_BSC_SUBSCR, req->bsub); |
Holger Hans Peter Freyther | b7ccac4 | 2014-12-28 15:00:36 +0100 | [diff] [blame] | 275 | |
Holger Hans Peter Freyther | c50b836 | 2010-04-09 22:02:39 +0200 | [diff] [blame] | 276 | LOGP(DPAG, LOGL_INFO, "T3113 expired for request %p (%s)\n", |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 277 | req, bsc_subscr_name(req->bsub)); |
Holger Freyther | 4af2b48 | 2009-02-14 22:51:03 +0000 | [diff] [blame] | 278 | |
Holger Hans Peter Freyther | fe9da82 | 2009-11-17 10:16:46 +0100 | [diff] [blame] | 279 | /* must be destroyed before calling cbfn, to prevent double free */ |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 280 | rate_ctr_inc(&req->bts->bts_ctrs->ctr[BTS_CTR_PAGING_EXPIRED]); |
Holger Hans Peter Freyther | d3baf41 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 281 | |
| 282 | /* destroy it now. Do not access req afterwards */ |
Harald Welte | 51cce1e | 2009-02-10 17:35:04 +0000 | [diff] [blame] | 283 | paging_remove_request(&req->bts->paging, req); |
| 284 | } |
| 285 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 286 | /*! Start paging + paging timer for given subscriber on given BTS |
| 287 | * \param bts BTS on which to page |
| 288 | * \param[in] bsub subscriber we want to page |
| 289 | * \param[in] type type of radio channel we're requirign |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 290 | * \param[in] msc MSC which has issue this paging |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 291 | * \returns 0 on success, negative on error */ |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 292 | static int _paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub, int type, |
| 293 | struct bsc_msc_data *msc) |
Harald Welte | 09e38af | 2009-02-16 22:52:23 +0000 | [diff] [blame] | 294 | { |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 295 | struct gsm_bts_paging_state *bts_entry = &bts->paging; |
| 296 | struct gsm_paging_request *req; |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 297 | |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 298 | rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_PAGING_ATTEMPTED]); |
| 299 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 300 | if (paging_pending_request(bts_entry, bsub)) { |
| 301 | LOGP(DPAG, LOGL_INFO, "Paging request already pending for %s\n", |
| 302 | bsc_subscr_name(bsub)); |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 303 | rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_PAGING_ALREADY]); |
Harald Welte | e903edf | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 304 | return -EEXIST; |
Holger Freyther | 49314f6 | 2009-02-14 23:53:20 +0000 | [diff] [blame] | 305 | } |
| 306 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 307 | LOGP(DPAG, LOGL_DEBUG, "Start paging of subscriber %s on bts %d.\n", |
| 308 | bsc_subscr_name(bsub), bts->nr); |
Harald Welte | 470ec29 | 2009-06-26 20:25:23 +0200 | [diff] [blame] | 309 | req = talloc_zero(tall_paging_ctx, struct gsm_paging_request); |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 310 | OSMO_ASSERT(req); |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 311 | req->bsub = bsc_subscr_get(bsub); |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 312 | req->bts = bts; |
Harald Welte | 38c2f13 | 2009-01-06 23:10:57 +0000 | [diff] [blame] | 313 | req->chan_type = type; |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 314 | req->msc = msc; |
Pablo Neira Ayuso | 5121576 | 2017-05-08 20:57:52 +0200 | [diff] [blame] | 315 | osmo_timer_setup(&req->T3113, paging_T3113_expired, req); |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 316 | osmo_timer_schedule(&req->T3113, bts->network->T3113, 0); |
Holger Freyther | 49314f6 | 2009-02-14 23:53:20 +0000 | [diff] [blame] | 317 | llist_add_tail(&req->entry, &bts_entry->pending_requests); |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 318 | paging_schedule_if_needed(bts_entry); |
Harald Welte | e903edf | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 319 | |
| 320 | return 0; |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 321 | } |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 322 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 323 | /*! Handle PAGING request from MSC for one (matching) BTS |
| 324 | * \param bts BTS on which to page |
| 325 | * \param[in] bsub subscriber we want to page |
| 326 | * \param[in] type type of radio channel we're requirign |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 327 | * \param[in] msc MSC which has issue this paging |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 328 | * returns 1 on success; 0 in case of error (e.g. TRX down) */ |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 329 | int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, int type, |
| 330 | struct bsc_msc_data *msc) |
Holger Hans Peter Freyther | dc03096 | 2013-01-07 17:30:13 +0100 | [diff] [blame] | 331 | { |
| 332 | int rc; |
| 333 | |
| 334 | /* skip all currently inactive TRX */ |
| 335 | if (!trx_is_usable(bts->c0)) |
| 336 | return 0; |
| 337 | |
| 338 | /* maybe it is the first time we use it */ |
| 339 | paging_init_if_needed(bts); |
| 340 | |
Holger Hans Peter Freyther | dc03096 | 2013-01-07 17:30:13 +0100 | [diff] [blame] | 341 | /* Trigger paging, pass any error to the caller */ |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 342 | rc = _paging_request(bts, bsub, type, msc); |
Holger Hans Peter Freyther | dc03096 | 2013-01-07 17:30:13 +0100 | [diff] [blame] | 343 | if (rc < 0) |
| 344 | return rc; |
| 345 | return 1; |
| 346 | } |
| 347 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 348 | /*! Receive a new PAGING request from the MSC |
| 349 | * \param network gsm_network we operate in |
| 350 | * \param[in] bsub subscriber we want to page |
| 351 | * \param[in] type type of radio channel we're requirign |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 352 | * \param[in] msc MSC which has issue this paging |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 353 | * \returns number of BTSs on which we issued the paging */ |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 354 | int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, int type, |
| 355 | struct bsc_msc_data *msc) |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 356 | { |
| 357 | struct gsm_bts *bts = NULL; |
Harald Welte (local) | 0abaf33 | 2009-08-15 11:25:45 +0200 | [diff] [blame] | 358 | int num_pages = 0; |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 359 | |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 360 | rate_ctr_inc(&network->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED]); |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 361 | |
Harald Welte | a1b2858 | 2009-08-01 19:31:47 +0200 | [diff] [blame] | 362 | /* start paging subscriber on all BTS within Location Area */ |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 363 | do { |
Harald Welte (local) | 0abaf33 | 2009-08-15 11:25:45 +0200 | [diff] [blame] | 364 | int rc; |
| 365 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 366 | bts = gsm_bts_by_lac(network, bsub->lac, bts); |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 367 | if (!bts) |
| 368 | break; |
Harald Welte (local) | 82ff397 | 2009-12-28 16:36:28 +0100 | [diff] [blame] | 369 | |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 370 | rc = paging_request_bts(bts, bsub, type, msc); |
Holger Hans Peter Freyther | 469f992 | 2015-08-03 11:19:35 +0200 | [diff] [blame] | 371 | if (rc < 0) { |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 372 | paging_request_stop(&network->bts_list, NULL, bsub, |
| 373 | NULL, NULL); |
Harald Welte | e903edf | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 374 | return rc; |
Holger Hans Peter Freyther | 469f992 | 2015-08-03 11:19:35 +0200 | [diff] [blame] | 375 | } |
Holger Hans Peter Freyther | dc03096 | 2013-01-07 17:30:13 +0100 | [diff] [blame] | 376 | num_pages += rc; |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 377 | } while (1); |
Harald Welte | e903edf | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 378 | |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 379 | if (num_pages == 0) |
Alexander Couzens | b847a21 | 2016-08-02 11:34:11 +0200 | [diff] [blame] | 380 | rate_ctr_inc(&network->bsc_ctrs->ctr[BSC_CTR_PAGING_DETACHED]); |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 381 | |
Harald Welte (local) | 0abaf33 | 2009-08-15 11:25:45 +0200 | [diff] [blame] | 382 | return num_pages; |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 386 | /*! Stop paging a given subscriber on a given BTS. |
| 387 | * If \a conn is non-NULL, we also call the paging call-back function |
| 388 | * to notify the paging originator that paging has completed. |
| 389 | * \param[in] bts BTS on which we shall stop paging |
| 390 | * \param[in] bsub subscriber which we shall stop paging |
| 391 | * \param[in] conn connection to the subscriber (if any) |
| 392 | * \param[in] msg message received from subscrbier (if any) */ |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 393 | /* we consciously ignore the type of the request here */ |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 394 | static void _paging_request_stop(struct gsm_bts *bts, struct bsc_subscr *bsub, |
Sylvain Munaut | c7ff257 | 2010-12-01 21:41:35 +0100 | [diff] [blame] | 395 | struct gsm_subscriber_connection *conn, |
| 396 | struct msgb *msg) |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 397 | { |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 398 | struct gsm_bts_paging_state *bts_entry = &bts->paging; |
| 399 | struct gsm_paging_request *req, *req2; |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 400 | |
Holger Hans Peter Freyther | 5a081bb | 2011-04-26 15:44:57 +0200 | [diff] [blame] | 401 | paging_init_if_needed(bts); |
| 402 | |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 403 | llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests, |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 404 | entry) { |
| 405 | if (req->bsub == bsub) { |
Holger Hans Peter Freyther | 0ae564d | 2015-04-06 16:54:55 +0200 | [diff] [blame] | 406 | /* now give up the data structure */ |
| 407 | paging_remove_request(&bts->paging, req); |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 408 | LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d\n", bsub->imsi, bts->nr); |
Holger Freyther | 3d94924 | 2009-02-06 18:08:18 +0000 | [diff] [blame] | 409 | break; |
| 410 | } |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 411 | } |
| 412 | } |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 413 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 414 | /*! Stop paging on all other bts' |
| 415 | * \param[in] bts_list list of BTSs to iterate |
| 416 | * \param[in] _bts BTS which has received a paging response |
| 417 | * \param[in] bsub subscriber |
| 418 | * \param[in] msgb L3 message that we have received from \a bsub on \a _bts */ |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 419 | void paging_request_stop(struct llist_head *bts_list, |
| 420 | struct gsm_bts *_bts, struct bsc_subscr *bsub, |
Sylvain Munaut | c7ff257 | 2010-12-01 21:41:35 +0100 | [diff] [blame] | 421 | struct gsm_subscriber_connection *conn, |
| 422 | struct msgb *msg) |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 423 | { |
Holger Hans Peter Freyther | ba43365 | 2015-08-03 11:20:31 +0200 | [diff] [blame] | 424 | struct gsm_bts *bts; |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 425 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 426 | log_set_context(LOG_CTX_BSC_SUBSCR, bsub); |
Holger Hans Peter Freyther | b7ccac4 | 2014-12-28 15:00:36 +0100 | [diff] [blame] | 427 | |
Holger Hans Peter Freyther | ba43365 | 2015-08-03 11:20:31 +0200 | [diff] [blame] | 428 | /* Stop this first and dispatch the request */ |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 429 | if (_bts) { |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 430 | _paging_request_stop(_bts, bsub, conn, msg); |
Harald Welte | cf9d431 | 2017-12-13 23:17:16 +0100 | [diff] [blame] | 431 | rate_ctr_inc(&_bts->bts_ctrs->ctr[BTS_CTR_PAGING_RESPONDED]); |
| 432 | rate_ctr_inc(&_bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_RESPONDED]); |
| 433 | } |
Holger Hans Peter Freyther | fdac4cc | 2009-06-10 11:46:58 +0200 | [diff] [blame] | 434 | |
Holger Hans Peter Freyther | ba43365 | 2015-08-03 11:20:31 +0200 | [diff] [blame] | 435 | /* Make sure to cancel this everywhere else */ |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 436 | llist_for_each_entry(bts, bts_list, list) { |
Holger Hans Peter Freyther | ba43365 | 2015-08-03 11:20:31 +0200 | [diff] [blame] | 437 | /* Sort of an optimization. */ |
| 438 | if (bts == _bts) |
| 439 | continue; |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 440 | _paging_request_stop(bts, bsub, NULL, NULL); |
Holger Hans Peter Freyther | ba43365 | 2015-08-03 11:20:31 +0200 | [diff] [blame] | 441 | } |
Holger Hans Peter Freyther | 2c45123 | 2009-06-10 02:45:42 +0200 | [diff] [blame] | 442 | } |
| 443 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 444 | |
| 445 | /*! Update the BTS paging buffer slots on given BTS */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 446 | void paging_update_buffer_space(struct gsm_bts *bts, uint16_t free_slots) |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 447 | { |
Holger Hans Peter Freyther | 5a081bb | 2011-04-26 15:44:57 +0200 | [diff] [blame] | 448 | paging_init_if_needed(bts); |
| 449 | |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 450 | osmo_timer_del(&bts->paging.credit_timer); |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 451 | bts->paging.available_slots = free_slots; |
Holger Hans Peter Freyther | eb241aa | 2010-09-06 10:05:23 +0800 | [diff] [blame] | 452 | paging_schedule_if_needed(&bts->paging); |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 453 | } |
Holger Hans Peter Freyther | 66e14cd | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 454 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 455 | /*! Count the number of pending paging requests on given BTS */ |
Holger Hans Peter Freyther | 66e14cd | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 456 | unsigned int paging_pending_requests_nr(struct gsm_bts *bts) |
| 457 | { |
| 458 | unsigned int requests = 0; |
| 459 | struct gsm_paging_request *req; |
| 460 | |
| 461 | paging_init_if_needed(bts); |
| 462 | |
| 463 | llist_for_each_entry(req, &bts->paging.pending_requests, entry) |
| 464 | ++requests; |
| 465 | |
| 466 | return requests; |
| 467 | } |
Holger Hans Peter Freyther | 31f5f71 | 2011-06-07 19:53:29 +0200 | [diff] [blame] | 468 | |
Harald Welte | 958cccf | 2017-12-11 14:25:08 +0100 | [diff] [blame] | 469 | /*! Find any paging data for the given subscriber at the given BTS. */ |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 470 | struct bsc_msc_data *paging_get_msc(struct gsm_bts *bts, struct bsc_subscr *bsub) |
Holger Hans Peter Freyther | 31f5f71 | 2011-06-07 19:53:29 +0200 | [diff] [blame] | 471 | { |
| 472 | struct gsm_paging_request *req; |
| 473 | |
| 474 | llist_for_each_entry(req, &bts->paging.pending_requests, entry) |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 475 | if (req->bsub == bsub) |
Harald Welte | f4b66fb | 2017-12-11 15:21:48 +0100 | [diff] [blame] | 476 | return req->msc; |
Holger Hans Peter Freyther | 31f5f71 | 2011-06-07 19:53:29 +0200 | [diff] [blame] | 477 | |
| 478 | return NULL; |
| 479 | } |
Harald Welte | d382bf6 | 2017-12-11 15:33:35 +0100 | [diff] [blame] | 480 | |
| 481 | /*! Flush all paging requests at a given BTS for a given MSC*/ |
| 482 | void paging_flush_bts(struct gsm_bts *bts, struct bsc_msc_data *msc) |
| 483 | { |
| 484 | struct gsm_paging_request *req, *req2; |
| 485 | |
Philipp Maier | 256d09d | 2017-12-13 15:33:25 +0100 | [diff] [blame] | 486 | paging_init_if_needed(bts); |
| 487 | |
Harald Welte | d382bf6 | 2017-12-11 15:33:35 +0100 | [diff] [blame] | 488 | llist_for_each_entry_safe(req, req2, &bts->paging.pending_requests, entry) { |
| 489 | if (msc && req->msc != msc) |
| 490 | continue; |
| 491 | /* now give up the data structure */ |
| 492 | LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d (flush).\n", req->bsub->imsi, bts->nr); |
| 493 | paging_remove_request(&bts->paging, req); |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | /*! Flush all paging requests issued by \a msc on any BTS in \a net */ |
| 498 | void paging_flush_network(struct gsm_network *net, struct bsc_msc_data *msc) |
| 499 | { |
| 500 | struct gsm_bts *bts; |
| 501 | |
| 502 | llist_for_each_entry(bts, &net->bts_list, list) |
| 503 | paging_flush_bts(bts, msc); |
| 504 | } |