From b618c7ec9bd29c471a153da833bb50089f48d2f6 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 3 Aug 2015 11:21:29 +0200 Subject: paging: Move the silent_call code to use the subscriber request Coordinate with the normal subscriber channel requests instead of going to page ourselves. This might lead to getting a channel that is of a different type though. --- openbsc/src/libmsc/silent_call.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openbsc/src/libmsc/silent_call.c b/openbsc/src/libmsc/silent_call.c index 010c2b4d2..e9ece1835 100644 --- a/openbsc/src/libmsc/silent_call.c +++ b/openbsc/src/libmsc/silent_call.c @@ -118,11 +118,10 @@ int silent_call_reroute(struct gsm_subscriber_connection *conn, struct msgb *msg /* initiate a silent call with a given subscriber */ int gsm_silent_call_start(struct gsm_subscriber *subscr, void *data, int type) { - int rc; + struct subscr_request *req; - rc = paging_request(subscr->group->net, subscr, type, - paging_cb_silent, data); - return rc; + req = subscr_request_channel(subscr, type, paging_cb_silent, data); + return req != NULL; } /* end a silent call with a given subscriber */ -- cgit v1.2.3 From 469f992b2bf9fd3d80928d11ca50ef663bf5b90e Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 3 Aug 2015 11:19:35 +0200 Subject: paging: In case paging failed stop it everywhere In case we can't page on a BTS then stop it everywhere. The callers of paging_request assume that this is kind of an atomic operation and we should help with that. --- openbsc/src/libbsc/paging.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c index 8bc10e670..6b46c6dfc 100644 --- a/openbsc/src/libbsc/paging.c +++ b/openbsc/src/libbsc/paging.c @@ -341,8 +341,10 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, break; rc = paging_request_bts(bts, subscr, type, cbfn, data); - if (rc < 0) + if (rc < 0) { + paging_request_stop(NULL, subscr, NULL, NULL); return rc; + } num_pages += rc; } while (1); -- cgit v1.2.3 From ba43365e963b884cd488487328504396b0257241 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 3 Aug 2015 11:20:31 +0200 Subject: paging: Go through all BTS to stop paging As the comment says we should not rely that the paging occurs on the current LAC. We might page at more BTS. Walk all the BTS to stop paging. No callbacks will be issued by this stop operation. --- openbsc/src/libbsc/paging.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c index 6b46c6dfc..9ae28e0c4 100644 --- a/openbsc/src/libbsc/paging.c +++ b/openbsc/src/libbsc/paging.c @@ -391,28 +391,21 @@ void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr, struct gsm_subscriber_connection *conn, struct msgb *msg) { - struct gsm_bts *bts = NULL; + struct gsm_bts *bts; log_set_context(BSC_CTX_SUBSCR, subscr); + /* Stop this first and dispatch the request */ if (_bts) _paging_request_stop(_bts, subscr, conn, msg); - do { - /* - * FIXME: Don't use the lac of the subscriber... - * as it might have magically changed the lac.. use the - * location area of the _bts as reconfiguration of the - * network is probably happening less often. - */ - bts = gsm_bts_by_lac(subscr->group->net, subscr->lac, bts); - if (!bts) - break; - - /* Stop paging */ - if (bts != _bts) - _paging_request_stop(bts, subscr, NULL, NULL); - } while (1); + /* Make sure to cancel this everywhere else */ + llist_for_each_entry(bts, &subscr->group->net->bts_list, list) { + /* Sort of an optimization. */ + if (bts == _bts) + continue; + _paging_request_stop(bts, subscr, NULL, NULL); + } } void paging_update_buffer_space(struct gsm_bts *bts, uint16_t free_slots) -- cgit v1.2.3 From 778c7d1544fd1c0ae4e4716a3b2391ae82c60f41 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 3 Aug 2015 11:18:23 +0200 Subject: paging: Stop paging everywhere before dispatching any signal --- openbsc/src/libmsc/gsm_subscriber.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c index 4559de581..145cbdd5d 100644 --- a/openbsc/src/libmsc/gsm_subscriber.c +++ b/openbsc/src/libmsc/gsm_subscriber.c @@ -84,6 +84,15 @@ static int subscr_paging_dispatch(unsigned int hooknum, unsigned int event, OSMO_ASSERT(subscr->is_paging); + /* + * Stop paging on all other BTS. E.g. if this is + * the first timeout on a BTS then the others will + * timeout soon as well. Let's just stop everything + * and forget we wanted to page. + */ + paging_request_stop(NULL, subscr, NULL, NULL); + subscr->is_paging = 0; + /* Inform parts of the system we don't know */ sig_data.subscr = subscr; sig_data.bts = conn ? conn->bts : NULL; @@ -96,15 +105,6 @@ static int subscr_paging_dispatch(unsigned int hooknum, unsigned int event, &sig_data ); - /* - * Stop paging on all other BTS. E.g. if this is - * the first timeout on a BTS then the others will - * timeout soon as well. Let's just stop everything - * and forget we wanted to page. - */ - paging_request_stop(NULL, subscr, NULL, NULL); - subscr->is_paging = 0; - llist_for_each_entry_safe(request, tmp, &subscr->requests, entry) { llist_del(&request->entry); request->cbfn(hooknum, event, msg, data, request->param); -- cgit v1.2.3 From eb48cafac9af84586679a4ce4caeb985ef0b1eb1 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 3 Aug 2015 11:34:35 +0200 Subject: paging: Forget we were paging after the dispatch So in case somebody is starting paging from within a paging expired callback we would dispatch the paging request right away with the same failure. --- openbsc/src/libmsc/gsm_subscriber.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c index 145cbdd5d..442e84c4c 100644 --- a/openbsc/src/libmsc/gsm_subscriber.c +++ b/openbsc/src/libmsc/gsm_subscriber.c @@ -91,7 +91,6 @@ static int subscr_paging_dispatch(unsigned int hooknum, unsigned int event, * and forget we wanted to page. */ paging_request_stop(NULL, subscr, NULL, NULL); - subscr->is_paging = 0; /* Inform parts of the system we don't know */ sig_data.subscr = subscr; @@ -112,6 +111,7 @@ static int subscr_paging_dispatch(unsigned int hooknum, unsigned int event, } /* balanced with the moment we start paging */ + subscr->is_paging = 0; subscr_put(subscr); return 0; } -- cgit v1.2.3