lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

March 2023

  • 1 participants
  • 3642 discussions
[M] Change in libosmocore[master]: New osmo-gsmtap-logsend utility
by laforge 15 Mar '23

15 Mar '23
Attention is currently required from: neels, fixeria, keith. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31916 ) Change subject: New osmo-gsmtap-logsend utility ...................................................................... Patch Set 6: (2 comments) Patchset: PS4: > Please also update `.gitignore`. Done File utils/gsmtap-logsend.c: https://gerrit.osmocom.org/c/libosmocore/+/31916/comment/ceced9e4_3158b63b PS2, Line 18: #include <string.h> : #include <stdlib.h> : #include <string.h> : #include <fcntl.h> > tested that, and removed them. Done -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31916 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ida96e87d84e0c349c5069edc67fec1c3cf19d1ab Gerrit-Change-Number: 31916 Gerrit-PatchSet: 6 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith <keith(a)rhizomatica.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: keith <keith(a)rhizomatica.org> Gerrit-Comment-Date: Wed, 15 Mar 2023 09:44:44 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: keith <keith(a)rhizomatica.org> Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmocore[master]: New osmo-gsmtap-logsend utility
by laforge 15 Mar '23

15 Mar '23
Attention is currently required from: neels, laforge, keith. Hello Jenkins Builder, neels, keith, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/31916 to look at the new patch set (#6). Change subject: New osmo-gsmtap-logsend utility ...................................................................... New osmo-gsmtap-logsend utility This utility can be used to "pipe" stdin or some file as log lines via GSMTAP logging. Change-Id: Ida96e87d84e0c349c5069edc67fec1c3cf19d1ab --- M .gitignore M debian/libosmocore-utils.install M utils/Makefile.am A utils/gsmtap-logsend.c 4 files changed, 156 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/16/31916/6 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31916 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ida96e87d84e0c349c5069edc67fec1c3cf19d1ab Gerrit-Change-Number: 31916 Gerrit-PatchSet: 6 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith <keith(a)rhizomatica.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: keith <keith(a)rhizomatica.org> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in osmo-bsc[master]: bsc_subscriber: Mark functions used only internally as static
by pespin 15 Mar '23

15 Mar '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31870 ) Change subject: bsc_subscriber: Mark functions used only internally as static ...................................................................... bsc_subscriber: Mark functions used only internally as static Change-Id: I846af993905aee0be75aa3021460b130362c6d3d --- M include/osmocom/bsc/bsc_subscriber.h M src/osmo-bsc/bsc_subscriber.c 2 files changed, 18 insertions(+), 18 deletions(-) Approvals: laforge: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/bsc/bsc_subscriber.h b/include/osmocom/bsc/bsc_subscriber.h index da2115f..a86ea5f 100644 --- a/include/osmocom/bsc/bsc_subscriber.h +++ b/include/osmocom/bsc/bsc_subscriber.h @@ -31,9 +31,6 @@ struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, const char *imsi, const char *use_token); -struct bsc_subscr *bsc_subscr_find_or_create_by_imei(struct llist_head *list, - const char *imei, - const char *use_token); struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list, uint32_t tmsi, const char *use_token); @@ -43,12 +40,6 @@ struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list, const char *imsi, const char *use_token); -struct bsc_subscr *bsc_subscr_find_by_imei(struct llist_head *list, - const char *imei, - const char *use_token); -struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, - uint32_t tmsi, - const char *use_token); void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi); void bsc_subscr_set_imei(struct bsc_subscr *bsub, const char *imei); diff --git a/src/osmo-bsc/bsc_subscriber.c b/src/osmo-bsc/bsc_subscriber.c index 31dfc05..6815ab5 100644 --- a/src/osmo-bsc/bsc_subscriber.c +++ b/src/osmo-bsc/bsc_subscriber.c @@ -103,9 +103,9 @@ return NULL; } -struct bsc_subscr *bsc_subscr_find_by_imei(struct llist_head *list, - const char *imei, - const char *use_token) +static struct bsc_subscr *bsc_subscr_find_by_imei(struct llist_head *list, + const char *imei, + const char *use_token) { struct bsc_subscr *bsub; @@ -121,9 +121,9 @@ return NULL; } -struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, - uint32_t tmsi, - const char *use_token) +static struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, + uint32_t tmsi, + const char *use_token) { struct bsc_subscr *bsub; @@ -169,9 +169,9 @@ return bsub; } -struct bsc_subscr *bsc_subscr_find_or_create_by_imei(struct llist_head *list, - const char *imei, - const char *use_token) +static struct bsc_subscr *bsc_subscr_find_or_create_by_imei(struct llist_head *list, + const char *imei, + const char *use_token) { struct bsc_subscr *bsub; bsub = bsc_subscr_find_by_imei(list, imei, use_token); -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31870 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I846af993905aee0be75aa3021460b130362c6d3d Gerrit-Change-Number: 31870 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-bsc[master]: bsc_subscriber: Introduce bsc_subscriber_store object
by pespin 15 Mar '23

15 Mar '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31874 ) Change subject: bsc_subscriber: Introduce bsc_subscriber_store object ...................................................................... bsc_subscriber: Introduce bsc_subscriber_store object This allows keeping the bsc_subscriber storage internals outside of main gsm_network code, while easily allowing making the internal implementation more complex (in order to optimize it in a follow-up commit). It is also nice since we get rid of uncommon procedures being used in this code, like allocating an llist directly as a talloc context, etc. Change-Id: I616e8872af4ac63a6985f8900909e324ba889192 --- M include/osmocom/bsc/bsc_subscriber.h M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_subscriber.c M src/osmo-bsc/bsc_vty.c M src/osmo-bsc/net_init.c M tests/subscr/bsc_subscr_test.c M tests/subscr/bsc_subscr_test.ok 7 files changed, 87 insertions(+), 57 deletions(-) Approvals: laforge: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/bsc/bsc_subscriber.h b/include/osmocom/bsc/bsc_subscriber.h index a86ea5f..7ec457b 100644 --- a/include/osmocom/bsc/bsc_subscriber.h +++ b/include/osmocom/bsc/bsc_subscriber.h @@ -12,8 +12,15 @@ struct log_target; struct gsm_bts; +struct bsc_subscr_store { + struct llist_head bsub_list; /* list containing "struct bsc_subscr" */ +}; + +struct bsc_subscr_store *bsc_subscr_store_alloc(void *ctx); + struct bsc_subscr { - struct llist_head entry; + struct bsc_subscr_store *store; /* backpointer to "struct bsc_subscr_store" */ + struct llist_head entry; /* entry in (struct bsc_subscr_store)->bsub_list */ struct osmo_use_count use_count; char imsi[GSM23003_IMSI_MAX_DIGITS+1]; @@ -28,16 +35,17 @@ const char *bsc_subscr_name(struct bsc_subscr *bsub); const char *bsc_subscr_id(struct bsc_subscr *bsub); -struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, +struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct bsc_subscr_store *bsubst, const char *imsi, const char *use_token); -struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list, +struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct bsc_subscr_store *bsubst, uint32_t tmsi, const char *use_token); -struct bsc_subscr *bsc_subscr_find_or_create_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi, +struct bsc_subscr *bsc_subscr_find_or_create_by_mi(struct bsc_subscr_store *bsubst, + const struct osmo_mobile_identity *mi, const char *use_token); -struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list, +struct bsc_subscr *bsc_subscr_find_by_imsi(struct bsc_subscr_store *bsubst, const char *imsi, const char *use_token); diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 0c5b485..dc7ee3f 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -954,13 +954,8 @@ * OsmoMSC, this should be tied to the location area code (LAC). */ struct gsm_tz tz; - /* List of all struct bsc_subscr used in libbsc. This llist_head is - * allocated so that the llist_head pointer itself can serve as a - * talloc context (useful to not have to pass the entire gsm_network - * struct to the bsc_subscr_* API, and for bsc_susbscr unit tests to - * not require gsm_data.h). In an MSC-without-BSC environment, this - * pointer is NULL to indicate absence of a bsc_subscribers list. */ - struct llist_head *bsc_subscribers; + /* Keeps track of struct bsc_subcr. */ + struct bsc_subscr_store *bsc_subscribers; /* Timer for periodic channel load measurements to maintain each BTS's T3122. */ struct osmo_timer_list t3122_chan_load_timer; diff --git a/src/osmo-bsc/bsc_subscriber.c b/src/osmo-bsc/bsc_subscriber.c index 6815ab5..65c5c87 100644 --- a/src/osmo-bsc/bsc_subscriber.c +++ b/src/osmo-bsc/bsc_subscriber.c @@ -65,14 +65,27 @@ return 0; } -static struct bsc_subscr *bsc_subscr_alloc(struct llist_head *list) +struct bsc_subscr_store *bsc_subscr_store_alloc(void *ctx) +{ + struct bsc_subscr_store *bsubst; + + bsubst = talloc_zero(ctx, struct bsc_subscr_store); + if (!bsubst) + return NULL; + + INIT_LLIST_HEAD(&bsubst->bsub_list); + return bsubst; +} + +static struct bsc_subscr *bsc_subscr_alloc(struct bsc_subscr_store *bsubst) { struct bsc_subscr *bsub; - bsub = talloc_zero(list, struct bsc_subscr); + bsub = talloc_zero(bsubst, struct bsc_subscr); if (!bsub) return NULL; + bsub->store = bsubst; bsub->tmsi = GSM_RESERVED_TMSI; bsub->use_count = (struct osmo_use_count){ .talloc_object = bsub, @@ -80,12 +93,12 @@ }; INIT_LLIST_HEAD(&bsub->active_paging_requests); - llist_add_tail(&bsub->entry, list); + llist_add_tail(&bsub->entry, &bsubst->bsub_list); return bsub; } -struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list, +struct bsc_subscr *bsc_subscr_find_by_imsi(struct bsc_subscr_store *bsubst, const char *imsi, const char *use_token) { @@ -94,7 +107,7 @@ if (!imsi || !*imsi) return NULL; - llist_for_each_entry(bsub, list, entry) { + llist_for_each_entry(bsub, &bsubst->bsub_list, entry) { if (!strcmp(bsub->imsi, imsi)) { bsc_subscr_get(bsub, use_token); return bsub; @@ -103,7 +116,7 @@ return NULL; } -static struct bsc_subscr *bsc_subscr_find_by_imei(struct llist_head *list, +static struct bsc_subscr *bsc_subscr_find_by_imei(struct bsc_subscr_store *bsubst, const char *imei, const char *use_token) { @@ -112,7 +125,7 @@ if (!imei || !*imei) return NULL; - llist_for_each_entry(bsub, list, entry) { + llist_for_each_entry(bsub, &bsubst->bsub_list, entry) { if (!strcmp(bsub->imei, imei)) { bsc_subscr_get(bsub, use_token); return bsub; @@ -121,7 +134,7 @@ return NULL; } -static struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, +static struct bsc_subscr *bsc_subscr_find_by_tmsi(struct bsc_subscr_store *bsubst, uint32_t tmsi, const char *use_token) { @@ -130,7 +143,7 @@ if (tmsi == GSM_RESERVED_TMSI) return NULL; - llist_for_each_entry(bsub, list, entry) { + llist_for_each_entry(bsub, &bsubst->bsub_list, entry) { if (bsub->tmsi == tmsi) { bsc_subscr_get(bsub, use_token); return bsub; @@ -153,15 +166,15 @@ osmo_strlcpy(bsub->imei, imei, sizeof(bsub->imei)); } -struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list, +struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct bsc_subscr_store *bsubst, const char *imsi, const char *use_token) { struct bsc_subscr *bsub; - bsub = bsc_subscr_find_by_imsi(list, imsi, use_token); + bsub = bsc_subscr_find_by_imsi(bsubst, imsi, use_token); if (bsub) return bsub; - bsub = bsc_subscr_alloc(list); + bsub = bsc_subscr_alloc(bsubst); if (!bsub) return NULL; bsc_subscr_set_imsi(bsub, imsi); @@ -169,15 +182,15 @@ return bsub; } -static struct bsc_subscr *bsc_subscr_find_or_create_by_imei(struct llist_head *list, +static struct bsc_subscr *bsc_subscr_find_or_create_by_imei(struct bsc_subscr_store *bsubst, const char *imei, const char *use_token) { struct bsc_subscr *bsub; - bsub = bsc_subscr_find_by_imei(list, imei, use_token); + bsub = bsc_subscr_find_by_imei(bsubst, imei, use_token); if (bsub) return bsub; - bsub = bsc_subscr_alloc(list); + bsub = bsc_subscr_alloc(bsubst); if (!bsub) return NULL; bsc_subscr_set_imei(bsub, imei); @@ -185,15 +198,15 @@ return bsub; } -struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list, +struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct bsc_subscr_store *bsubst, uint32_t tmsi, const char *use_token) { struct bsc_subscr *bsub; - bsub = bsc_subscr_find_by_tmsi(list, tmsi, use_token); + bsub = bsc_subscr_find_by_tmsi(bsubst, tmsi, use_token); if (bsub) return bsub; - bsub = bsc_subscr_alloc(list); + bsub = bsc_subscr_alloc(bsubst); if (!bsub) return NULL; bsub->tmsi = tmsi; @@ -201,18 +214,18 @@ return bsub; } -struct bsc_subscr *bsc_subscr_find_or_create_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi, +struct bsc_subscr *bsc_subscr_find_or_create_by_mi(struct bsc_subscr_store *bsubst, const struct osmo_mobile_identity *mi, const char *use_token) { if (!mi) return NULL; switch (mi->type) { case GSM_MI_TYPE_IMSI: - return bsc_subscr_find_or_create_by_imsi(list, mi->imsi, use_token); + return bsc_subscr_find_or_create_by_imsi(bsubst, mi->imsi, use_token); case GSM_MI_TYPE_IMEI: - return bsc_subscr_find_or_create_by_imei(list, mi->imei, use_token); + return bsc_subscr_find_or_create_by_imei(bsubst, mi->imei, use_token); case GSM_MI_TYPE_TMSI: - return bsc_subscr_find_or_create_by_tmsi(list, mi->tmsi, use_token); + return bsc_subscr_find_or_create_by_tmsi(bsubst, mi->tmsi, use_token); default: return NULL; } diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index c219ff4..e860888 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -3285,7 +3285,7 @@ vty_out(vty, " IMSI TMSI Use%s", VTY_NEWLINE); /* " 001010123456789 ffffffff 1" */ - llist_for_each_entry(bsc_subscr, bsc_gsmnet->bsc_subscribers, entry) + llist_for_each_entry(bsc_subscr, &bsc_gsmnet->bsc_subscribers->bsub_list, entry) dump_one_sub(vty, bsc_subscr); return CMD_SUCCESS; diff --git a/src/osmo-bsc/net_init.c b/src/osmo-bsc/net_init.c index 8a508dd..5a7422c 100644 --- a/src/osmo-bsc/net_init.c +++ b/src/osmo-bsc/net_init.c @@ -119,8 +119,7 @@ INIT_LLIST_HEAD(&net->subscr_conns); - net->bsc_subscribers = talloc_zero(net, struct llist_head); - INIT_LLIST_HEAD(net->bsc_subscribers); + net->bsc_subscribers = bsc_subscr_store_alloc(net); INIT_LLIST_HEAD(&net->bts_list); net->num_bts = 0; diff --git a/tests/subscr/bsc_subscr_test.c b/tests/subscr/bsc_subscr_test.c index 14e069d..27dc93e 100644 --- a/tests/subscr/bsc_subscr_test.c +++ b/tests/subscr/bsc_subscr_test.c @@ -29,7 +29,7 @@ #include <stdlib.h> #include <inttypes.h> -struct llist_head *bsc_subscribers; +struct bsc_subscr_store *bsc_subscribers; #define VERBOSE_ASSERT(val, expect_op, fmt) \ do { \ @@ -61,26 +61,26 @@ printf("Test BSC subscriber allocation and deletion\n"); /* Check for emptiness */ - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 0, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 0, "%d"); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi1, BSUB_USE) == NULL); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi2, BSUB_USE) == NULL); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi3, BSUB_USE) == NULL); /* Allocate entry 1 */ s1 = bsc_subscr_find_or_create_by_imsi(bsc_subscribers, imsi1, BSUB_USE); - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 1, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 1, "%d"); assert_bsc_subscr(s1, imsi1); - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 1, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 1, "%d"); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi2, BSUB_USE) == NULL); /* Allocate entry 2 */ s2 = bsc_subscr_find_or_create_by_imsi(bsc_subscribers, imsi2, BSUB_USE); s2->tmsi = 0x73517351; - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 2, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 2, "%d"); /* Allocate entry 3 */ s3 = bsc_subscr_find_or_create_by_imsi(bsc_subscribers, imsi3, BSUB_USE); - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 3, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 3, "%d"); /* Check entries */ assert_bsc_subscr(s1, imsi1); @@ -90,7 +90,7 @@ /* Free entry 1 */ bsc_subscr_put(s1, BSUB_USE); s1 = NULL; - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 2, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 2, "%d"); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi1, BSUB_USE) == NULL); assert_bsc_subscr(s2, imsi2); @@ -99,7 +99,7 @@ /* Free entry 2 */ bsc_subscr_put(s2, BSUB_USE); s2 = NULL; - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 1, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 1, "%d"); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi1, BSUB_USE) == NULL); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi2, BSUB_USE) == NULL); assert_bsc_subscr(s3, imsi3); @@ -107,10 +107,10 @@ /* Free entry 3 */ bsc_subscr_put(s3, BSUB_USE); s3 = NULL; - VERBOSE_ASSERT(llist_count(bsc_subscribers), == 0, "%d"); + VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 0, "%d"); OSMO_ASSERT(bsc_subscr_find_by_imsi(bsc_subscribers, imsi3, BSUB_USE) == NULL); - OSMO_ASSERT(llist_empty(bsc_subscribers)); + OSMO_ASSERT(llist_empty(&bsc_subscribers->bsub_list)); } static const struct log_info_cat log_categories[] = { @@ -137,8 +137,7 @@ log_set_print_category_hex(osmo_stderr_target, 0); log_set_print_category(osmo_stderr_target, 1); - bsc_subscribers = talloc_zero(ctx, struct llist_head); - INIT_LLIST_HEAD(bsc_subscribers); + bsc_subscribers = bsc_subscr_store_alloc(ctx); test_bsc_subscr(); diff --git a/tests/subscr/bsc_subscr_test.ok b/tests/subscr/bsc_subscr_test.ok index 0f6a8be..b82b096 100644 --- a/tests/subscr/bsc_subscr_test.ok +++ b/tests/subscr/bsc_subscr_test.ok @@ -1,11 +1,11 @@ Testing BSC subscriber core code. Test BSC subscriber allocation and deletion -llist_count(bsc_subscribers) == 0 -llist_count(bsc_subscribers) == 1 -llist_count(bsc_subscribers) == 1 -llist_count(bsc_subscribers) == 2 -llist_count(bsc_subscribers) == 3 -llist_count(bsc_subscribers) == 2 -llist_count(bsc_subscribers) == 1 -llist_count(bsc_subscribers) == 0 +llist_count(&bsc_subscribers->bsub_list) == 0 +llist_count(&bsc_subscribers->bsub_list) == 1 +llist_count(&bsc_subscribers->bsub_list) == 1 +llist_count(&bsc_subscribers->bsub_list) == 2 +llist_count(&bsc_subscribers->bsub_list) == 3 +llist_count(&bsc_subscribers->bsub_list) == 2 +llist_count(&bsc_subscribers->bsub_list) == 1 +llist_count(&bsc_subscribers->bsub_list) == 0 Done -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31874 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I616e8872af4ac63a6985f8900909e324ba889192 Gerrit-Change-Number: 31874 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-bsc[master]: bsc_subscriber: Drop unused function bsc_subscr_find_by_mi()
by pespin 15 Mar '23

15 Mar '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31869 ) Change subject: bsc_subscriber: Drop unused function bsc_subscr_find_by_mi() ...................................................................... bsc_subscriber: Drop unused function bsc_subscr_find_by_mi() Change-Id: I15a51fa8a5c30fd92b34ebb366d0a805f8902cd0 --- M include/osmocom/bsc/bsc_subscriber.h M src/osmo-bsc/bsc_subscriber.c 2 files changed, 9 insertions(+), 19 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/bsc_subscriber.h b/include/osmocom/bsc/bsc_subscriber.h index 2beb998..da2115f 100644 --- a/include/osmocom/bsc/bsc_subscriber.h +++ b/include/osmocom/bsc/bsc_subscriber.h @@ -49,8 +49,6 @@ struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list, uint32_t tmsi, const char *use_token); -struct bsc_subscr *bsc_subscr_find_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi, - const char *use_token); void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi); void bsc_subscr_set_imei(struct bsc_subscr *bsub, const char *imei); diff --git a/src/osmo-bsc/bsc_subscriber.c b/src/osmo-bsc/bsc_subscriber.c index 9f4e82b..31dfc05 100644 --- a/src/osmo-bsc/bsc_subscriber.c +++ b/src/osmo-bsc/bsc_subscriber.c @@ -139,23 +139,6 @@ return NULL; } -struct bsc_subscr *bsc_subscr_find_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi, - const char *use_token) -{ - if (!mi) - return NULL; - switch (mi->type) { - case GSM_MI_TYPE_IMSI: - return bsc_subscr_find_by_imsi(list, mi->imsi, use_token); - case GSM_MI_TYPE_IMEI: - return bsc_subscr_find_by_imei(list, mi->imei, use_token); - case GSM_MI_TYPE_TMSI: - return bsc_subscr_find_by_tmsi(list, mi->tmsi, use_token); - default: - return NULL; - } -} - void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi) { if (!bsub) -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31869 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I15a51fa8a5c30fd92b34ebb366d0a805f8902cd0 Gerrit-Change-Number: 31869 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-bsc[master]: Move bsc_conn_by_bsub() and make it static
by pespin 15 Mar '23

15 Mar '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31867 ) Change subject: Move bsc_conn_by_bsub() and make it static ...................................................................... Move bsc_conn_by_bsub() and make it static The function was currently in osmo_bsc_sigtran.c but was never used there, and it really doesn't have any relation to that file. Let's move it to the only place where it's used so far, and mark it as static. Change-Id: I8a8cef45aa378421e0ac328d3b29b9d194698a55 --- M include/osmocom/bsc/osmo_bsc_sigtran.h M src/osmo-bsc/gsm_08_08.c M src/osmo-bsc/osmo_bsc_sigtran.c 3 files changed, 27 insertions(+), 14 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/osmo_bsc_sigtran.h b/include/osmocom/bsc/osmo_bsc_sigtran.h index 9cc2cfc..2ee35e5 100644 --- a/include/osmocom/bsc/osmo_bsc_sigtran.h +++ b/include/osmocom/bsc/osmo_bsc_sigtran.h @@ -26,7 +26,6 @@ /* Allocate resources to make a new connection oriented sigtran connection * (not the connection ittself!) */ enum bsc_con osmo_bsc_sigtran_new_conn(struct gsm_subscriber_connection *conn, struct bsc_msc_data *msc); -struct gsm_subscriber_connection *bsc_conn_by_bsub(const struct bsc_subscr *bsub); /* Open a new connection oriented sigtran connection */ int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct msgb *msg); diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c index dff6093..769cec4 100644 --- a/src/osmo-bsc/gsm_08_08.c +++ b/src/osmo-bsc/gsm_08_08.c @@ -351,6 +351,19 @@ conn_update_ms_power_class(conn, rc8); } +static struct gsm_subscriber_connection *bsc_conn_by_bsub(const struct bsc_subscr *bsub) +{ + struct gsm_subscriber_connection *conn; + if (!bsub) + return NULL; + + llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) { + if (conn->bsub == bsub) + return conn; + } + return NULL; +} + /*! MS->MSC: New MM context with L3 payload. */ int bsc_compl_l3(struct gsm_lchan *lchan, struct msgb *msg, uint16_t chosen_channel) { diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index 830b72e..1642059 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -45,19 +45,6 @@ #define DEFAULT_ASP_LOCAL_IP "localhost" #define DEFAULT_ASP_REMOTE_IP "localhost" -struct gsm_subscriber_connection *bsc_conn_by_bsub(const struct bsc_subscr *bsub) -{ - struct gsm_subscriber_connection *conn; - if (!bsub) - return NULL; - - llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) { - if (conn->bsub == bsub) - return conn; - } - return NULL; -} - /* Patch regular BSSMAP RESET to add extra T to announce Osmux support (osmocom extension) */ static void _gsm0808_extend_announce_osmux(struct msgb *msg) { -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31867 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I8a8cef45aa378421e0ac328d3b29b9d194698a55 Gerrit-Change-Number: 31867 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in osmo-bsc[master]: Optimize subscr_conns lookup
by pespin 15 Mar '23

15 Mar '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31866 ) Change subject: Optimize subscr_conns lookup ...................................................................... Optimize subscr_conns lookup It was found that, on a busy osmo-bsc (>1000 concurrent calls spread over several BTS), the CPU consumption looking up for gsm_subscriber_conn based on SCCP conn_id can take a considerable amount of time (>5% of osmo-bsc already taking 70% of the CPU time on the core it is running on). The huge CPU consumption happens because a linear search is done (llist) over the entire list of SCCP connections every time an SCCP message is handled. In order to optimize this lookup, this patch introduces a new struct bsc_sccp_inst which becomes associated to the libosmo-sccp osmo_sccp_instance. Each of this strucs maintains an rbtree of gsm_subscriber_conn ordered by conn_id. As a result algorithmic complexity adds O(log(N)) during insert, lookup and delete of SCCP conns, but gets rid of O(N) previous lookup. As a plus, finding a new conn_id now takes generally O(log(N)), while before it used to take O(N). Related: SYS#6200 Change-Id: I667d3ec1dad0ab7bc0fa4799d9611f3a914d07e5 --- M TODO-RELEASE M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_sccp.c M src/osmo-bsc/bsc_subscr_conn_fsm.c M src/osmo-bsc/lb.c M src/osmo-bsc/osmo_bsc_sigtran.c 6 files changed, 183 insertions(+), 101 deletions(-) Approvals: laforge: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/TODO-RELEASE b/TODO-RELEASE index 285dc63..98023fc 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -12,3 +12,4 @@ osmo-bsc CTRL,VTY osmo_fsm instance IDs now use new dynamic timeslot names 'DYNAMIC_OSMOCOM' and 'DYNAMIC_IPACCESS' libosmogsm >1.8.0 circuit switched data stuff (gsm0808_enc/dec_channel_type etc.) libosmo-abis >1.4.0 osmo_ortp.h: add RTP_PT_CSDATA +libosmo-sccp >1.7.0 osmo_sccp_{get,set}_priv() \ No newline at end of file diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index cdf0f43..0c5b485 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -19,6 +19,8 @@ #include <osmocom/core/fsm.h> #include <osmocom/core/tdef.h> #include <osmocom/core/time_cc.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/linuxrbtree.h> #include <osmocom/crypt/auth.h> @@ -331,6 +333,9 @@ /* SCCP connection related */ struct bsc_msc_data *msc; + /* entry in (struct bsc_sccp_inst)->connections */ + struct rb_node node; + /* Sigtran connection ID: * if set: Range (0..SCCP_CONN_ID_MAX) (24 bit) * if unset: SCCP_CONN_ID_UNSET (-1) if unset */ @@ -871,6 +876,19 @@ struct osmo_time_cc static_tch; }; +struct bsc_sccp_inst { + struct osmo_sccp_instance *sccp; /* backpointer */ + /* rbtree root of 'sstruct gsm_subscriber_connection' in this instance, ordered by conn_id */ + struct rb_root connections; + uint32_t next_id; /* next id to allocate */ +}; + +struct bsc_sccp_inst *bsc_sccp_inst_alloc(void *ctx); +uint32_t bsc_sccp_inst_next_conn_id(struct bsc_sccp_inst *bsc_sccp); +int bsc_sccp_inst_register_gscon(struct bsc_sccp_inst *bsc_sccp, struct gsm_subscriber_connection *conn); +void bsc_sccp_inst_unregister_gscon(struct bsc_sccp_inst *bsc_sccp, struct gsm_subscriber_connection *conn); +struct gsm_subscriber_connection *bsc_sccp_inst_get_gscon_by_conn_id(const struct bsc_sccp_inst *bsc_sccp, uint32_t conn_id); + struct gsm_network { struct osmo_plmn_id plmn; @@ -1030,8 +1048,6 @@ enum gsm48_rr_cause bsc_gsm48_rr_cause_from_gsm0808_cause(enum gsm0808_cause c); enum gsm48_rr_cause bsc_gsm48_rr_cause_from_rsl_cause(uint8_t c); -uint32_t bsc_sccp_inst_next_conn_id(struct osmo_sccp_instance *sccp); - /* Interference Measurement Parameters */ struct gsm_interf_meas_params { /* Intave: Interference Averaging period (see 3GPP TS 45.008, table A.1) */ diff --git a/src/osmo-bsc/bsc_sccp.c b/src/osmo-bsc/bsc_sccp.c index e0cce39..6fa1d4b 100644 --- a/src/osmo-bsc/bsc_sccp.c +++ b/src/osmo-bsc/bsc_sccp.c @@ -27,11 +27,82 @@ #include <osmocom/bsc/bsc_msc_data.h> #include <osmocom/bsc/lb.h> -/* We need an unused SCCP conn_id across all SCCP users. */ -uint32_t bsc_sccp_inst_next_conn_id(struct osmo_sccp_instance *sccp) +struct bsc_sccp_inst *bsc_sccp_inst_alloc(void *ctx) { - static uint32_t next_id = 1; - int i; + struct bsc_sccp_inst *bsc_sccp; + + bsc_sccp = talloc_zero(ctx, struct bsc_sccp_inst); + OSMO_ASSERT(bsc_sccp); + bsc_sccp->next_id = 1; + + return bsc_sccp; +} + +int bsc_sccp_inst_register_gscon(struct bsc_sccp_inst *bsc_sccp, struct gsm_subscriber_connection *conn) +{ + struct rb_node **n = &(bsc_sccp->connections.rb_node); + struct rb_node *parent = NULL; + uint32_t conn_id = conn->sccp.conn_id; + + OSMO_ASSERT(conn_id != SCCP_CONN_ID_UNSET); + + while (*n) { + struct gsm_subscriber_connection *it; + + it = container_of(*n, struct gsm_subscriber_connection, sccp.node); + + parent = *n; + if (conn_id < it->sccp.conn_id) { + n = &((*n)->rb_left); + } else if (conn_id > it->sccp.conn_id) { + n = &((*n)->rb_right); + } else { + LOGP(DMSC, LOGL_ERROR, + "Trying to reserve already reserved conn_id %u\n", conn_id); + return -EEXIST; + } + } + + rb_link_node(&conn->sccp.node, parent, n); + rb_insert_color(&conn->sccp.node, &bsc_sccp->connections); + return 0; +} + +void bsc_sccp_inst_unregister_gscon(struct bsc_sccp_inst *bsc_sccp, struct gsm_subscriber_connection *conn) +{ + OSMO_ASSERT(conn->sccp.conn_id != SCCP_CONN_ID_UNSET); + rb_erase(&conn->sccp.node, &bsc_sccp->connections); +} + +/* Helper function to Check if the given connection id is already assigned */ +struct gsm_subscriber_connection *bsc_sccp_inst_get_gscon_by_conn_id(const struct bsc_sccp_inst *bsc_sccp, uint32_t conn_id) +{ + const struct rb_node *node = bsc_sccp->connections.rb_node; + struct gsm_subscriber_connection *conn; + + OSMO_ASSERT(conn_id != SCCP_CONN_ID_UNSET); + /* Range (0..SCCP_CONN_ID_MAX) expected, see bsc_sccp_inst_next_conn_id() */ + OSMO_ASSERT(conn_id <= SCCP_CONN_ID_MAX); + + while (node) { + conn = container_of(node, struct gsm_subscriber_connection, sccp.node); + if (conn_id < conn->sccp.conn_id) + node = node->rb_left; + else if (conn_id > conn->sccp.conn_id) + node = node->rb_right; + else + return conn; + } + + return NULL; +} + +/* We need an unused SCCP conn_id across all SCCP users. */ +uint32_t bsc_sccp_inst_next_conn_id(struct bsc_sccp_inst *bsc_sccp) +{ + uint32_t first_id, test_id; + + first_id = test_id = bsc_sccp->next_id; /* SUA: RFC3868 sec 3.10.4: * The source reference number is a 4 octet long integer. @@ -41,59 +112,26 @@ * reference number which is generated and used by the local node to identify the * connection section after the connection section is set up. * The coding "all ones" is reserved for future use. - * Hence, let's simply use 24 bit ids to fit all link types (excluding 0x00ffffff). + *Hence, as we currently use the connection ID also as local reference, + *let's simply use 24 bit ids to fit all link types (excluding 0x00ffffff). */ - /* This looks really suboptimal, but in most cases the static next_id should indicate exactly the next unused - * conn_id, and we only iterate all conns once to make super sure that it is not already in use. */ - - /* SCCP towards SMLC: */ - if (bsc_gsmnet->smlc->sccp == sccp) { - for (i = 0; i < SCCP_CONN_ID_MAX; i++) { - struct gsm_subscriber_connection *conn; - uint32_t conn_id = next_id; - bool conn_id_already_used = false; - - /* Optimized modulo operation (% SCCP_CONN_ID_MAX) using bitwise AND plus CMP: */ - next_id = (next_id + 1) & 0x00FFFFFF; - if (OSMO_UNLIKELY(next_id == 0x00FFFFFF)) - next_id = 0; - - llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) { - if (conn->lcs.lb.state != SUBSCR_SCCP_ST_NONE && - conn->lcs.lb.conn_id == conn_id) { - conn_id_already_used = true; - break; - } - } - - if (!conn_id_already_used) - return conn_id; - } - return 0xFFFFFFFF; - } - - /* SCCP towards MSC: */ - for (i = 0; i < SCCP_CONN_ID_MAX; i++) { - struct gsm_subscriber_connection *conn; - uint32_t conn_id = next_id; - bool conn_id_already_used = false; - + while (bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, test_id)) { /* Optimized modulo operation (% SCCP_CONN_ID_MAX) using bitwise AND plus CMP: */ - next_id = (next_id + 1) & 0x00FFFFFF; - if (OSMO_UNLIKELY(next_id == 0x00FFFFFF)) - next_id = 0; + test_id = (test_id + 1) & 0x00FFFFFF; + if (OSMO_UNLIKELY(test_id == 0x00FFFFFF)) + test_id = 0; - llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) { - if (conn->sccp.msc && conn->sccp.msc->a.sccp == sccp && - conn->sccp.conn_id == conn_id) { - conn_id_already_used = true; - break; - } - } - - if (!conn_id_already_used) - return conn_id; + /* Did a whole loop, all used, fail */ + if (OSMO_UNLIKELY(test_id == first_id)) + return SCCP_CONN_ID_UNSET; } - return SCCP_CONN_ID_UNSET; + + bsc_sccp->next_id = test_id; + /* Optimized modulo operation (% SCCP_CONN_ID_MAX) using bitwise AND plus CMP: */ + bsc_sccp->next_id = (bsc_sccp->next_id + 1) & 0x00FFFFFF; + if (OSMO_UNLIKELY(bsc_sccp->next_id == 0x00FFFFFF)) + bsc_sccp->next_id = 0; + + return test_id; } diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index e37f030..8e21992 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -1111,6 +1111,11 @@ osmo_sccp_tx_disconn(msc->a.sccp_user, conn->sccp.conn_id, &msc->a.bsc_addr, 0); conn->sccp.state = SUBSCR_SCCP_ST_NONE; } + if (conn->sccp.conn_id != SCCP_CONN_ID_UNSET && conn->sccp.msc) { + struct bsc_sccp_inst *bsc_sccp = osmo_sccp_get_priv(conn->sccp.msc->a.sccp); + bsc_sccp_inst_unregister_gscon(bsc_sccp, conn); + conn->sccp.conn_id = SCCP_CONN_ID_UNSET; + } if (conn->bsub) { LOGPFSML(fi, LOGL_DEBUG, "Putting bsc_subscr\n"); diff --git a/src/osmo-bsc/lb.c b/src/osmo-bsc/lb.c index 6e2d074..6c6f599 100644 --- a/src/osmo-bsc/lb.c +++ b/src/osmo-bsc/lb.c @@ -31,22 +31,7 @@ #include <osmocom/bsc/osmo_bsc_sigtran.h> #include <osmocom/bsc/lcs_loc_req.h> #include <osmocom/bsc/bssmap_reset.h> - -static struct gsm_subscriber_connection *get_bsc_conn_by_lb_conn_id(uint32_t conn_id) -{ - struct gsm_subscriber_connection *conn; - - /* Range (0..SCCP_CONN_ID_MAX) expected, see bsc_sccp_inst_next_conn_id() */ - OSMO_ASSERT(conn_id <= SCCP_CONN_ID_MAX); - - llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) { - if (conn->lcs.lb.state != SUBSCR_SCCP_ST_NONE - && conn->lcs.lb.conn_id == conn_id) - return conn; - } - - return NULL; -} +#include <osmocom/bsc/gsm_data.h> /* Send reset to SMLC */ int bssmap_le_tx_reset(void) @@ -150,6 +135,8 @@ { struct osmo_scu_prim *scu_prim = (struct osmo_scu_prim *)oph; struct osmo_sccp_user *scu = _scu; + struct osmo_sccp_instance *sccp = osmo_sccp_get_sccp(scu); + struct bsc_sccp_inst *bsc_sccp = osmo_sccp_get_priv(sccp); struct gsm_subscriber_connection *conn; int rc = 0; @@ -172,7 +159,7 @@ case OSMO_PRIM(OSMO_SCU_PRIM_N_CONNECT, PRIM_OP_CONFIRM): /* Handle inbound confirmation of outbound connection */ DEBUGP(DLCS, "N-CONNECT.cnf(%u)\n", scu_prim->u.connect.conn_id); - conn = get_bsc_conn_by_lb_conn_id(scu_prim->u.connect.conn_id); + conn = bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, scu_prim->u.connect.conn_id); if (conn) { conn->lcs.lb.state = SUBSCR_SCCP_ST_CONNECTED; if (msgb_l2len(oph->msg) > 0) { @@ -188,7 +175,7 @@ /* Handle incoming connection oriented data */ DEBUGP(DLCS, "N-DATA.ind(%u)\n", scu_prim->u.data.conn_id); - conn = get_bsc_conn_by_lb_conn_id(scu_prim->u.data.conn_id); + conn = bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, scu_prim->u.data.conn_id); if (!conn) { LOGP(DLCS, LOGL_ERROR, "N-DATA.ind(%u) for unknown conn_id\n", scu_prim->u.data.conn_id); rc = -EINVAL; @@ -206,7 +193,7 @@ osmo_hexdump(msgb_l2(oph->msg), msgb_l2len(oph->msg)), scu_prim->u.disconnect.cause); /* indication of disconnect */ - conn = get_bsc_conn_by_lb_conn_id(scu_prim->u.disconnect.conn_id); + conn = bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, scu_prim->u.disconnect.conn_id); if (!conn) { LOGP(DLCS, LOGL_ERROR, "N-DISCONNECT.ind for unknown conn_id %u\n", scu_prim->u.disconnect.conn_id); @@ -234,6 +221,7 @@ struct osmo_ss7_instance *ss7; uint32_t conn_id; int rc; + struct bsc_sccp_inst *bsc_sccp = osmo_sccp_get_priv(bsc_gsmnet->smlc->sccp); OSMO_ASSERT(conn); OSMO_ASSERT(msg); @@ -244,7 +232,7 @@ return -EINVAL; } - conn_id = bsc_sccp_inst_next_conn_id(bsc_gsmnet->smlc->sccp); + conn_id = bsc_sccp_inst_next_conn_id(bsc_sccp); if (conn_id == SCCP_CONN_ID_UNSET) { LOGPFSMSL(conn->fi, DLCS, LOGL_ERROR, "Unable to allocate SCCP Connection ID for BSSMAP-LE to SMLC\n"); return -ENOSPC; @@ -421,6 +409,7 @@ enum osmo_ss7_asp_protocol used_proto = OSMO_SS7_ASP_PROT_M3UA; char inst_name[32]; const char *smlc_name = "smlc"; + struct bsc_sccp_inst *bsc_sccp; /* Already set up? */ if (bsc_gsmnet->smlc->sccp_user) @@ -454,6 +443,9 @@ if (!sccp) return -EINVAL; bsc_gsmnet->smlc->sccp = sccp; + bsc_sccp = bsc_sccp_inst_alloc(tall_bsc_ctx); + bsc_sccp->sccp = sccp; + osmo_sccp_set_priv(sccp, bsc_sccp); /* If unset, use default local SCCP address */ if (!bsc_gsmnet->smlc->bsc_addr.presence) diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index 973832b..830b72e 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -45,26 +45,6 @@ #define DEFAULT_ASP_LOCAL_IP "localhost" #define DEFAULT_ASP_REMOTE_IP "localhost" -/* Helper function to Check if the given connection id is already assigned */ -static struct gsm_subscriber_connection *get_bsc_conn_by_conn_id(const struct osmo_sccp_user *scu, uint32_t conn_id) -{ - struct gsm_subscriber_connection *conn; - const struct osmo_sccp_instance *sccp = osmo_sccp_get_sccp(scu); - - /* Range (0..SCCP_CONN_ID_MAX) expected, see bsc_sccp_inst_next_conn_id() */ - OSMO_ASSERT(conn_id <= SCCP_CONN_ID_MAX); - - llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) { - if (conn->sccp.msc && conn->sccp.msc->a.sccp != sccp) - continue; - if (conn->sccp.conn_id != conn_id) - continue; - return conn; - } - - return NULL; -} - struct gsm_subscriber_connection *bsc_conn_by_bsub(const struct bsc_subscr *bsub) { struct gsm_subscriber_connection *conn; @@ -170,10 +150,12 @@ static int handle_n_connect_from_msc(struct osmo_sccp_user *scu, struct osmo_scu_prim *scu_prim) { struct bsc_msc_data *msc = get_msc_by_addr(&scu_prim->u.connect.calling_addr); + struct osmo_sccp_instance *sccp = osmo_sccp_get_sccp(scu); + struct bsc_sccp_inst *bsc_sccp = osmo_sccp_get_priv(sccp); struct gsm_subscriber_connection *conn; int rc = 0; - conn = get_bsc_conn_by_conn_id(scu, scu_prim->u.connect.conn_id); + conn = bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, scu_prim->u.connect.conn_id); if (conn) { LOGP(DMSC, LOGL_NOTICE, "(calling_addr=%s conn_id=%u) N-CONNECT.ind with already used conn_id, ignoring\n", @@ -202,6 +184,13 @@ return -ENOMEM; conn->sccp.msc = msc; conn->sccp.conn_id = scu_prim->u.connect.conn_id; + if (bsc_sccp_inst_register_gscon(bsc_sccp, conn) < 0) { + LOGP(DMSC, LOGL_NOTICE, "(calling_addr=%s conn_id=%u) N-CONNECT.ind failed registering conn\n", + osmo_sccp_addr_dump(&scu_prim->u.connect.calling_addr), scu_prim->u.connect.conn_id); + osmo_fsm_inst_term(conn->fi, OSMO_FSM_TERM_REQUEST, NULL); + rc = -ENOENT; + goto refuse; + } /* Take actions asked for by the enclosed PDU */ osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_IND, scu_prim); @@ -217,6 +206,8 @@ { struct osmo_scu_prim *scu_prim = (struct osmo_scu_prim *)oph; struct osmo_sccp_user *scu = _scu; + struct osmo_sccp_instance *sccp = osmo_sccp_get_sccp(scu); + struct bsc_sccp_inst *bsc_sccp = osmo_sccp_get_priv(sccp); struct gsm_subscriber_connection *conn; int rc = 0; @@ -237,7 +228,7 @@ /* Handle outbound connection confirmation */ DEBUGP(DMSC, "N-CONNECT.cnf(%u, %s)\n", scu_prim->u.connect.conn_id, osmo_hexdump(msgb_l2(oph->msg), msgb_l2len(oph->msg))); - conn = get_bsc_conn_by_conn_id(scu, scu_prim->u.connect.conn_id); + conn = bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, scu_prim->u.connect.conn_id); if (conn) { osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_CFM, scu_prim); conn->sccp.state = SUBSCR_SCCP_ST_CONNECTED; @@ -256,7 +247,7 @@ osmo_hexdump(msgb_l2(oph->msg), msgb_l2len(oph->msg))); /* Incoming data is a sign of a vital connection */ - conn = get_bsc_conn_by_conn_id(scu, scu_prim->u.data.conn_id); + conn = bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, scu_prim->u.data.conn_id); if (conn) { a_reset_conn_success(conn->sccp.msc); handle_data_from_msc(conn, oph->msg); @@ -268,7 +259,7 @@ osmo_hexdump(msgb_l2(oph->msg), msgb_l2len(oph->msg)), scu_prim->u.disconnect.cause); /* indication of disconnect */ - conn = get_bsc_conn_by_conn_id(scu, scu_prim->u.disconnect.conn_id); + conn = bsc_sccp_inst_get_gscon_by_conn_id(bsc_sccp, scu_prim->u.disconnect.conn_id); if (conn) { conn->sccp.state = SUBSCR_SCCP_ST_NONE; if (msgb_l2len(oph->msg) > 0) @@ -323,6 +314,7 @@ { struct osmo_ss7_instance *ss7; struct bsc_msc_data *msc; + struct bsc_sccp_inst *bsc_sccp; uint32_t conn_id; int rc; @@ -338,11 +330,16 @@ return -EINVAL; } - conn->sccp.conn_id = conn_id = bsc_sccp_inst_next_conn_id(conn->sccp.msc->a.sccp); + bsc_sccp = osmo_sccp_get_priv(msc->a.sccp); + conn->sccp.conn_id = conn_id = bsc_sccp_inst_next_conn_id(bsc_sccp); if (conn->sccp.conn_id == SCCP_CONN_ID_UNSET) { LOGP(DMSC, LOGL_ERROR, "Unable to allocate SCCP Connection ID\n"); return -1; } + if (bsc_sccp_inst_register_gscon(bsc_sccp, conn) < 0) { + LOGP(DMSC, LOGL_ERROR, "Unable to register SCCP connection (id=%u)\n", conn->sccp.conn_id); + return -1; + } LOGP(DMSC, LOGL_DEBUG, "Allocated new connection id: %u\n", conn->sccp.conn_id); ss7 = osmo_ss7_instance_find(msc->a.cs7_instance); OSMO_ASSERT(ss7); @@ -520,6 +517,7 @@ int prev_msc_nr; struct osmo_sccp_instance *sccp; + struct bsc_sccp_inst *bsc_sccp; llist_for_each_entry(msc, msc_list, entry) { /* An MSC with invalid cs7 instance id defaults to cs7 instance 0 */ @@ -563,6 +561,10 @@ if (!sccp) return -EINVAL; + bsc_sccp = bsc_sccp_inst_alloc(tall_bsc_ctx); + bsc_sccp->sccp = sccp; + osmo_sccp_set_priv(sccp, bsc_sccp); + /* Now that the SCCP client is set up, configure all MSCs on this cs7 instance to use it */ llist_for_each_entry(msc, msc_list, entry) { char msc_name[32]; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31866 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I667d3ec1dad0ab7bc0fa4799d9611f3a914d07e5 Gerrit-Change-Number: 31866 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-bsc[master]: bsc_subscriber: Optimize lookup of bsub by TMSI
by pespin 15 Mar '23

15 Mar '23
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31875 ) Change subject: bsc_subscriber: Optimize lookup of bsub by TMSI ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31875 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: If27429e715ef4b327177e427249e68321a6e83cc Gerrit-Change-Number: 31875 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Wed, 15 Mar 2023 09:44:10 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmocore[master]: New osmo-gsmtap-logsend utility
by laforge 15 Mar '23

15 Mar '23
Attention is currently required from: neels, laforge, keith. Hello Jenkins Builder, neels, keith, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/31916 to look at the new patch set (#5). Change subject: New osmo-gsmtap-logsend utility ...................................................................... New osmo-gsmtap-logsend utility This utility can be used to "pipe" stdin or some file as log lines via GSMTAP logging. Change-Id: Ida96e87d84e0c349c5069edc67fec1c3cf19d1ab --- M .gitignore M debian/libosmocore-utils.install M utils/Makefile.am A utils/gsmtap-logsend.c 4 files changed, 156 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/16/31916/5 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31916 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ida96e87d84e0c349c5069edc67fec1c3cf19d1ab Gerrit-Change-Number: 31916 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith <keith(a)rhizomatica.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: keith <keith(a)rhizomatica.org> Gerrit-MessageType: newpatchset
1 0
0 0
[L] Change in libosmo-gprs[master]: Create skeleton for libosmo-gprs-gmm
by pespin 15 Mar '23

15 Mar '23
Attention is currently required from: pespin, fixeria. Hello osmith, Jenkins Builder, laforge, fixeria, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31915 to look at the new patch set (#3). Change subject: Create skeleton for libosmo-gprs-gmm ...................................................................... Create skeleton for libosmo-gprs-gmm The library itself only contains a bunch of boilerplate to build the library and have usual initialization, logging, prim APIs. There's not yet much logic specific in it yet, but will make next commits easier to review. Related: OS#5501 Change-Id: Ie098576954a55e5046c2463390ab7133511c1eb3 --- M Makefile.am M configure.ac M contrib/libosmo-gprs.spec.in M debian/control A debian/libosmo-gprs-gmm-dev.install A debian/libosmo-gprs-gmm0.install M include/osmocom/gprs/Makefile.am A include/osmocom/gprs/gmm/Makefile.am A include/osmocom/gprs/gmm/gmm.h A include/osmocom/gprs/gmm/gmm_prim.h A include/osmocom/gprs/gmm/gmm_private.h A libosmo-gprs-gmm.pc.in M src/Makefile.am A src/gmm/Makefile.am A src/gmm/gmm.c A src/gmm/gmm_prim.c A src/gmm/misc.c M tests/Makefile.am A tests/gmm/Makefile.am A tests/gmm/gmm_prim_test.c A tests/gmm/gmm_prim_test.err A tests/gmm/gmm_prim_test.ok M tests/testsuite.at 23 files changed, 851 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/15/31915/3 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31915 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ie098576954a55e5046c2463390ab7133511c1eb3 Gerrit-Change-Number: 31915 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • ...
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.