This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
neels gerrit-no-reply at lists.osmocom.orgneels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/20349 ) Change subject: refactor paging: add bsc_subscr to bsc_paging_params ...................................................................... refactor paging: add bsc_subscr to bsc_paging_params Get a bsub once at start of paging. Change-Id: I13621cd51d934846ff6556e1f2f8839da73a5dbb --- M include/osmocom/bsc/paging.h M src/osmo-bsc/osmo_bsc_bssap.c M src/osmo-bsc/paging.c 3 files changed, 23 insertions(+), 28 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/49/20349/1 diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h index 1a342b8..88027f3 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, "Paging: msc%d %s TMSI-0x%08x: " fmt, \ + LOGP(SUBSYS, LEVEL, "Paging: msc%d %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_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 @@ }; /* 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 ad50122..2665a9b 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -117,7 +117,6 @@ 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 @@ return; } - subscr = bsc_subscr_find_or_create_by_mi(bsc_gsmnet->bsc_subscribers, ¶ms->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, ¶ms->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 @@ { 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 @@ 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 1869042..d026a20 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -325,7 +325,7 @@ * \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 @@ 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 @@ 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 @@ * \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 @@ 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; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20349 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I13621cd51d934846ff6556e1f2f8839da73a5dbb Gerrit-Change-Number: 20349 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr at sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201001/09ee3658/attachment.htm>