aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/paging.h8
-rw-r--r--src/osmo-bsc/osmo_bsc_bssap.c33
-rw-r--r--src/osmo-bsc/paging.c10
3 files changed, 23 insertions, 28 deletions
diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h
index cebdce393..cab54663b 100644
--- a/include/osmocom/bsc/paging.h
+++ b/include/osmocom/bsc/paging.h
@@ -33,10 +33,9 @@
struct bsc_msc_data;
#define LOG_PAGING(PARAMS, SUBSYS, LEVEL, fmt, args...) \
- LOGP(SUBSYS, LEVEL, "(msc%d) Paging: %s TMSI-0x%08x: " fmt, \
+ LOGP(SUBSYS, LEVEL, "(msc%d) Paging: %s: " fmt, \
(PARAMS)->msc ? (PARAMS)->msc->nr : -1, \
- osmo_mobile_identity_to_str_c(OTC_SELECT, &(PARAMS)->imsi), \
- (PARAMS)->tmsi, \
+ bsc_subscr_name((PARAMS)->bsub), \
##args)
#define LOG_PAGING_BTS(PARAMS, BTS, SUBSYS, LEVEL, fmt, args...) \
@@ -44,6 +43,7 @@ struct bsc_msc_data;
struct bsc_paging_params {
struct bsc_msc_data *msc;
+ struct bsc_subscr *bsub;
uint32_t tmsi;
struct osmo_mobile_identity imsi;
uint8_t chan_needed;
@@ -75,7 +75,7 @@ struct gsm_paging_request {
};
/* schedule paging request */
-int paging_request_bts(const struct bsc_paging_params *params, struct bsc_subscr *bsub, struct gsm_bts *bts);
+int paging_request_bts(const struct bsc_paging_params *params, struct gsm_bts *bts);
struct bsc_msc_data *paging_request_stop(struct gsm_bts *bts, struct bsc_subscr *bsub);
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index ad501222f..2665a9be4 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -117,7 +117,6 @@ static int bssmap_handle_reset(struct bsc_msc_data *msc,
static void
page_subscriber(const struct bsc_paging_params *params, struct gsm_bts *bts, uint32_t lac)
{
- struct bsc_subscr *subscr;
int ret;
if (!bsc_grace_allow_new_connection(bsc_gsmnet, bts)) {
@@ -125,29 +124,12 @@ page_subscriber(const struct bsc_paging_params *params, struct gsm_bts *bts, uin
return;
}
- subscr = bsc_subscr_find_or_create_by_mi(bsc_gsmnet->bsc_subscribers, &params->imsi);
-
- if (subscr)
- log_set_context(LOG_CTX_BSC_SUBSCR, subscr);
-
LOG_PAGING_BTS(params, bts, DMSC, LOGL_INFO, "Paging on LAC %u\n", lac);
- if (!subscr) {
- LOGP(DMSC, LOGL_ERROR, "Paging request failed: Could not allocate subscriber for %s\n",
- osmo_mobile_identity_to_str_c(OTC_SELECT, &params->imsi));
- return;
- }
-
- subscr->tmsi = params->tmsi;
- ret = paging_request_bts(params, subscr, bts);
+ ret = paging_request_bts(params, bts);
if (ret == 0)
LOG_PAGING_BTS(params, bts, DMSC, LOGL_INFO,
"Paging request failed, or repeated paging on LAC %u\n", lac);
-
- /* the paging code has grabbed its own references */
- bsc_subscr_put(subscr);
-
- log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
}
static void
@@ -363,6 +345,17 @@ int bsc_paging_start(struct bsc_paging_params *params)
{
rate_ctr_inc(&bsc_gsmnet->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED]);
+ if (!params->bsub) {
+ params->bsub = bsc_subscr_find_or_create_by_imsi(bsc_gsmnet->bsc_subscribers, params->imsi.imsi);
+ if (!params->bsub) {
+ LOG_PAGING(params, DMSC, LOGL_ERROR, "Paging request failed: Could not allocate subscriber\n");
+ return -EINVAL;
+ }
+ }
+ if (params->tmsi != GSM_RESERVED_TMSI)
+ params->bsub->tmsi = params->tmsi;
+ log_set_context(LOG_CTX_BSC_SUBSCR, params->bsub);
+
switch (params->cil.id_discr) {
case CELL_IDENT_NO_CELL:
page_all_bts(params);
@@ -400,6 +393,8 @@ int bsc_paging_start(struct bsc_paging_params *params)
break;
}
+ bsc_subscr_put(params->bsub);
+ log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
return 0;
}
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index 186904253..d026a2055 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -325,7 +325,7 @@ static unsigned int calculate_timer_3113(struct gsm_bts *bts)
* \param[in] type type of radio channel we're requirign
* \param[in] msc MSC which has issue this paging
* \returns 0 on success, negative on error */
-static int _paging_request(const struct bsc_paging_params *params, struct bsc_subscr *bsub, struct gsm_bts *bts)
+static int _paging_request(const struct bsc_paging_params *params, struct gsm_bts *bts)
{
struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req;
@@ -333,7 +333,7 @@ static int _paging_request(const struct bsc_paging_params *params, struct bsc_su
rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_PAGING_ATTEMPTED]);
- if (paging_pending_request(bts_entry, bsub)) {
+ if (paging_pending_request(bts_entry, params->bsub)) {
LOG_PAGING_BTS(params, bts, DPAG, LOGL_INFO, "Paging request already pending for this subscriber\n");
rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_PAGING_ALREADY]);
return -EEXIST;
@@ -342,7 +342,7 @@ static int _paging_request(const struct bsc_paging_params *params, struct bsc_su
LOG_PAGING_BTS(params, bts, DPAG, LOGL_DEBUG, "Start paging\n");
req = talloc_zero(tall_paging_ctx, struct gsm_paging_request);
OSMO_ASSERT(req);
- req->bsub = bsc_subscr_get(bsub);
+ req->bsub = bsc_subscr_get(params->bsub);
req->bts = bts;
req->chan_type = params->chan_needed;
req->msc = params->msc;
@@ -361,7 +361,7 @@ static int _paging_request(const struct bsc_paging_params *params, struct bsc_su
* \param[in] type type of radio channel we're requirign
* \param[in] msc MSC which has issue this paging
* returns 1 on success; 0 in case of error (e.g. TRX down) */
-int paging_request_bts(const struct bsc_paging_params *params, struct bsc_subscr *bsub, struct gsm_bts *bts)
+int paging_request_bts(const struct bsc_paging_params *params, struct gsm_bts *bts)
{
int rc;
@@ -373,7 +373,7 @@ int paging_request_bts(const struct bsc_paging_params *params, struct bsc_subscr
paging_init_if_needed(bts);
/* Trigger paging, pass any error to the caller */
- rc = _paging_request(params, bsub, bts);
+ rc = _paging_request(params, bts);
if (rc < 0)
return 0;
return 1;