aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-06-10 02:45:42 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-06-10 06:40:48 +0200
commit2c451238070bf9ceec4601c55160db8e0da0d1cc (patch)
treea957ae706d6be8ac2c29185f7ce0426e4082a508 /openbsc
parentcd1f751e4c28d12fe0b6e77bd7448206990417f8 (diff)
Move the "finding" of the right BTS into paging.c
Move the secret of how to find the BTS in a LocationArea into the paging layer. This allows to implement different strategies without changing other parts. E.g. we might want to try the BTS were the device was seen last and then try... There should be no semantic change and things should continue to work. It is sadly not tested though.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/gsm_04_08.c25
-rw-r--r--openbsc/src/paging.c46
2 files changed, 44 insertions, 27 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 462e67af8..5702dca15 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -1016,7 +1016,6 @@ static int gsm48_rr_rx_pag_resp(struct msgb *msg)
u_int8_t mi_type = mi_lv[1] & GSM_MI_TYPE_MASK;
char mi_string[MI_SIZE];
struct gsm_subscriber *subscr;
- struct gsm_bts *bts;
struct paging_signal_data sig_data;
int rc = 0;
@@ -1064,18 +1063,6 @@ static int gsm48_rr_rx_pag_resp(struct msgb *msg)
/* Stop paging on the bts we received the paging response */
paging_request_stop(msg->trx->bts, subscr, msg->lchan);
- /* Stop paging on all other bts' */
- bts = NULL;
- do {
- bts = gsm_bts_by_lac(msg->trx->bts->network, subscr->lac, bts);
- if (!bts)
- break;
- if (bts == msg->trx->bts)
- continue;
- /* Stop paging */
- paging_request_stop(bts, subscr, NULL);
- } while (1);
-
/* FIXME: somehow signal the completion of the PAGING to
* the entity that requested the paging */
@@ -1310,7 +1297,6 @@ static int gsm48_cc_rx_setup(struct msgb *msg)
struct gsm48_hdr *gh = msgb_l3(msg);
unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
struct gsm_subscriber *called_subscr;
- struct gsm_bts *bts;
char called_number[(43-2)*2 + 1] = "\0";
struct tlv_parsed tp;
u_int8_t num_type;
@@ -1355,15 +1341,8 @@ static int gsm48_cc_rx_setup(struct msgb *msg)
call->called_subscr = called_subscr;
/* Start paging subscriber on all BTS in LAC of subscriber */
- bts = NULL;
- do {
- bts = gsm_bts_by_lac(msg->trx->bts->network, called_subscr->lac, bts);
- if (!bts)
- break;
- /* Trigger paging */
- paging_request(bts, called_subscr, RSL_CHANNEED_TCH_F,
- setup_trig_pag_evt, call);
- } while (1);
+ paging_request(msg->trx->bts, called_subscr, RSL_CHANNEED_TCH_F,
+ setup_trig_pag_evt, call);
/* send a CALL PROCEEDING message to the MO */
ret = gsm48_tx_simple(msg->lchan, GSM48_PDISC_CC,
diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c
index f3bdf6973..e647b33be 100644
--- a/openbsc/src/paging.c
+++ b/openbsc/src/paging.c
@@ -210,8 +210,8 @@ static void paging_T3113_expired(void *data)
paging_remove_request(&req->bts->paging, req);
}
-void paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr,
- int type, gsm_cbfn *cbfn, void *data)
+static void _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr,
+ int type, gsm_cbfn *cbfn, void *data)
{
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req;
@@ -237,9 +237,25 @@ void paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr,
bsc_schedule_timer(&bts_entry->work_timer, 1, 0);
}
+void paging_request(struct gsm_bts *_bts, struct gsm_subscriber *subscr,
+ int type, gsm_cbfn *cbfn, void *data)
+{
+ struct gsm_bts *bts = NULL;
+
+ do {
+ bts = gsm_bts_by_lac(_bts->network, subscr->lac, bts);
+ if (!bts)
+ break;
+
+ /* Trigger paging */
+ _paging_request(bts, subscr, RSL_CHANNEED_TCH_F, cbfn, data);
+ } while (1);
+}
+
+
/* we consciously ignore the type of the request here */
-void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
- struct gsm_lchan *lchan)
+static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
+ struct gsm_lchan *lchan)
{
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req, *req2;
@@ -256,6 +272,28 @@ void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
}
}
+/* Stop paging on all other bts' */
+void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr,
+ struct gsm_lchan *lchan)
+{
+ struct gsm_bts *bts = NULL;
+
+ 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(_bts->network, subscr->lac, bts);
+ if (!bts)
+ break;
+
+ /* Stop paging */
+ _paging_request_stop(bts, subscr, NULL);
+ } while (1);
+}
+
void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots)
{
bts->paging.available_slots = free_slots;