[paging] Introduce a variable containing the free paging slots

Start with a large number of available slots. It is guranteed
that we will - at some point - get a paging load and will properly
update the counter and keep it updated.
This commit is contained in:
Holger Freyther 2009-02-10 00:06:19 +00:00
parent 1fd34141c2
commit 392209cbb5
4 changed files with 16 additions and 0 deletions

View File

@ -204,6 +204,9 @@ struct gsm_bts_paging_state {
struct gsm_paging_request *last_request;
struct gsm_bts *bts;
/* load */
u_int16_t available_slots;
/* tick timer */
struct timer_list paging_timer;
};

View File

@ -38,4 +38,7 @@ void paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscr, int type
/* stop paging requests */
void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr);
/* update paging load */
void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t);
#endif

View File

@ -32,6 +32,7 @@
#include <openbsc/chan_alloc.h>
#include <openbsc/debug.h>
#include <openbsc/tlv.h>
#include <openbsc/paging.h>
#define RSL_ALLOC_SIZE 1024
#define RSL_ALLOC_HEADROOM 128
@ -673,6 +674,7 @@ static int rsl_rx_ccch_load(struct msgb *msg)
pg_buf_space = rslh->data[1] << 8 | rslh->data[2];
DEBUGP(DRSL, "CCCH LOAD IND, free paging buffer space: %u\n",
pg_buf_space);
paging_update_buffer_space(msg->trx->bts, pg_buf_space);
break;
case RSL_IE_RACH_LOAD:
if (msg->data_len >= 7) {

View File

@ -134,6 +134,9 @@ void paging_init(struct gsm_bts *bts)
INIT_LLIST_HEAD(&bts->paging.pending_requests);
bts->paging.paging_timer.cb = paging_handle_pending_requests;
bts->paging.paging_timer.data = &bts->paging;
/* Large number, until we get a proper message */
bts->paging.available_slots = 0xffff;
}
static int paging_pending_request(struct gsm_bts_paging_state *bts,
@ -181,3 +184,8 @@ void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr)
}
}
}
void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t free_slots)
{
bts->paging.available_slots = free_slots;
}