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/.
Stefan Sperling gerrit-no-reply at lists.osmocom.orgHello Neels Hofmeyr, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/5752 to look at the new patch set (#4). Move BTS selection for paging from osmo_bsc_grace.c into osmo_bsc_bssap.c. We can now either page an invidual BTS directly or page several BTS in a given location area. This decision is taken based on the contents of the cell identifier list in the paging request. Select a set of BTS for paging while processing the cell identifier list, rather than requiring the paging layer to loop over all BTS in the MSC. This change requires some adjustment in bssap_test. In particular, this test must now add a BTS to its network in order to pass. The purpose of this change is to make the layering a bit cleaner. There is one functional change: We no longer abort paging if paging fails for a particular BTS. Instead, we keep trying to page on other BTS. Change-Id: Ic1c72c7f83e53988eb9fedf314b1dc459836833d Suggested-by: Harald Welte Depends: Ic7772e75c3d7fb0df6e17e118bb33b3248352d4d Related: OS#2753 --- M include/osmocom/bsc/paging.h M src/osmo-bsc/osmo_bsc_bssap.c M src/osmo-bsc/osmo_bsc_grace.c M tests/bssap/bssap_test.c M tests/bssap/bssap_test.err 5 files changed, 51 insertions(+), 73 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/52/5752/4 diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h index 2b1bc50..2be71c3 100644 --- a/include/osmocom/bsc/paging.h +++ b/include/osmocom/bsc/paging.h @@ -56,8 +56,6 @@ }; /* schedule paging request */ -int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, int type, - struct bsc_msc_data *msc); int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, int type, struct bsc_msc_data *msc); diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index a02ea9e..ef3cc42 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -228,14 +228,16 @@ return 0; } -/* Page a subscriber based on TMSI and LAC in the specified MSC. - * If BTS is not NULL, page the subscriber via this particular BTS. - * A non-zero return value indicates a fatal out of memory condition. */ +/* Page a subscriber based on TMSI and LAC via the specified BTS. + * The msc parameter is the MSC which issued the corresponding paging request. + * Returns 1 if the paging request could be issued, 0 if not. + * A negative return value indicates an error. */ static int page_subscriber(struct bsc_msc_data *msc, struct gsm_bts *bts, uint32_t tmsi, uint32_t lac, const char *mi_string, uint8_t chan_needed) { struct bsc_subscr *subscr; + int ret; subscr = bsc_subscr_find_or_create_by_imsi(msc->network->bsc_subscribers, mi_string); @@ -247,19 +249,15 @@ subscr->lac = lac; subscr->tmsi = tmsi; - if (bts) - LOGP(DMSC, LOGL_INFO, "Paging request from MSC BTS: %d IMSI: '%s' TMSI: '0x%x/%u' LAC: 0x%x\n", - bts->nr, mi_string, tmsi, tmsi, lac); - else - LOGP(DMSC, LOGL_INFO, "Paging request from MSC IMSI: '%s' TMSI: '0x%x/%u' LAC: 0x%x\n", mi_string, tmsi, tmsi, lac); + LOGP(DMSC, LOGL_INFO, "Paging request from MSC BTS: %d IMSI: '%s' TMSI: '0x%x/%u' LAC: 0x%x\n", + bts->nr, mi_string, tmsi, tmsi, lac); - bsc_grace_paging_request(msc->network->bsc_data->rf_ctrl->policy, - subscr, chan_needed, msc, bts); + ret = bsc_grace_paging_request(msc->network->bsc_data->rf_ctrl->policy, subscr, chan_needed, msc, bts); /* the paging code has grabbed its own references */ bsc_subscr_put(subscr); - return 0; + return ret; } /* GSM 08.08 § 3.2.1.19 */ @@ -277,6 +275,7 @@ const uint8_t *data; uint8_t chan_needed = RSL_CHANNEED_ANY; uint8_t cell_ident; + struct gsm_bts *bts; tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l4h + 1, payload_length - 1, 0, 0); remain = payload_length - 1; @@ -353,7 +352,6 @@ uint16_t *ci_be = (uint16_t *)(&data[1]); while (remain >= sizeof(*ci_be)) { uint16_t ci = osmo_load16be(ci_be); - struct gsm_bts *bts; llist_for_each_entry(bts, &msc->network->bts_list, list) { if (bts->cell_identity == ci) @@ -361,11 +359,12 @@ } if (bts) { - if (page_subscriber(msc, bts, tmsi, lac, mi_string, chan_needed) != 0) - break; + /* ignore errors from page_subscriber(); keep trying other BTS */ + page_subscriber(msc, bts, tmsi, lac, mi_string, chan_needed); } else LOGP(DMSC, LOGL_ERROR, "Paging IMSI %s: BTS with cell identifier %d not found\n", mi_string, ci); + remain -= sizeof(*ci_be); ci_be++; } @@ -387,13 +386,16 @@ break; } if (mcc == msc->network->country_code && mnc == msc->network->network_code) { - if (page_subscriber(msc, NULL, tmsi, lac, mi_string, chan_needed) != 0) - break; + llist_for_each_entry(bts, &msc->network->bts_list, list) { + if (bts->location_area_code != lac) + continue; + /* ignore errors from page_subscriber(); keep trying other BTS */ + page_subscriber(msc, bts, tmsi, lac, mi_string, chan_needed); + } } else LOGP(DMSC, LOGL_DEBUG, "Not paging IMSI %s: MCC/MNC in Cell Identifier List " "(%d/%d) do not match our network (%d/%d)\n", mi_string, mcc, mnc, msc->network->country_code, msc->network->network_code); - remain -= sizeof(lai); i++; } @@ -404,8 +406,12 @@ lacp_be = (uint16_t *)(&data[1]); while (remain >= sizeof(*lacp_be)) { lac = osmo_load16be(lacp_be); - if (page_subscriber(msc, NULL, tmsi, lac, mi_string, chan_needed) != 0) - break; + llist_for_each_entry(bts, &msc->network->bts_list, list) { + if (bts->location_area_code != lac) + continue; + /* ignore errors from page_subscriber(); keep trying other BTS */ + page_subscriber(msc, bts, tmsi, lac, mi_string, chan_needed); + } remain -= sizeof(*lacp_be); lacp_be++; } @@ -417,16 +423,20 @@ " has invalid length: %u, paging entire BSS anyway (%s)\n", mi_string, CELL_IDENT_BSS, data_length, osmo_hexdump(data, data_length)); } - if (page_subscriber(msc, NULL, tmsi, GSM_LAC_RESERVED_ALL_BTS, mi_string, chan_needed) != 0) - break; + llist_for_each_entry(bts, &msc->network->bts_list, list) { + /* ignore errors from page_subscriber(); try all BTS */ + page_subscriber(msc, bts, tmsi, GSM_LAC_RESERVED_ALL_BTS, mi_string, chan_needed); + } break; default: LOGP(DMSC, LOGL_NOTICE, "Paging IMSI %s: unimplemented Cell Identifier List (0x%x)," " paging entire BSS instead (%s)\n", mi_string, cell_ident, osmo_hexdump(data, data_length)); - if (page_subscriber(msc, NULL, tmsi, GSM_LAC_RESERVED_ALL_BTS, mi_string, chan_needed) != 0) - break; + llist_for_each_entry(bts, &msc->network->bts_list, list) { + /* ignore errors from page_subscriber(); try all BTS */ + page_subscriber(msc, bts, tmsi, GSM_LAC_RESERVED_ALL_BTS, mi_string, chan_needed); + } break; } diff --git a/src/osmo-bsc/osmo_bsc_grace.c b/src/osmo-bsc/osmo_bsc_grace.c index 93ca9b9..705933c 100644 --- a/src/osmo-bsc/osmo_bsc_grace.c +++ b/src/osmo-bsc/osmo_bsc_grace.c @@ -34,22 +34,6 @@ } -static int normal_paging(struct bsc_subscr *subscr, int chan_needed, - struct bsc_msc_data *msc) -{ - /* we can't page by lac.. we need to page everything */ - if (msc->core_lac != -1) { - struct gsm_bts *bts; - - llist_for_each_entry(bts, &msc->network->bts_list, list) - paging_request_bts(bts, subscr, chan_needed, msc); - - return 0; - } - - return paging_request(msc->network, subscr, chan_needed, msc); -} - /* Return value is like paging_request_bts(): * returns 1 on success (one BTS was paged); 0 in case of error (e.g. TRX down) */ static int locked_paging_bts(struct gsm_bts *bts, @@ -68,31 +52,14 @@ return paging_request_bts(bts, subscr, chan_needed, msc); } -static int locked_paging(struct bsc_subscr *subscr, int chan_needed, - struct bsc_msc_data *msc) -{ - struct gsm_bts *bts = NULL; - int num_pages = 0; - - /* - * Check if there is any BTS that is on for the given lac. Start - * with NULL and iterate through all bts. - * All other bts are either off or in the grace period. - */ - llist_for_each_entry(bts, &msc->network->bts_list, list) - num_pages += locked_paging_bts(bts, subscr, chan_needed, msc); - - return num_pages; -} - /** * Page a subscriber in an MSC. * \param[in] rf_policy if not S_RF_ON, page only BTSs which are not excluded from the RF lock * \param[in] subscr subscriber we want to page * \param[in] chan_needed value of the GSM0808_IE_CHANNEL_NEEDED IE * \param[in] msc MSC which has issued this paging - * \param[in] bts if not NULL, page via this particular BTS - * \returns number of BTS on which we issued the paging + * \param[in] bts The BTS to issue the paging on + * \returns 1 if paging was issued to the BTS, 0 if not */ int bsc_grace_paging_request(enum signal_rf rf_policy, struct bsc_subscr *subscr, @@ -100,15 +67,9 @@ struct bsc_msc_data *msc, struct gsm_bts *bts) { - if (bts) { - if (rf_policy == S_RF_ON) - return paging_request_bts(bts, subscr, chan_needed, msc); - return locked_paging_bts(bts, subscr, chan_needed, msc); - } - if (rf_policy == S_RF_ON) - return normal_paging(subscr, chan_needed, msc); - return locked_paging(subscr, chan_needed, msc); + return paging_request_bts(bts, subscr, chan_needed, msc); + return locked_paging_bts(bts, subscr, chan_needed, msc); } static int handle_sub(struct gsm_lchan *lchan, const char *text) diff --git a/tests/bssap/bssap_test.c b/tests/bssap/bssap_test.c index c97393d..1d8fe77 100644 --- a/tests/bssap/bssap_test.c +++ b/tests/bssap/bssap_test.c @@ -24,6 +24,7 @@ #include <osmocom/bsc/signal.h> #include <osmocom/bsc/bsc_subscriber.h> #include <osmocom/bsc/bsc_msc_data.h> +#include <osmocom/bsc/gsm_data_shared.h> #include <osmocom/bsc/common_bsc.h> #include <osmocom/bsc/osmo_bsc_rf.h> @@ -41,9 +42,9 @@ /* override, requires '-Wl,--wrap=bsc_grace_paging_request' */ int __real_bsc_grace_paging_request(enum signal_rf rf_policy, struct bsc_subscr *subscr, int chan_needed, - struct bsc_msc_data *msc); + struct bsc_msc_data *msc, struct gsm_bts *bts); int __wrap_bsc_grace_paging_request(enum signal_rf rf_policy, struct bsc_subscr *subscr, int chan_needed, - struct bsc_msc_data *msc) + struct bsc_msc_data *msc, struct gsm_bts *bts) { if (subscr->lac == GSM_LAC_RESERVED_ALL_BTS) fprintf(stderr, "BSC paging started on entire BSS (%u)\n", subscr->lac); @@ -86,6 +87,7 @@ int rc; struct gsm_network *net; struct bsc_msc_data *msc; + struct gsm_bts *bts; net = bsc_network_init(NULL, 1, 1); net->bsc_data->rf_ctrl = talloc_zero(NULL, struct osmo_bsc_rf); @@ -93,6 +95,12 @@ msc = talloc_zero(net, struct bsc_msc_data); msc->network = net; + + bts = gsm_bts_alloc_register(net, GSM_BTS_TYPE_UNKNOWN, 0); + if (bts == NULL) { + fprintf(stderr, "gsm_bts_alloc_register() returned NULL\n"); + return; + } log_set_log_level(osmo_stderr_target, LOGL_DEBUG); @@ -102,6 +110,7 @@ msg = msgb_from_hex("test_cell_identifier", 1024, cell_identifier_tests[i].msg); gl_expect_lac = cell_identifier_tests[i].expect_lac; + bts->location_area_code = (gl_expect_lac == GSM_LAC_RESERVED_ALL_BTS ? 0 : gl_expect_lac); rc = bsc_handle_udt(msc, msg, msgb_l2len(msg)); fprintf(stderr, "bsc_handle_udt() returned %d\n", rc); diff --git a/tests/bssap/bssap_test.err b/tests/bssap/bssap_test.err index f24ff7c..abe1def 100644 --- a/tests/bssap/bssap_test.err +++ b/tests/bssap/bssap_test.err @@ -2,14 +2,14 @@ 0: DMSC Rx MSC UDT: 00 16 52 08 08 59 51 20 69 00 07 43 94 09 04 01 08 44 60 1a 03 05 00 65 DMSC Rx MSC UDT BSSMAP PAGING -DMSC Paging request from MSC IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0x65 +DMSC Paging request from MSC BTS: 0 IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0x65 BSC paging started with LAC 101 bsc_handle_udt() returned 0 1: DMSC Rx MSC UDT: 00 14 52 08 08 59 51 20 69 00 07 43 94 09 04 01 08 44 60 1a 01 06 DMSC Rx MSC UDT BSSMAP PAGING -DMSC Paging request from MSC IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0xfffe +DMSC Paging request from MSC BTS: 0 IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0xfffe BSC paging started on entire BSS (65534) bsc_handle_udt() returned 0 @@ -22,6 +22,6 @@ 3: DMSC Rx MSC UDT: 00 19 52 08 08 59 51 20 69 00 07 43 94 09 04 01 08 44 60 1a 06 04 00 f1 10 00 65 DMSC Rx MSC UDT BSSMAP PAGING -DMSC Paging request from MSC IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0x65 +DMSC Paging request from MSC BTS: 0 IMSI: '515029600703449' TMSI: '0x1084460/17319008' LAC: 0x65 BSC paging started with LAC 101 bsc_handle_udt() returned 0 -- To view, visit https://gerrit.osmocom.org/5752 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic1c72c7f83e53988eb9fedf314b1dc459836833d Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>