bsc_api: Make paging/silent call work with the subscriber_connection

Do not use the lchan for the paging but operate on the
subscriber_connection, change the signals too to not carry
the lchan but the subscriber connection... the silent call
and vty code still assume there is a lchan inside the
subscriber connection.
This commit is contained in:
Holger Hans Peter Freyther 2010-06-17 15:05:57 +08:00
parent 7b4a53d537
commit 86481c29d4
9 changed files with 26 additions and 29 deletions

View File

@ -38,7 +38,7 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
/* stop paging requests */
void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
struct gsm_lchan *lchan);
struct gsm_subscriber_connection *conn);
/* update paging load */
void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t);

View File

@ -125,12 +125,12 @@ struct paging_signal_data {
struct gsm_bts *bts;
/* NULL in case the paging didn't work */
struct gsm_lchan *lchan;
struct gsm_subscriber_connection *conn;
};
struct scall_signal_data {
struct gsm_subscriber *subscr;
struct gsm_lchan *lchan;
struct gsm_subscriber_connection *conn;
void *data;
};

View File

@ -1363,9 +1363,9 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg);
/* call-back from paging the B-end of the connection */
static int setup_trig_pag_evt(unsigned int hooknum, unsigned int event,
struct msgb *msg, void *_lchan, void *param)
struct msgb *msg, void *_conn, void *param)
{
struct gsm_lchan *lchan = _lchan;
struct gsm_subscriber_connection *conn = _conn;
struct gsm_subscriber *subscr = param;
struct gsm_trans *transt, *tmp;
struct gsm_network *net;
@ -1387,13 +1387,13 @@ static int setup_trig_pag_evt(unsigned int hooknum, unsigned int event,
continue;
switch (event) {
case GSM_PAGING_SUCCEEDED:
if (!lchan) // paranoid
if (!conn) // paranoid
break;
DEBUGP(DCC, "Paging subscr %s succeeded!\n",
subscr->extension);
/* Assign lchan */
if (!transt->conn) {
transt->conn = &lchan->conn;
transt->conn = conn;
use_subscr_con(transt->conn);
}
/* send SETUP request to called party */

View File

@ -268,14 +268,14 @@ int gsm48_handle_paging_resp(struct msgb *msg, struct gsm_subscriber *subscr)
sig_data.subscr = subscr;
sig_data.bts = msg->lchan->ts->trx->bts;
sig_data.lchan = msg->lchan;
sig_data.conn = &msg->lchan->conn;
counter_inc(bts->network->stats.paging.completed);
dispatch_signal(SS_PAGING, S_PAGING_SUCCEEDED, &sig_data);
/* Stop paging on the bts we received the paging response */
paging_request_stop(msg->trx->bts, subscr, msg->lchan);
paging_request_stop(msg->trx->bts, subscr, &msg->lchan->conn);
return 0;
}

View File

@ -1108,22 +1108,22 @@ static int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sm
/* paging callback. Here we get called if paging a subscriber has
* succeeded or failed. */
static int paging_cb_send_sms(unsigned int hooknum, unsigned int event,
struct msgb *msg, void *_lchan, void *_sms)
struct msgb *msg, void *_conn, void *_sms)
{
struct gsm_lchan *lchan = _lchan;
struct gsm_subscriber_connection *conn = _conn;
struct gsm_sms *sms = _sms;
int rc = 0;
DEBUGP(DSMS, "paging_cb_send_sms(hooknum=%u, event=%u, msg=%p,"
"lchan=%p, sms=%p)\n", hooknum, event, msg, lchan, sms);
"conn=%p, sms=%p)\n", hooknum, event, msg, conn, sms);
if (hooknum != GSM_HOOK_RR_PAGING)
return -EINVAL;
switch (event) {
case GSM_PAGING_SUCCEEDED:
use_subscr_con(&lchan->conn);
gsm411_send_sms(&lchan->conn, sms);
use_subscr_con(conn);
gsm411_send_sms(conn, sms);
break;
case GSM_PAGING_EXPIRED:
case GSM_PAGING_OOM:

View File

@ -194,7 +194,7 @@ static void paging_T3113_expired(void *data)
sig_data.subscr = req->subscr;
sig_data.bts = req->bts;
sig_data.lchan = NULL;
sig_data.conn = NULL;
/* must be destroyed before calling cbfn, to prevent double free */
counter_inc(req->bts->network->stats.paging.expired);
@ -276,7 +276,7 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
/* we consciously ignore the type of the request here */
static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
struct gsm_lchan *lchan)
struct gsm_subscriber_connection *conn)
{
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req, *req2;
@ -284,10 +284,10 @@ static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *sub
llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests,
entry) {
if (req->subscr == subscr) {
if (lchan && req->cbfn) {
if (conn && req->cbfn) {
LOGP(DPAG, LOGL_DEBUG, "Stop paging on bts %d, calling cbfn.\n", bts->nr);
req->cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_SUCCEEDED,
NULL, lchan, req->cbfn_param);
NULL, conn, req->cbfn_param);
} else
LOGP(DPAG, LOGL_DEBUG, "Stop paging on bts %d silently.\n", bts->nr);
paging_remove_request(&bts->paging, req);
@ -298,12 +298,12 @@ static void _paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *sub
/* Stop paging on all other bts' */
void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr,
struct gsm_lchan *lchan)
struct gsm_subscriber_connection *conn)
{
struct gsm_bts *bts = NULL;
if (_bts)
_paging_request_stop(_bts, subscr, lchan);
_paging_request_stop(_bts, subscr, conn);
do {
/*

View File

@ -91,7 +91,7 @@ static int paging_sig_cb(unsigned int subsys, unsigned int signal,
switch (signal) {
case S_PAGING_SUCCEEDED:
/* A subscriber has attached. */
send_rrlp_req(&psig_data->lchan->conn);
send_rrlp_req(psig_data->conn);
break;
case S_PAGING_EXPIRED:
break;

View File

@ -36,10 +36,9 @@
/* paging of the requested subscriber has completed */
static int paging_cb_silent(unsigned int hooknum, unsigned int event,
struct msgb *msg, void *_lchan, void *_data)
struct msgb *msg, void *_conn, void *_data)
{
struct gsm_subscriber_connection *conn;
struct gsm_lchan *lchan = _lchan;
struct gsm_subscriber_connection *conn = _conn;
struct scall_signal_data sigdata;
int rc;
@ -48,15 +47,13 @@ static int paging_cb_silent(unsigned int hooknum, unsigned int event,
DEBUGP(DSMS, "paging_cb_silent: ");
conn = &lchan->conn;
sigdata.lchan = lchan;
sigdata.conn = conn;
sigdata.data = _data;
switch (event) {
case GSM_PAGING_SUCCEEDED:
DEBUGPC(DSMS, "success, using Timeslot %u on ARFCN %u\n",
lchan->ts->nr, lchan->ts->trx->arfcn);
conn->lchan->ts->nr, conn->lchan->ts->trx->arfcn);
conn->silent_call = 1;
/* increment lchan reference count */
dispatch_signal(SS_SCALL, S_SCALL_SUCCESS, &sigdata);

View File

@ -513,7 +513,7 @@ static int scall_cbfn(unsigned int subsys, unsigned int signal,
switch (signal) {
case S_SCALL_SUCCESS:
vty_out(vty, "%% silent call on ARFCN %u timeslot %u%s",
sigdata->lchan->ts->trx->arfcn, sigdata->lchan->ts->nr,
sigdata->conn->lchan->ts->trx->arfcn, sigdata->conn->lchan->ts->nr,
VTY_NEWLINE);
break;
case S_SCALL_EXPIRED: