LCS: add paging reason, return in paging_request_stop()

To distinguish between the CN requiring a Complete Layer 3 response, or just
the BSC requiring a TA, allow recording a separate for-LCS paging reason.

Change-Id: Ib28d1599ae4e483727398859d07de4490fbc31f0
This commit is contained in:
Neels Hofmeyr 2020-09-18 02:49:21 +02:00
parent 4c5fd38b3b
commit d4946b22f7
4 changed files with 63 additions and 28 deletions

View File

@ -33,15 +33,25 @@
struct bsc_msc_data; struct bsc_msc_data;
#define LOG_PAGING(PARAMS, SUBSYS, LEVEL, fmt, args...) \ #define LOG_PAGING(PARAMS, SUBSYS, LEVEL, fmt, args...) \
LOGP(SUBSYS, LEVEL, "(msc%d) Paging: %s: " fmt, \ LOGP(SUBSYS, LEVEL, "(msc%d) Paging%s: %s: " fmt, \
(PARAMS)->msc ? (PARAMS)->msc->nr : -1, \ (PARAMS)->msc ? (PARAMS)->msc->nr : -1, \
(PARAMS)->reason == BSC_PAGING_FOR_LCS ? " for LCS" : "", \
bsc_subscr_name((PARAMS)->bsub), \ bsc_subscr_name((PARAMS)->bsub), \
##args) ##args)
#define LOG_PAGING_BTS(PARAMS, BTS, SUBSYS, LEVEL, fmt, args...) \ #define LOG_PAGING_BTS(PARAMS, BTS, SUBSYS, LEVEL, fmt, args...) \
LOG_PAGING(PARAMS, SUBSYS, LEVEL, "(bts%u) " fmt, (BTS) ? (BTS)->nr : 255, ##args) LOG_PAGING(PARAMS, SUBSYS, LEVEL, "(bts%u) " fmt, (BTS) ? (BTS)->nr : 255, ##args)
/* Bitmask of reasons for Paging. Each individual Paging via bsc_paging_start() typically has only one of these reasons
* set, but when a subscriber responds, we need to aggregate all pending Paging reasons (by bitwise-OR). */
enum bsc_paging_reason {
BSC_PAGING_NONE = 0,
BSC_PAGING_FROM_CN = 0x1,
BSC_PAGING_FOR_LCS = 0x2,
};
struct bsc_paging_params { struct bsc_paging_params {
enum bsc_paging_reason reason;
struct bsc_msc_data *msc; struct bsc_msc_data *msc;
struct bsc_subscr *bsub; struct bsc_subscr *bsub;
uint32_t tmsi; uint32_t tmsi;
@ -72,12 +82,15 @@ struct gsm_paging_request {
/* MSC that has issued this paging */ /* MSC that has issued this paging */
struct bsc_msc_data *msc; struct bsc_msc_data *msc;
enum bsc_paging_reason reason;
}; };
/* schedule paging request */ /* schedule paging request */
int paging_request_bts(const struct bsc_paging_params *params, 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); int paging_request_stop(struct bsc_msc_data **msc_p, enum bsc_paging_reason *reasons_p,
struct gsm_bts *bts, struct bsc_subscr *bsub);
/* update paging load */ /* update paging load */
void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);

View File

@ -366,6 +366,7 @@ int bsc_compl_l3(struct gsm_lchan *lchan, struct msgb *msg, uint16_t chosen_chan
struct gsm_subscriber_connection *conn; struct gsm_subscriber_connection *conn;
struct bsc_subscr *bsub = NULL; struct bsc_subscr *bsub = NULL;
struct bsc_msc_data *paged_from_msc; struct bsc_msc_data *paged_from_msc;
enum bsc_paging_reason paging_reasons;
struct bsc_msc_data *msc; struct bsc_msc_data *msc;
struct msgb *create_l3; struct msgb *create_l3;
struct gsm0808_speech_codec_list scl; struct gsm0808_speech_codec_list scl;
@ -424,8 +425,9 @@ int bsc_compl_l3(struct gsm_lchan *lchan, struct msgb *msg, uint16_t chosen_chan
/* When receiving a Paging Response, stop Paging for this subscriber on all cells, and figure out which MSC /* When receiving a Paging Response, stop Paging for this subscriber on all cells, and figure out which MSC
* sent the Paging Request, if any. */ * sent the Paging Request, if any. */
paged_from_msc = NULL; paged_from_msc = NULL;
paging_reasons = BSC_PAGING_NONE;
if (pdisc == GSM48_PDISC_RR && mtype == GSM48_MT_RR_PAG_RESP) { if (pdisc == GSM48_PDISC_RR && mtype == GSM48_MT_RR_PAG_RESP) {
paged_from_msc = paging_request_stop(bts, conn->bsub); paging_request_stop(&paged_from_msc, &paging_reasons, bts, conn->bsub);
if (!paged_from_msc) { if (!paged_from_msc) {
/* This looks like an unsolicited Paging Response. It is required to pick any MSC, because any /* This looks like an unsolicited Paging Response. It is required to pick any MSC, because any
* MT-CSFB calls were Paged by the MSC via SGs, and hence are not listed in the BSC. */ * MT-CSFB calls were Paged by the MSC via SGs, and hence are not listed in the BSC. */

View File

@ -272,6 +272,7 @@ static int bssmap_handle_paging(struct bsc_msc_data *msc,
int remain; int remain;
const uint8_t *data; const uint8_t *data;
struct bsc_paging_params paging = { struct bsc_paging_params paging = {
.reason = BSC_PAGING_FROM_CN,
.msc = msc, .msc = msc,
.tmsi = GSM_RESERVED_TMSI, .tmsi = GSM_RESERVED_TMSI,
}; };

View File

@ -342,6 +342,7 @@ static int _paging_request(const struct bsc_paging_params *params, struct gsm_bt
LOG_PAGING_BTS(params, bts, DPAG, LOGL_DEBUG, "Start paging\n"); LOG_PAGING_BTS(params, bts, DPAG, LOGL_DEBUG, "Start paging\n");
req = talloc_zero(tall_paging_ctx, struct gsm_paging_request); req = talloc_zero(tall_paging_ctx, struct gsm_paging_request);
OSMO_ASSERT(req); OSMO_ASSERT(req);
req->reason = params->reason;
req->bsub = bsc_subscr_get(params->bsub); req->bsub = bsc_subscr_get(params->bsub);
req->bts = bts; req->bts = bts;
req->chan_type = params->chan_needed; req->chan_type = params->chan_needed;
@ -380,61 +381,79 @@ int paging_request_bts(const struct bsc_paging_params *params, struct gsm_bts *b
} }
/*! Stop paging a given subscriber on a given BTS. /*! Stop paging a given subscriber on a given BTS.
* If \a conn is non-NULL, we also call the paging call-back function * \param[out] returns the MSC that paged the subscriber, if any.
* to notify the paging originator that paging has completed. * \param[out] returns the reason for a pending paging, if any.
* \param[in] bts BTS on which we shall stop paging * \param[in] bts BTS which has received a paging response.
* \param[in] bsub subscriber which we shall stop paging * \param[in] bsub subscriber.
* \returns the MSC that paged the subscriber, if there was a pending request. * \returns number of pending pagings.
*/ */
static struct bsc_msc_data *paging_request_stop_bts(struct gsm_bts *bts, struct bsc_subscr *bsub) static int paging_request_stop_bts(struct bsc_msc_data **msc_p, enum bsc_paging_reason *reason_p,
struct gsm_bts *bts, struct bsc_subscr *bsub)
{ {
struct gsm_bts_paging_state *bts_entry = &bts->paging; struct gsm_bts_paging_state *bts_entry = &bts->paging;
struct gsm_paging_request *req, *req2; struct gsm_paging_request *req, *req2;
*msc_p = NULL;
*reason_p = BSC_PAGING_NONE;
paging_init_if_needed(bts); paging_init_if_needed(bts);
llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests, llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests,
entry) { entry) {
if (req->bsub == bsub) { if (req->bsub != bsub)
struct bsc_msc_data *from_msc = req->msc; continue;
/* now give up the data structure */ *msc_p = req->msc;
paging_remove_request(&bts->paging, req); *reason_p = req->reason;
LOG_BTS(bts, DPAG, LOGL_DEBUG, "Stop paging %s\n", bsc_subscr_name(bsub)); LOG_BTS(bts, DPAG, LOGL_DEBUG, "Stop paging %s\n", bsc_subscr_name(bsub));
return from_msc; paging_remove_request(&bts->paging, req);
} return 1;
} }
return NULL; return 0;
} }
/*! Stop paging on all other bts' /*! Stop paging on all cells and return the MSC that paged (if any) and all pending paging reasons.
* \param[out] returns the MSC that paged the subscriber, if there was a pending request.
* \param[out] returns the ORed bitmask of all reasons of pending pagings.
* \param[in] bts BTS which has received a paging response * \param[in] bts BTS which has received a paging response
* \param[in] bsub subscriber * \param[in] bsub subscriber
* \returns the MSC that paged the subscriber, if there was a pending request. * \returns number of pending pagings.
*/ */
struct bsc_msc_data *paging_request_stop(struct gsm_bts *bts, struct bsc_subscr *bsub) int paging_request_stop(struct bsc_msc_data **msc_p, enum bsc_paging_reason *reasons_p,
struct gsm_bts *bts, struct bsc_subscr *bsub)
{ {
struct gsm_bts *bts_i; struct gsm_bts *bts_i;
struct bsc_msc_data *paged_from_msc; struct bsc_msc_data *paged_from_msc;
int count;
enum bsc_paging_reason reasons;
OSMO_ASSERT(bts); OSMO_ASSERT(bts);
paged_from_msc = paging_request_stop_bts(bts, bsub); count = paging_request_stop_bts(&paged_from_msc, &reasons, bts, bsub);
if (paged_from_msc) { if (paged_from_msc) {
count++;
rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_PAGING_RESPONDED]); rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_PAGING_RESPONDED]);
rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_RESPONDED]); rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_RESPONDED]);
} }
llist_for_each_entry(bts_i, &bsc_gsmnet->bts_list, list) { llist_for_each_entry(bts_i, &bsc_gsmnet->bts_list, list) {
struct bsc_msc_data *paged_from_msc2 = paging_request_stop_bts(bts_i, bsub); struct bsc_msc_data *paged_from_msc2;
if (!paged_from_msc && paged_from_msc2) { enum bsc_paging_reason reason2;
count += paging_request_stop_bts(&paged_from_msc2, &reason2, bts_i, bsub);
if (paged_from_msc2) {
reasons |= reason2;
if (!paged_from_msc) {
/* If this happened, it would be a bit weird: it means there was no Paging Request /* If this happened, it would be a bit weird: it means there was no Paging Request
* pending on the BTS that sent the Paging Reponse, but there *is* a Paging Request * pending on the BTS that sent the Paging Reponse, but there *is* a Paging Request
* pending on a different BTS. But why not return an MSC when we found one. */ * pending on a different BTS. But why not return an MSC when we found one. */
paged_from_msc = paged_from_msc2; paged_from_msc = paged_from_msc2;
} }
} }
}
return paged_from_msc; *msc_p = paged_from_msc;
*reasons_p = reasons;
return count;
} }
/*! Update the BTS paging buffer slots on given BTS */ /*! Update the BTS paging buffer slots on given BTS */