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
[S] Change in osmo-bsc[master]: Assert conn_id being looked up is inside expected range
by laforge 13 Mar '23

13 Mar '23
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31812 ) Change subject: Assert conn_id being looked up is inside expected range ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31812 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Iffe580ad5f974fdbef7061a14306b50bd4875eb1 Gerrit-Change-Number: 31812 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-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Mar 2023 19:41:55 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-bsc[master]: bscc_sccp: Small optimiztion in bsc_sccp_inst_next_conn_id()
by laforge 13 Mar '23

13 Mar '23
Attention is currently required from: neels, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31811 ) Change subject: bscc_sccp: Small optimiztion in bsc_sccp_inst_next_conn_id() ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31811 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ic32b1eeb201fc51110e1ee130110824845f81e82 Gerrit-Change-Number: 31811 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: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Mar 2023 19:41:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: .gitignore: sms.db-shm sbs.db-wal (when db is open)
by fixeria 13 Mar '23

13 Mar '23
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31705 ) Change subject: .gitignore: sms.db-shm sbs.db-wal (when db is open) ...................................................................... Patch Set 2: (1 comment) Patchset: PS2: > Do we have sqlite related stuff in `osmo-ttcn3-hacks`? […] Ah, I see it's explained in `Ib4c66a9861f92293520c4c38a50d4d51f3cf2a77`. We may want to put `sms-database /tmp/sms.db` to the config file to avoid this. Or even better: use `sms-database :memory:` https://www.sqlite.org/inmemorydb.html -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31705 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I788ebf15a1569584dd2f158be901bc6e9f7de177 Gerrit-Change-Number: 31705 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Mar 2023 18:37:31 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: .gitignore: sms.db-shm sbs.db-wal (when db is open)
by fixeria 13 Mar '23

13 Mar '23
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31705 ) Change subject: .gitignore: sms.db-shm sbs.db-wal (when db is open) ...................................................................... Patch Set 2: (1 comment) Patchset: PS2: Do we have sqlite related stuff in `osmo-ttcn3-hacks`? Why would there be these files in the project's tree? -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31705 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I788ebf15a1569584dd2f158be901bc6e9f7de177 Gerrit-Change-Number: 31705 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Mar 2023 18:28:52 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-bsc[master]: bsc_subscriber: Optimize lookup of bsub by TMSI
by pespin 13 Mar '23

13 Mar '23
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-bsc/+/31875 to look at the new patch set (#2). Change subject: bsc_subscriber: Optimize lookup of bsub by TMSI ...................................................................... bsc_subscriber: Optimize lookup of bsub by TMSI It was found that on a busy osmo-bsc process (>1000 concurrent calls spead over different BTSs), a good amount of time is spent iterating the subscribers list trying to find a subscriber based on a TMSI (1.60% of total CPU time used by osmo-bsc). This patch introduces a new rbtree under struct bsc_subscr_store which allows storing all the busbs ordered by TMSI. This way, lookup time changes O(N) -> O(log(N)), at the expense of increased insert/deletion time O(1) -> O(log(N)). Related: SYS#6200 Change-Id: If27429e715ef4b327177e427249e68321a6e83cc --- M include/osmocom/bsc/bsc_subscriber.h M src/osmo-bsc/bsc_subscriber.c M src/osmo-bsc/osmo_bsc_bssap.c M tests/subscr/bsc_subscr_test.c 4 files changed, 105 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/75/31875/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-MessageType: newpatchset
1 0
0 0
[M] Change in osmo-bsc[master]: bsc_subscr: Optimize lookup of bsub by TMSI
by pespin 13 Mar '23

13 Mar '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31875 ) Change subject: bsc_subscr: Optimize lookup of bsub by TMSI ...................................................................... bsc_subscr: Optimize lookup of bsub by TMSI It was found that on a busy osmo-bsc process (>1000 concurrent calls spead over different BTSs), a good amount of time is spent iterating the subscribers list trying to find a subscriber based on a TMSI (1.60% of total CPU time used by osmo-bsc). This patch introduces a new rbtree under struct bsc_subscr_store which allows storing all the busbs ordered by TMSI. This way, lookup time changes O(N) -> O(log(N)), at the expense of increased insert/deletion time O(1) -> O(log(N)). Change-Id: If27429e715ef4b327177e427249e68321a6e83cc --- M include/osmocom/bsc/bsc_subscriber.h M src/osmo-bsc/bsc_subscriber.c M src/osmo-bsc/osmo_bsc_bssap.c M tests/subscr/bsc_subscr_test.c 4 files changed, 104 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/75/31875/1 diff --git a/include/osmocom/bsc/bsc_subscriber.h b/include/osmocom/bsc/bsc_subscriber.h index 7ec457b..1fa0016 100644 --- a/include/osmocom/bsc/bsc_subscriber.h +++ b/include/osmocom/bsc/bsc_subscriber.h @@ -5,6 +5,7 @@ #include <stdint.h> #include <osmocom/core/linuxlist.h> +#include <osmocom/core/linuxrbtree.h> #include <osmocom/core/use_count.h> #include <osmocom/gsm/protocol/gsm_23_003.h> #include <osmocom/gsm/gsm48.h> @@ -14,6 +15,8 @@ struct bsc_subscr_store { struct llist_head bsub_list; /* list containing "struct bsc_subscr" */ + /* rbtree root of 'struct bsc_subscr', ordered by tmsi */ + struct rb_root bsub_tree_tmsi; }; struct bsc_subscr_store *bsc_subscr_store_alloc(void *ctx); @@ -21,6 +24,8 @@ struct bsc_subscr { struct bsc_subscr_store *store; /* backpointer to "struct bsc_subscr_store" */ struct llist_head entry; /* entry in (struct bsc_subscr_store)->bsub_list */ + /* entry in (struct bsc_subscr_store)->bsub_tree_tmsi. Inserted if tmsi != GSM_RESERVED_TMSI: */ + struct rb_node node_tmsi; struct osmo_use_count use_count; char imsi[GSM23003_IMSI_MAX_DIGITS+1]; @@ -49,6 +54,7 @@ const char *imsi, const char *use_token); +int bsc_subscr_set_tmsi(struct bsc_subscr *bsub, uint32_t tmsi); 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 65c5c87..77b7efb 100644 --- a/src/osmo-bsc/bsc_subscriber.c +++ b/src/osmo-bsc/bsc_subscriber.c @@ -138,20 +138,82 @@ uint32_t tmsi, const char *use_token) { + const struct rb_node *node = bsubst->bsub_tree_tmsi.rb_node; struct bsc_subscr *bsub; if (tmsi == GSM_RESERVED_TMSI) return NULL; - llist_for_each_entry(bsub, &bsubst->bsub_list, entry) { - if (bsub->tmsi == tmsi) { + while (node) { + bsub = container_of(node, struct bsc_subscr, node_tmsi); + if (tmsi < bsub->tmsi) + node = node->rb_left; + else if (tmsi > bsub->tmsi) + node = node->rb_right; + else { bsc_subscr_get(bsub, use_token); return bsub; } } + return NULL; } +static int bsc_subscr_store_insert_bsub_tmsi(struct bsc_subscr *bsub) +{ + struct bsc_subscr_store *bsubst = bsub->store; + struct rb_node **n = &(bsubst->bsub_tree_tmsi.rb_node); + struct rb_node *parent = NULL; + + OSMO_ASSERT(bsub->tmsi != GSM_RESERVED_TMSI); + + while (*n) { + struct bsc_subscr *it; + + it = container_of(*n, struct bsc_subscr, node_tmsi); + + parent = *n; + if (bsub->tmsi < it->tmsi) { + n = &((*n)->rb_left); + } else if (bsub->tmsi > it->tmsi) { + n = &((*n)->rb_right); + } else { + LOGP(DMSC, LOGL_ERROR, + "Trying to reserve already reserved tmsi %u\n", bsub->tmsi); + return -EEXIST; + } + } + + rb_link_node(&bsub->node_tmsi, parent, n); + rb_insert_color(&bsub->node_tmsi, &bsubst->bsub_tree_tmsi); + return 0; +} + +int bsc_subscr_set_tmsi(struct bsc_subscr *bsub, uint32_t tmsi) +{ + int rc = 0; + + if (!bsub) + return -EINVAL; + + if (bsub->tmsi == tmsi) + return 0; + + /* bsub was already inserted, remove and re-insert with new tmsi */ + if (bsub->tmsi != GSM_RESERVED_TMSI) + rb_erase(&bsub->node_tmsi, &bsub->store->bsub_tree_tmsi); + + bsub->tmsi = tmsi; + + /* If new tmsi is set, insert bsub into rbtree: */ + if (bsub->tmsi != GSM_RESERVED_TMSI) { + if ((rc = bsc_subscr_store_insert_bsub_tmsi(bsub)) < 0) + bsub->tmsi = GSM_RESERVED_TMSI; + } + + return rc; +} + void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi) { if (!bsub) @@ -209,7 +271,10 @@ bsub = bsc_subscr_alloc(bsubst); if (!bsub) return NULL; - bsub->tmsi = tmsi; + if (bsc_subscr_set_tmsi(bsub, tmsi) < 0) { + bsc_subscr_free(bsub); + return NULL; + } bsc_subscr_get(bsub, use_token); return bsub; } @@ -268,6 +333,10 @@ static void bsc_subscr_free(struct bsc_subscr *bsub) { OSMO_ASSERT(llist_empty(&bsub->active_paging_requests)); + + if (bsub->tmsi != GSM_RESERVED_TMSI) + rb_erase(&bsub->node_tmsi, &bsub->store->bsub_tree_tmsi); + llist_del(&bsub->entry); talloc_free(bsub); } diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index a7c6ac3..d504ce6 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -352,8 +352,12 @@ return -EINVAL; } } - if (params->tmsi != GSM_RESERVED_TMSI) - params->bsub->tmsi = params->tmsi; + if (params->tmsi != GSM_RESERVED_TMSI) { + if (bsc_subscr_set_tmsi(params->bsub, params->tmsi) < 0) { + LOG_PAGING(params, DMSC, LOGL_ERROR, "Paging request failed: Could not set TMSI on subscriber\n"); + return -EINVAL; + } + } log_set_context(LOG_CTX_BSC_SUBSCR, params->bsub); switch (params->cil.id_discr) { diff --git a/tests/subscr/bsc_subscr_test.c b/tests/subscr/bsc_subscr_test.c index 27dc93e..2a0e1eb 100644 --- a/tests/subscr/bsc_subscr_test.c +++ b/tests/subscr/bsc_subscr_test.c @@ -75,7 +75,7 @@ /* Allocate entry 2 */ s2 = bsc_subscr_find_or_create_by_imsi(bsc_subscribers, imsi2, BSUB_USE); - s2->tmsi = 0x73517351; + bsc_subscr_set_tmsi(s2, 0x73517351); VERBOSE_ASSERT(llist_count(&bsc_subscribers->bsub_list), == 2, "%d"); /* Allocate entry 3 */ -- 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-bsc[master]: bsc_subscriber: Introduce bsc_subscriber_store object
by pespin 13 Mar '23

13 Mar '23
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/74/31874/1 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: contrib/talloc_count.sh: improve hexadecimal masking
by pespin 13 Mar '23

13 Mar '23
Attention is currently required from: neels. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31873 ) Change subject: contrib/talloc_count.sh: improve hexadecimal masking ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31873 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I1b42ce3e67c7ed2d38d3e5c9cbfa90ba185a07b7 Gerrit-Change-Number: 31873 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Mar 2023 17:10:57 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: fix 'make vty-test' for --disable-gb
by pespin 13 Mar '23

13 Mar '23
Attention is currently required from: neels. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31871 ) Change subject: fix 'make vty-test' for --disable-gb ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31871 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib6aec784d3b20cd56cb6bfab9ff17da35a282406 Gerrit-Change-Number: 31871 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Mar 2023 17:10:15 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: fix 'make vty-test' for --disable-external-tests --enable-gb
by pespin 13 Mar '23

13 Mar '23
Attention is currently required from: neels. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31872 ) Change subject: fix 'make vty-test' for --disable-external-tests --enable-gb ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31872 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I80ac270bfb563a769a7746d8fbceac09e267ce03 Gerrit-Change-Number: 31872 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Mon, 13 Mar 2023 17:09:58 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • ...
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.