aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-20 12:27:33 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-20 12:27:33 +0800
commit4aca7f621ffb35e3c17eaba221eca1b351043d4d (patch)
tree2ca208a473cff2f8e9e340644677d40ce2db43bc
parent507d536ce8139218aa61be9067d9eaac698f1647 (diff)
[paging] Continuisly send paging commands.
Instead of throwing a huge pile of paging commands to the BTS we will submit one paging command every half second. This way we can have different messages between the paging commands.
-rw-r--r--openbsc/src/paging.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c
index 2473b3bc9..f24c5cfb7 100644
--- a/openbsc/src/paging.c
+++ b/openbsc/src/paging.c
@@ -49,6 +49,8 @@
void *tall_paging_ctx;
+#define PAGING_TIMER 0, 500000
+
static unsigned int calculate_group(struct gsm_bts *bts, struct gsm_subscriber *subscr)
{
int ccch_conf;
@@ -96,6 +98,16 @@ static void page_ms(struct gsm_paging_request *request)
request->chan_type);
}
+static void paging_schedule_if_needed(struct gsm_bts_paging_state *paging_bts)
+{
+ if (llist_empty(&paging_bts->pending_requests))
+ return;
+
+ if (!bsc_timer_pending(&paging_bts->work_timer))
+ bsc_schedule_timer(&paging_bts->work_timer, PAGING_TIMER);
+}
+
+
static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_bts);
static void paging_give_credit(void *data)
{
@@ -115,8 +127,7 @@ static void paging_give_credit(void *data)
*/
static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_bts)
{
- struct gsm_paging_request *initial_request = NULL;
- struct gsm_paging_request *current_request = NULL;
+ struct gsm_paging_request *request = NULL;
/*
* Determine if the pending_requests list is empty and
@@ -140,26 +151,18 @@ static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_b
return;
}
- initial_request = llist_entry(paging_bts->pending_requests.next,
- struct gsm_paging_request, entry);
- current_request = initial_request;
+ request = llist_entry(paging_bts->pending_requests.next,
+ struct gsm_paging_request, entry);
- do {
- /* handle the paging request now */
- page_ms(current_request);
- paging_bts->available_slots--;
+ /* handle the paging request now */
+ page_ms(request);
+ paging_bts->available_slots--;
- /* take the current and add it to the back */
- llist_del(&current_request->entry);
- llist_add_tail(&current_request->entry, &paging_bts->pending_requests);
+ /* take the current and add it to the back */
+ llist_del(&request->entry);
+ llist_add_tail(&request->entry, &paging_bts->pending_requests);
- /* take the next request */
- current_request = llist_entry(paging_bts->pending_requests.next,
- struct gsm_paging_request, entry);
- } while (paging_bts->available_slots > 0
- && initial_request != current_request);
-
- bsc_schedule_timer(&paging_bts->work_timer, 2, 0);
+ bsc_schedule_timer(&paging_bts->work_timer, PAGING_TIMER);
}
static void paging_worker(void *data)
@@ -242,9 +245,7 @@ static int _paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr,
req->T3113.data = req;
bsc_schedule_timer(&req->T3113, bts->network->T3113, 0);
llist_add_tail(&req->entry, &bts_entry->pending_requests);
-
- if (!bsc_timer_pending(&bts_entry->work_timer))
- bsc_schedule_timer(&bts_entry->work_timer, 2, 0);
+ paging_schedule_if_needed(bts_entry);
return 0;
}
@@ -336,6 +337,7 @@ void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots)
{
bsc_del_timer(&bts->paging.credit_timer);
bts->paging.available_slots = free_slots;
+ paging_schedule_if_needed(&bts->paging);
}
unsigned int paging_pending_requests_nr(struct gsm_bts *bts)