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

May 2022

  • 2 participants
  • 1343 discussions
Change in osmo-bsc[master]: fix performance for chan_counts and all_allocated stats
by laforge 30 May '22

30 May '22
Attention is currently required from: neels. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28205 ) Change subject: fix performance for chan_counts and all_allocated stats ...................................................................... Patch Set 1: (1 comment) File src/osmo-bsc/chan_counts.c: https://gerrit.osmocom.org/c/osmo-bsc/+/28205/comment/7a2085e0_e0473f33 PS1, Line 73: static const char *chan_counts_dim1_name[] = { might be worth explicitly sizing the arrays by your _CHAN_*NUM constants to avoid array overflows I.e. if the number of counts should ever change and no name is added here -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28205 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I580bfae329aac8d4552723164741536af6512011 Gerrit-Change-Number: 28205 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Mon, 30 May 2022 04:59:47 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in osmo-bsc[master]: drop log from ts_is_usable()
by laforge 30 May '22

30 May '22
Attention is currently required from: neels. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28203 ) Change subject: drop log from ts_is_usable() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28203 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I0635c47609fd7c7d0195b6658b7da231d6527b4b Gerrit-Change-Number: 28203 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Mon, 30 May 2022 04:49:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-bsc[master]: code cleanup for all_allocated timers, no functional change
by neels 30 May '22

30 May '22
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28204 ) Change subject: code cleanup for all_allocated timers, no functional change ...................................................................... code cleanup for all_allocated timers, no functional change Reduce some code dup in all_allocated accounting and cosmetically prepare for upcoming performance fix. Have a struct all_allocated, allow easy re-use of function all_allocated_update(). Rename function to all_allocated_update_bsc(). Upcoming patch will also add all_allocated_update_bts(). Related: SYS#5976 Change-Id: Id7a82c65d56a87818fc35bbeedf67e2af2f89f11 --- M include/osmocom/bsc/bsc_stats.h M include/osmocom/bsc/bts.h M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_init.c M src/osmo-bsc/bsc_stats.c M src/osmo-bsc/bts.c M src/osmo-bsc/lchan_fsm.c 7 files changed, 50 insertions(+), 70 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/04/28204/1 diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h index 801a2c1..edd36b6 100644 --- a/include/osmocom/bsc/bsc_stats.h +++ b/include/osmocom/bsc/bsc_stats.h @@ -110,4 +110,5 @@ extern const struct osmo_stat_item_group_desc bsc_statg_desc; void bsc_update_connection_stats(struct gsm_network *net); -void bsc_update_time_cc_all_allocated(struct gsm_network *net); + +void all_allocated_update_bsc(); diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index 5a67791..fc3ebce 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -637,10 +637,7 @@ /* At what point in the channel allocation sequence to dispatch the Immediate Assignment (Abis optimization) */ enum imm_ass_time imm_ass_time; - struct osmo_time_cc all_allocated_sdcch; - struct osmo_time_cc all_allocated_static_sdcch; - struct osmo_time_cc all_allocated_tch; - struct osmo_time_cc all_allocated_static_tch; + struct all_allocated all_allocated; }; #define GSM_BTS_SI2Q(bts, i) (struct gsm48_system_information_type_2quater *)((bts)->si_buf[SYSINFO_TYPE_2quater][i]) diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 6abe943..88c6474 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1203,6 +1203,13 @@ int dst; /* daylight savings */ }; +struct all_allocated { + struct osmo_time_cc sdcch; + struct osmo_time_cc static_sdcch; + struct osmo_time_cc tch; + struct osmo_time_cc static_tch; +}; + struct gsm_network { struct osmo_plmn_id plmn; @@ -1313,10 +1320,7 @@ struct smlc_config *smlc; - struct osmo_time_cc all_allocated_sdcch; - struct osmo_time_cc all_allocated_static_sdcch; - struct osmo_time_cc all_allocated_tch; - struct osmo_time_cc all_allocated_static_tch; + struct all_allocated all_allocated; }; struct gsm_audio_support { diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c index 650a76b..c381c0f 100644 --- a/src/osmo-bsc/bsc_init.c +++ b/src/osmo-bsc/bsc_init.c @@ -132,7 +132,7 @@ if (!net->bts_unknown_statg) goto err_free_all; - net->all_allocated_sdcch = (struct osmo_time_cc){ + net->all_allocated.sdcch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, @@ -143,7 +143,7 @@ .T_defs = net->T_defs, }, }; - net->all_allocated_static_sdcch = (struct osmo_time_cc){ + net->all_allocated.static_sdcch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, @@ -154,7 +154,7 @@ .T_defs = net->T_defs, }, }; - net->all_allocated_tch = (struct osmo_time_cc){ + net->all_allocated.tch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, @@ -165,7 +165,7 @@ .T_defs = net->T_defs, }, }; - net->all_allocated_static_tch = (struct osmo_time_cc){ + net->all_allocated.static_tch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c index b48c90a..2632ac8 100644 --- a/src/osmo-bsc/bsc_stats.c +++ b/src/osmo-bsc/bsc_stats.c @@ -195,67 +195,45 @@ osmo_stat_item_set(osmo_stat_item_group_get_item(net->bsc_statg, BSC_STAT_NUM_TRX_TOTAL), num_trx_total); /* Make sure to notice cells that become disconnected */ - bsc_update_time_cc_all_allocated(net); + all_allocated_update_bsc(); } -void bsc_update_time_cc_all_allocated(struct gsm_network *net) +static void all_allocated_update(struct all_allocated *all_allocated, const struct chan_counts *c) { - struct gsm_bts *bts; - struct gsm_bts_trx *trx; + osmo_time_cc_set_flag(&all_allocated->sdcch, + c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] + && !c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); + osmo_time_cc_set_flag(&all_allocated->static_sdcch, + c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] + && !c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); + + osmo_time_cc_set_flag(&all_allocated->tch, + (c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] + + c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) + && !(c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] + + c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); + + osmo_time_cc_set_flag(&all_allocated->static_tch, + (c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] + + c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) + && !(c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] + + c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); +} + +void all_allocated_update_bsc() { + struct gsm_network *net = bsc_gsmnet; + struct gsm_bts *bts; struct chan_counts bsc_counts; + chan_counts_zero(&bsc_counts); llist_for_each_entry(bts, &net->bts_list, list) { struct chan_counts bts_counts; - chan_counts_zero(&bts_counts); - - llist_for_each_entry(trx, &bts->trx_list, list) { - struct chan_counts trx_counts; - chan_counts_for_trx(&trx_counts, trx); - chan_counts_add(&bts_counts, &trx_counts); - } - - osmo_time_cc_set_flag(&bts->all_allocated_sdcch, - bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] - && !bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); - - osmo_time_cc_set_flag(&bts->all_allocated_static_sdcch, - bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] - && !bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); - - osmo_time_cc_set_flag(&bts->all_allocated_tch, - (bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] - + bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) - && !(bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] - + bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); - - osmo_time_cc_set_flag(&bts->all_allocated_static_tch, - (bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] - + bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) - && !(bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] - + bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); - + chan_counts_for_bts(&bts_counts, bts); + all_allocated_update(&bts->all_allocated, &bts_counts); chan_counts_add(&bsc_counts, &bts_counts); } - osmo_time_cc_set_flag(&net->all_allocated_sdcch, - bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] - && !bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); - - osmo_time_cc_set_flag(&net->all_allocated_static_sdcch, - bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH] - && !bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]); - - osmo_time_cc_set_flag(&net->all_allocated_tch, - (bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] - + bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) - && !(bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] - + bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); - - osmo_time_cc_set_flag(&net->all_allocated_static_tch, - (bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F] - + bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H]) - && !(bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F] - + bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); + all_allocated_update(&net->all_allocated, &bsc_counts); } diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index ad46f54..d0adb2a 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -216,7 +216,7 @@ } bts->bts_statg = osmo_stat_item_group_alloc(bts, &bts_statg_desc, bts->nr); - bts->all_allocated_sdcch = (struct osmo_time_cc){ + bts->all_allocated.sdcch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, @@ -227,7 +227,7 @@ .T_defs = net->T_defs, }, }; - bts->all_allocated_static_sdcch = (struct osmo_time_cc){ + bts->all_allocated.static_sdcch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, @@ -238,7 +238,7 @@ .T_defs = net->T_defs, }, }; - bts->all_allocated_tch = (struct osmo_time_cc){ + bts->all_allocated.tch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, @@ -249,7 +249,7 @@ .T_defs = net->T_defs, }, }; - bts->all_allocated_static_tch = (struct osmo_time_cc){ + bts->all_allocated.static_tch = (struct osmo_time_cc){ .cfg = { .gran_usec = 1*1000000, .forget_sum_usec = 60*1000000, diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index 1c85ff3..e3ae4a6 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -525,7 +525,7 @@ lchan_reset(lchan); osmo_fsm_inst_dispatch(lchan->ts->fi, TS_EV_LCHAN_UNUSED, lchan); - bsc_update_time_cc_all_allocated(bts->network); + all_allocated_update_bsc(); /* Poll the channel request queue, so that waiting calls can make use of the lchan that just * has become unused now. */ @@ -707,7 +707,7 @@ return; } - bsc_update_time_cc_all_allocated(bts->network); + all_allocated_update_bsc(); lchan->conn = info->for_conn; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28204 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Id7a82c65d56a87818fc35bbeedf67e2af2f89f11 Gerrit-Change-Number: 28204 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: fix performance for chan_counts and all_allocated stats
by neels 30 May '22

30 May '22
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28205 ) Change subject: fix performance for chan_counts and all_allocated stats ...................................................................... fix performance for chan_counts and all_allocated stats The all_allocated_update_bsc() does inefficient iterating to count active/inactive lchans, which scales badly for high numbers of TRX managed by osmo-bsc. We need to update the all_allocated flags immediately (periodic counting alone would suffer from undersampling), so, until now, we are calling this inefficient function every time a channel state changes. Instead of iterating all channels for any chan state changes anywhere, keep global state of the current channel counts, and on channel state change only update those ts, trx, bts counts that actually change. A desirable side effect: for connection stats and handover decision 2, we can now also use the globally updated channel counts and save a bunch of inefficient iterations. To get accurate channel counts at all times, spread around some chan_counts_ts_update() calls in pivotal places. It re-counts the given timeslot and cascades counter changes, iff required. Just in case I missed some channel accounting, still run an inefficient iterating count regularly that detects errors, logs them and fixes them. No real harm done if such error appears. None show in ttcn3 BSC_Tests. It is fine to do the inefficient iteration once per second; channel state changes can realistically happen hundreds of times per second. Related: SYS#5976 Change-Id: I580bfae329aac8d4552723164741536af6512011 --- M include/osmocom/bsc/bsc_stats.h M include/osmocom/bsc/bts.h M include/osmocom/bsc/bts_trx.h M include/osmocom/bsc/chan_counts.h M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/abis_rsl.c M src/osmo-bsc/bsc_stats.c M src/osmo-bsc/chan_counts.c M src/osmo-bsc/handover_decision_2.c M src/osmo-bsc/lchan_fsm.c M src/osmo-bsc/osmo_bsc_main.c M src/osmo-bsc/timeslot_fsm.c M tests/handover/handover_test.c 13 files changed, 321 insertions(+), 95 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/05/28205/1 diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h index edd36b6..e8837aa 100644 --- a/include/osmocom/bsc/bsc_stats.h +++ b/include/osmocom/bsc/bsc_stats.h @@ -22,6 +22,7 @@ struct osmo_stat_item_group_desc; struct gsm_network; +struct gsm_bts; /* OsmoBSC rate_ctr indexes */ enum { @@ -111,4 +112,5 @@ void bsc_update_connection_stats(struct gsm_network *net); +void all_allocated_update_bts(struct gsm_bts *bts); void all_allocated_update_bsc(); diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index fc3ebce..66cf68f 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -637,6 +637,7 @@ /* At what point in the channel allocation sequence to dispatch the Immediate Assignment (Abis optimization) */ enum imm_ass_time imm_ass_time; + struct chan_counts chan_counts; struct all_allocated all_allocated; }; diff --git a/include/osmocom/bsc/bts_trx.h b/include/osmocom/bsc/bts_trx.h index c8df9d9..eab5fec 100644 --- a/include/osmocom/bsc/bts_trx.h +++ b/include/osmocom/bsc/bts_trx.h @@ -79,6 +79,8 @@ } rbs2000; }; struct gsm_bts_trx_ts ts[TRX_NR_TS]; + + struct chan_counts chan_counts; }; static inline struct gsm_bts_trx *gsm_bts_bb_trx_get_trx(struct gsm_bts_bb_trx *bb_transc) { diff --git a/include/osmocom/bsc/chan_counts.h b/include/osmocom/bsc/chan_counts.h index 31a1adc..c11473e 100644 --- a/include/osmocom/bsc/chan_counts.h +++ b/include/osmocom/bsc/chan_counts.h @@ -3,6 +3,14 @@ struct gsm_bts; struct gsm_bts_trx; +struct gsm_bts_trx_ts; +struct gsm_lchan; + +void chan_counts_sig_init(); +void chan_counts_ts_update(struct gsm_bts_trx_ts *ts); +void chan_counts_ts_clear(struct gsm_bts_trx_ts *ts); +void chan_counts_trx_update(struct gsm_bts_trx *trx); +void chan_counts_bsc_verify(); /* First array index to chan_counts.val. */ enum chan_counts_dim1 { @@ -29,17 +37,29 @@ }; struct chan_counts { - unsigned int val[_CHAN_COUNTS1_NUM][_CHAN_COUNTS2_NUM][_GSM_LCHAN_MAX]; + /* Signed type, so that chan_counts_diff() can return negative values. */ + int val[_CHAN_COUNTS1_NUM][_CHAN_COUNTS2_NUM][_GSM_LCHAN_MAX]; }; -void chan_counts_for_bts(struct chan_counts *bts_counts, const struct gsm_bts *bts); -void chan_counts_for_trx(struct chan_counts *trx_counts, const struct gsm_bts_trx *trx); - static inline void chan_counts_zero(struct chan_counts *counts) { *counts = (struct chan_counts){0}; } +static inline bool chan_counts_is_zero(const struct chan_counts *counts) +{ + int i1, i2, i3; + for (i1 = 0; i1 < _CHAN_COUNTS1_NUM; i1++) { + for (i2 = 0; i2 < _CHAN_COUNTS2_NUM; i2++) { + for (i3 = 0; i3 < _GSM_LCHAN_MAX; i3++) { + if (counts->val[i1][i2][i3]) + return false; + } + } + } + return true; +} + static inline void chan_counts_dim3_add(struct chan_counts *dst, enum chan_counts_dim1 dst_dim1, enum chan_counts_dim2 dst_dim2, const struct chan_counts *add, @@ -68,9 +88,24 @@ chan_counts_dim3_add(dst, dst_dim1, i, add, add_dim1, i); } +static inline void chan_counts_dim2_sub(struct chan_counts *dst, enum chan_counts_dim1 dst_dim1, + const struct chan_counts *sub, enum chan_counts_dim1 sub_dim1) +{ + int i; + for (i = 0; i < _CHAN_COUNTS2_NUM; i++) + chan_counts_dim3_sub(dst, dst_dim1, i, sub, sub_dim1, i); +} + static inline void chan_counts_add(struct chan_counts *dst, const struct chan_counts *add) { int i; for (i = 0; i < _CHAN_COUNTS1_NUM; i++) chan_counts_dim2_add(dst, i, add, i); } + +static inline void chan_counts_sub(struct chan_counts *dst, const struct chan_counts *sub) +{ + int i; + for (i = 0; i < _CHAN_COUNTS1_NUM; i++) + chan_counts_dim2_sub(dst, i, sub, i); +} diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 88c6474..126c7a7 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -34,6 +34,7 @@ #include <osmocom/bsc/meas_rep.h> #include <osmocom/bsc/acc.h> #include <osmocom/bsc/osmux.h> +#include <osmocom/bsc/chan_counts.h> #define GSM_T3122_DEFAULT 10 @@ -962,6 +963,8 @@ * Does not include count of secondary VAMOS lchans. */ uint8_t max_primary_lchans; struct gsm_lchan lchan[TS_MAX_LCHAN]; + + struct chan_counts chan_counts; }; #define GSM_LCHAN_SI(lchan, i) (void *)((lchan)->si.buf[i][0]) @@ -1320,6 +1323,7 @@ struct smlc_config *smlc; + struct chan_counts chan_counts; struct all_allocated all_allocated; }; diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index 0341235..d37fac8 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -2079,7 +2079,6 @@ struct gsm_lchan *_select_sdcch_for_call(struct gsm_bts *bts, const struct chan_rqd *rqd, enum gsm_chan_t lctype) { - struct chan_counts bts_counts; struct gsm_lchan *lchan = NULL; int free_tchf, free_tchh; bool needs_dyn_switch; @@ -2091,9 +2090,8 @@ needs_dyn_switch = lchan->ts->pchan_on_init == GSM_PCHAN_OSMO_DYN && lchan->ts->pchan_is != GSM_PCHAN_SDCCH8_SACCH8C; - chan_counts_for_bts(&bts_counts, bts); - free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; - free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; + free_tchf = bts->chan_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; + free_tchh = bts->chan_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; if (free_tchf == 0 && free_tchh == 0) { LOG_BTS(bts, DRSL, LOGL_INFO, "CHAN RQD: 0x%x Requesting %s reason=call but no TCH available\n", diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c index 2632ac8..e8c39be 100644 --- a/src/osmo-bsc/bsc_stats.c +++ b/src/osmo-bsc/bsc_stats.c @@ -183,6 +183,8 @@ bts_oml_connected++; if (trx_rsl_connected == num_trx) bts_rsl_all_trx_connected++; + + all_allocated_update_bts(bts); } osmo_stat_item_set(osmo_stat_item_group_get_item(net->bsc_statg, BSC_STAT_NUM_BTS_OML_CONNECTED), @@ -194,8 +196,9 @@ trx_rsl_connected_total); osmo_stat_item_set(osmo_stat_item_group_get_item(net->bsc_statg, BSC_STAT_NUM_TRX_TOTAL), num_trx_total); - /* Make sure to notice cells that become disconnected */ - all_allocated_update_bsc(); + /* This is optional, just running this to catch bugs in chan_counts accounting. If there is a bug, there will be + * a DLGLOBAL ERROR logged, and the error gets fixed. */ + chan_counts_bsc_verify(); } static void all_allocated_update(struct all_allocated *all_allocated, const struct chan_counts *c) @@ -221,19 +224,13 @@ + c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); } -void all_allocated_update_bsc() { +void all_allocated_update_bts(struct gsm_bts *bts) +{ + all_allocated_update(&bts->all_allocated, &bts->chan_counts); +} + +void all_allocated_update_bsc() +{ struct gsm_network *net = bsc_gsmnet; - struct gsm_bts *bts; - struct chan_counts bsc_counts; - - chan_counts_zero(&bsc_counts); - - llist_for_each_entry(bts, &net->bts_list, list) { - struct chan_counts bts_counts; - chan_counts_for_bts(&bts_counts, bts); - all_allocated_update(&bts->all_allocated, &bts_counts); - chan_counts_add(&bsc_counts, &bts_counts); - } - - all_allocated_update(&net->all_allocated, &bsc_counts); + all_allocated_update(&net->all_allocated, &net->chan_counts); } diff --git a/src/osmo-bsc/chan_counts.c b/src/osmo-bsc/chan_counts.c index 99e6e76..61e51c4 100644 --- a/src/osmo-bsc/chan_counts.c +++ b/src/osmo-bsc/chan_counts.c @@ -26,6 +26,8 @@ #include <osmocom/bsc/bts_trx.h> #include <osmocom/bsc/lchan_fsm.h> #include <osmocom/bsc/chan_counts.h> +#include <osmocom/bsc/bsc_stats.h> +#include <osmocom/bsc/signal.h> static const unsigned int lchans_per_pchan[_GSM_PCHAN_MAX][_GSM_LCHAN_MAX] = { [GSM_PCHAN_NONE] = {0}, @@ -68,75 +70,237 @@ dst->val[dim1][dim2][i] += lchans_per_pchan[pchan][i]; } -void chan_counts_for_trx(struct chan_counts *trx_counts, const struct gsm_bts_trx *trx) +static const char *chan_counts_dim1_name[] = { + [CHAN_COUNTS1_ALL] = "all", + [CHAN_COUNTS1_STATIC] = "static", + [CHAN_COUNTS1_DYNAMIC] = "dynamic", +}; + +static const char *chan_counts_dim2_name[] = { + [CHAN_COUNTS2_MAX_TOTAL] = "max", + [CHAN_COUNTS2_CURRENT_TOTAL] = "current", + [CHAN_COUNTS2_ALLOCATED] = "alloc", + [CHAN_COUNTS2_FREE] = "free", +}; + +int chan_counts_to_str_buf(char *buf, size_t buflen, const struct chan_counts *c) { - const struct gsm_bts_trx_ts *ts; + struct osmo_strbuf sb = { .buf = buf, .len = buflen }; + int i1, i2, i3; + OSMO_STRBUF_PRINTF(sb, "{"); + for (i1 = 0; i1 < _CHAN_COUNTS1_NUM; i1++) { + for (i2 = 0; i2 < _CHAN_COUNTS2_NUM; i2++) { + bool p12 = false; + + for (i3 = 0; i3 < _GSM_LCHAN_MAX; i3++) { + + int v = c->val[i1][i2][i3]; + if (v) { + if (!p12) { + p12 = true; + OSMO_STRBUF_PRINTF(sb, " %s.%s{", chan_counts_dim1_name[i1], + chan_counts_dim2_name[i2]); + } + OSMO_STRBUF_PRINTF(sb, " %s=%d", gsm_lchant_name(i3), v); + } + } + + if (p12) + OSMO_STRBUF_PRINTF(sb, " }"); + } + } + OSMO_STRBUF_PRINTF(sb, " }"); + return sb.chars_needed; +} + +char *chan_counts_to_str_c(void *ctx, const struct chan_counts *c) +{ + OSMO_NAME_C_IMPL(ctx, 64, "ERROR", chan_counts_to_str_buf, c) +} + +void chan_counts_for_ts(struct chan_counts *ts_counts, const struct gsm_bts_trx_ts *ts) +{ const struct gsm_lchan *lchan; - int i; + bool ts_is_dynamic; - chan_counts_zero(trx_counts); + chan_counts_zero(ts_counts); - if (!trx_is_usable(trx)) + if (!ts_is_usable(ts)) return; + /* Count the full potential nr of lchans for dynamic TS */ + chan_counts_per_pchan_add(ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_MAX_TOTAL, ts->pchan_on_init); + + switch (ts->pchan_on_init) { + case GSM_PCHAN_TCH_F_PDCH: + case GSM_PCHAN_OSMO_DYN: + ts_is_dynamic = true; + break; + default: + ts_is_dynamic = false; + break; + } + + if (ts_is_dynamic && ts->pchan_is == GSM_PCHAN_PDCH) { + /* Dynamic timeslots in PDCH mode can become TCH or SDCCH immediately, + * so set CURRENT_TOTAL = MAX_TOTAL. */ + chan_counts_dim3_add(ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_CURRENT_TOTAL, + ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_MAX_TOTAL); + } else { + /* Static TS, or dyn TS that are currently fixed on a specific pchan: count lchans for the + * current pchan mode. */ + chan_counts_per_pchan_add(ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_CURRENT_TOTAL, ts->pchan_is); + } + + /* Count currently allocated lchans */ + ts_for_n_lchans(lchan, ts, ts->max_primary_lchans) { + if (!lchan_state_is(lchan, LCHAN_ST_UNUSED)) + ts_counts->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_ALLOCATED][lchan->type]++; + } + + chan_counts_dim3_add(ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_FREE, + ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_CURRENT_TOTAL); + chan_counts_dim3_sub(ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_FREE, + ts_counts, CHAN_COUNTS1_ALL, CHAN_COUNTS2_ALLOCATED); + + if (ts_is_dynamic) + chan_counts_dim2_add(ts_counts, CHAN_COUNTS1_DYNAMIC, ts_counts, CHAN_COUNTS1_ALL); + else + chan_counts_dim2_add(ts_counts, CHAN_COUNTS1_STATIC, ts_counts, CHAN_COUNTS1_ALL); +} + +static void chan_counts_diff(struct chan_counts *diff, const struct chan_counts *left, const struct chan_counts *right) +{ + chan_counts_zero(diff); + chan_counts_add(diff, right); + chan_counts_sub(diff, left); +} + +static void _chan_counts_ts_update(struct gsm_bts_trx_ts *ts, const struct chan_counts *ts_new_counts) +{ + struct chan_counts diff; + + chan_counts_diff(&diff, &ts->chan_counts, ts_new_counts); + if (chan_counts_is_zero(&diff)) + return; + + ts->chan_counts = *ts_new_counts; + chan_counts_add(&ts->trx->chan_counts, &diff); + chan_counts_add(&ts->trx->bts->chan_counts, &diff); + chan_counts_add(&bsc_gsmnet->chan_counts, &diff); + + all_allocated_update_bts(ts->trx->bts); + all_allocated_update_bsc(); + + LOGP(DLGLOBAL, LOGL_DEBUG, "change in channel counts: ts %u-%u-%u: %s\n", + ts->trx->bts->nr, ts->trx->nr, ts->nr, chan_counts_to_str_c(OTC_SELECT, &diff)); + LOGP(DLGLOBAL, LOGL_DEBUG, "bsc channel counts: %s\n", + chan_counts_to_str_c(OTC_SELECT, &bsc_gsmnet->chan_counts)); +} + +/* Re-count this TS, and update ts->chan_counts. If the new ts->chan_counts differ, propagate the difference to + * trx->chan_counts, bts->chan_counts and gsm_network->chan_counts. */ +void chan_counts_ts_update(struct gsm_bts_trx_ts *ts) +{ + struct chan_counts ts_new_counts; + chan_counts_for_ts(&ts_new_counts, ts); + _chan_counts_ts_update(ts, &ts_new_counts); +} + +void chan_counts_ts_clear(struct gsm_bts_trx_ts *ts) +{ + struct chan_counts ts_new_counts = {0}; + _chan_counts_ts_update(ts, &ts_new_counts); +} + +void chan_counts_trx_update(struct gsm_bts_trx *trx) +{ + int i; for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { - bool ts_is_dynamic; - struct chan_counts ts_count = {0}; - ts = &trx->ts[i]; - if (!ts_is_usable(ts)) - continue; - - /* Count the full potential nr of lchans for dynamic TS */ - chan_counts_per_pchan_add(&ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_MAX_TOTAL, ts->pchan_on_init); - - switch (ts->pchan_on_init) { - case GSM_PCHAN_TCH_F_PDCH: - case GSM_PCHAN_OSMO_DYN: - ts_is_dynamic = true; - break; - default: - ts_is_dynamic = false; - break; - } - - if (ts_is_dynamic && ts->pchan_is == GSM_PCHAN_PDCH) { - /* Dynamic timeslots in PDCH mode can become TCH or SDCCH immediately, - * so set CURRENT_TOTAL = MAX_TOTAL. */ - chan_counts_dim3_add(&ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_CURRENT_TOTAL, - &ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_MAX_TOTAL); - } else { - /* Static TS, or dyn TS that are currently fixed on a specific pchan: count lchans for the - * current pchan mode. */ - chan_counts_per_pchan_add(&ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_CURRENT_TOTAL, ts->pchan_is); - } - - /* Count currently allocated lchans */ - ts_for_n_lchans(lchan, ts, ts->max_primary_lchans) { - if (!lchan_state_is(lchan, LCHAN_ST_UNUSED)) - ts_count.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_ALLOCATED][lchan->type]++; - } - - chan_counts_dim3_add(&ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_FREE, - &ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_CURRENT_TOTAL); - chan_counts_dim3_sub(&ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_FREE, - &ts_count, CHAN_COUNTS1_ALL, CHAN_COUNTS2_ALLOCATED); - - if (ts_is_dynamic) - chan_counts_dim2_add(trx_counts, CHAN_COUNTS1_DYNAMIC, &ts_count, CHAN_COUNTS1_ALL); - else - chan_counts_dim2_add(trx_counts, CHAN_COUNTS1_STATIC, &ts_count, CHAN_COUNTS1_ALL); - chan_counts_dim2_add(trx_counts, CHAN_COUNTS1_ALL, &ts_count, CHAN_COUNTS1_ALL); + struct gsm_bts_trx_ts *ts = &trx->ts[i]; + chan_counts_ts_update(ts); } } -void chan_counts_for_bts(struct chan_counts *bts_counts, const struct gsm_bts *bts) +static int chan_counts_sig_cb(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data) { + struct nm_running_chg_signal_data *nsd; struct gsm_bts_trx *trx; - chan_counts_zero(bts_counts); + if (!(signal == S_NM_RUNNING_CHG || signal == S_NM_STATECHG)) + return 0; + nsd = signal_data; + switch (nsd->obj_class) { + case NM_OC_RADIO_CARRIER: + trx = (struct gsm_bts_trx *)nsd->obj; + chan_counts_trx_update(trx); + return 0; + default: + return 0; + } +} - llist_for_each_entry(trx, &bts->trx_list, list) { - struct chan_counts trx_counts; - chan_counts_for_trx(&trx_counts, trx); - chan_counts_add(bts_counts, &trx_counts); +void chan_counts_sig_init(void) +{ + osmo_signal_register_handler(SS_NM, chan_counts_sig_cb, NULL); +} + +void chan_counts_bsc_verify() +{ + struct gsm_bts *bts; + struct chan_counts bsc_counts = {0}; + struct chan_counts diff; + + llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) { + struct gsm_bts_trx *trx; + struct chan_counts bts_counts = {0}; + + llist_for_each_entry(trx, &bts->trx_list, list) { + struct chan_counts trx_counts = {0}; + int i; + + for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { + struct chan_counts ts_counts; + struct gsm_bts_trx_ts *ts = &trx->ts[i]; + chan_counts_for_ts(&ts_counts, ts); + + chan_counts_diff(&diff, &ts->chan_counts, &ts_counts); + if (!chan_counts_is_zero(&diff)) { + LOGP(DLGLOBAL, LOGL_ERROR, + "internal error in channel counts, on bts-trx-ts %u-%u-%u, fixing." + " diff: %s\n", + bts->nr, trx->nr, ts->nr, + chan_counts_to_str_c(OTC_SELECT, &diff)); + ts->chan_counts = ts_counts; + } + + chan_counts_add(&trx_counts, &ts_counts); + } + + chan_counts_diff(&diff, &trx->chan_counts, &trx_counts); + if (!chan_counts_is_zero(&diff)) { + LOGP(DLGLOBAL, LOGL_ERROR, "internal error in channel counts, on bts-trx %u-%u, fixing." + " diff: %s\n", + bts->nr, trx->nr, chan_counts_to_str_c(OTC_SELECT, &diff)); + trx->chan_counts = trx_counts; + } + + chan_counts_add(&bts_counts, &trx_counts); + } + + chan_counts_diff(&diff, &bts->chan_counts, &bts_counts); + if (!chan_counts_is_zero(&diff)) { + LOGP(DLGLOBAL, LOGL_ERROR, "internal error in channel counts, on bts %u, fixing. diff: %s\n", + bts->nr, chan_counts_to_str_c(OTC_SELECT, &diff)); + bts->chan_counts = bts_counts; + } + + chan_counts_add(&bsc_counts, &bts_counts); + } + + chan_counts_diff(&diff, &bsc_gsmnet->chan_counts, &bsc_counts); + if (!chan_counts_is_zero(&diff)) { + LOGP(DLGLOBAL, LOGL_ERROR, "internal error in overall channel counts, fixing. diff: %s\n", + chan_counts_to_str_c(OTC_SELECT, &diff)); + bsc_gsmnet->chan_counts = bsc_counts; } } diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c index c88e846..a1a8ffa 100644 --- a/src/osmo-bsc/handover_decision_2.c +++ b/src/osmo-bsc/handover_decision_2.c @@ -1004,13 +1004,13 @@ static void candidate_set_free_tch(struct ho_candidate *c) { - struct chan_counts bts_counts; + struct chan_counts *bts_counts; struct gsm_lchan *next_lchan; - chan_counts_for_bts(&bts_counts, c->current.bts); - c->current.free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; + bts_counts = &c->current.bts->chan_counts; + c->current.free_tchf = bts_counts->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; c->current.min_free_tchf = ho_get_hodec2_tchf_min_slots(c->current.bts->ho); - c->current.free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; + c->current.free_tchh = bts_counts->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; c->current.min_free_tchh = ho_get_hodec2_tchh_min_slots(c->current.bts->ho); switch (c->current.lchan->ts->pchan_is) { @@ -1042,10 +1042,10 @@ /* For inter-BSC handover, the target BTS is in a different BSC and hence NULL here. */ if (c->target.bts) { - chan_counts_for_bts(&bts_counts, c->target.bts); - c->target.free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; + bts_counts = &c->target.bts->chan_counts; + c->target.free_tchf = bts_counts->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; c->target.min_free_tchf = ho_get_hodec2_tchf_min_slots(c->target.bts->ho); - c->target.free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; + c->target.free_tchh = bts_counts->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; c->target.min_free_tchh = ho_get_hodec2_tchh_min_slots(c->target.bts->ho); /* Would the next TCH/F lchan occupy a dynamic timeslot that currently counts for free TCH/H timeslots? @@ -1959,7 +1959,7 @@ static void bts_congestion_check(struct gsm_bts *bts) { - struct chan_counts bts_counts; + struct chan_counts *bts_counts; int min_free_tchf, min_free_tchh; int free_tchf, free_tchh; @@ -1987,9 +1987,9 @@ return; } - chan_counts_for_bts(&bts_counts, bts); - free_tchf = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; - free_tchh = bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; + bts_counts = &bts->chan_counts; + free_tchf = bts_counts->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]; + free_tchh = bts_counts->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]; LOGPHOBTS(bts, LOGL_INFO, "Congestion check: (free/want-free) TCH/F=%d/%d TCH/H=%d/%d\n", free_tchf, min_free_tchf, free_tchh, min_free_tchh); diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index e3ae4a6..2d566b6 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -523,15 +523,20 @@ struct gsm_lchan *lchan = lchan_fi_lchan(fi); struct gsm_bts *bts = lchan->ts->trx->bts; lchan_reset(lchan); + chan_counts_ts_update(lchan->ts); osmo_fsm_inst_dispatch(lchan->ts->fi, TS_EV_LCHAN_UNUSED, lchan); - all_allocated_update_bsc(); - /* Poll the channel request queue, so that waiting calls can make use of the lchan that just * has become unused now. */ abis_rsl_chan_rqd_queue_poll(bts); } +static void lchan_fsm_cbch_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gsm_lchan *lchan = lchan_fi_lchan(fi); + chan_counts_ts_update(lchan->ts); +} + static void lchan_fsm_wait_after_error_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct gsm_lchan *lchan = lchan_fi_lchan(fi); @@ -707,7 +712,7 @@ return; } - all_allocated_update_bsc(); + chan_counts_ts_update(lchan->ts); lchan->conn = info->for_conn; @@ -1477,6 +1482,7 @@ /* The actual action besides all the beancounting above */ lchan_reset(lchan); + chan_counts_ts_update(lchan->ts); } static void lchan_fsm_borken(struct osmo_fsm_inst *fi, uint32_t event, void *data) @@ -1550,6 +1556,7 @@ }, [LCHAN_ST_CBCH] = { .name = "CBCH", + .onenter = lchan_fsm_cbch_onenter, .out_state_mask = 0 | S(LCHAN_ST_UNUSED) , diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index c78bb45..f6da74a 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -1026,6 +1026,7 @@ osmo_init_ignore_signals(); update_connection_stats_cb(NULL); + chan_counts_sig_init(); if (daemonize) { rc = osmo_daemonize(); diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c index 86fea3c..fbf6c5e 100644 --- a/src/osmo-bsc/timeslot_fsm.c +++ b/src/osmo-bsc/timeslot_fsm.c @@ -229,6 +229,7 @@ } break; } + chan_counts_ts_update(ts); } static void ts_setup_lchans(struct gsm_bts_trx_ts *ts) @@ -315,11 +316,19 @@ osmo_fsm_inst_state_chg(fi, TS_ST_UNUSED, 0, 0); } +static void ts_fsm_not_initialized_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct gsm_bts_trx_ts *ts = ts_fi_ts(fi); + chan_counts_ts_clear(ts); +} + static void ts_fsm_unused_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct gsm_bts_trx_ts *ts = ts_fi_ts(fi); struct gsm_bts *bts = ts->trx->bts; + chan_counts_ts_update(ts); + /* We are entering the unused state. There must by definition not be any lchans waiting to be * activated. */ if (ts_lchans_waiting(ts)) { @@ -665,6 +674,8 @@ return; } + chan_counts_ts_update(ts); + /* Make sure dyn TS pchan_is is updated. For TCH/F_PDCH, there are only PDCH or TCH/F modes, but * for Osmocom style TCH/F_TCH/H_SDCCH8_PDCH the pchan_is == NONE until an lchan is activated. */ if (ts->pchan_on_init == GSM_PCHAN_OSMO_DYN) @@ -848,6 +859,7 @@ static const struct osmo_fsm_state ts_fsm_states[] = { [TS_ST_NOT_INITIALIZED] = { .name = "NOT_INITIALIZED", + .onenter = ts_fsm_not_initialized_onenter, .action = ts_fsm_not_initialized, .in_event_mask = 0 | S(TS_EV_OML_READY) diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index c01b6ee..d82ba9f 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -479,6 +479,8 @@ .len = 5, }; + chan_counts_ts_update(lchan->ts); + return lchan; } @@ -522,6 +524,7 @@ continue; lchan_clear(lchan); } + chan_counts_ts_update(ts); } bool _set_ts_use(struct gsm_bts *bts, struct gsm_bts_trx *trx, const char * const *ts_use) -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28205 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I580bfae329aac8d4552723164741536af6512011 Gerrit-Change-Number: 28205 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: drop log from ts_is_usable()
by neels 30 May '22

30 May '22
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28203 ) Change subject: drop log from ts_is_usable() ...................................................................... drop log from ts_is_usable() ts_is_usable() returns the current state; logging is the job of calling functions. An upcoming patch adds some calls to ts_is_usable(), this avoids the log flaring up with useless messages. Related: SYS#5976 Change-Id: I0635c47609fd7c7d0195b6658b7da231d6527b4b --- M src/osmo-bsc/gsm_data.c 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/03/28203/1 diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 1d6df12..ad28058 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -960,10 +960,8 @@ bool ts_is_usable(const struct gsm_bts_trx_ts *ts) { - if (!trx_is_usable(ts->trx)) { - LOGP(DRLL, LOGL_DEBUG, "%s not usable\n", gsm_trx_name(ts->trx)); + if (!trx_is_usable(ts->trx)) return false; - } if (!ts->fi) return false; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28203 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I0635c47609fd7c7d0195b6658b7da231d6527b4b Gerrit-Change-Number: 28203 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-ttcn3-hacks[master]: bsc/osmo-bsc.cfg: change logging level nm info -> notice
by fixeria 29 May '22

29 May '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28202 ) Change subject: bsc/osmo-bsc.cfg: change logging level nm info -> notice ...................................................................... bsc/osmo-bsc.cfg: change logging level nm info -> notice Stop spamming logs with tons of DNM messages (state changes, events). GSMTAP emits all these messages (including 'debug' ones) anyway. Related: I49352b3caf9f6bbdd594cfcdea54038fc0eaa874 (docker-playground.git) Change-Id: I9e60ea0968a44aa29753226626864ac9f4c1f8ab --- M bsc/osmo-bsc.cfg 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/02/28202/1 diff --git a/bsc/osmo-bsc.cfg b/bsc/osmo-bsc.cfg index 63a82b0..2f8ee6d 100644 --- a/bsc/osmo-bsc.cfg +++ b/bsc/osmo-bsc.cfg @@ -18,7 +18,7 @@ logging level mm notice logging level rr notice logging level rsl notice - logging level nm info + logging level nm notice logging level pag notice logging level meas notice logging level msc notice -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28202 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: I9e60ea0968a44aa29753226626864ac9f4c1f8ab Gerrit-Change-Number: 28202 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in docker-playground[master]: osmo-bsc.cfg: change logging level nm info -> notice
by fixeria 29 May '22

29 May '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/28201 ) Change subject: osmo-bsc.cfg: change logging level nm info -> notice ...................................................................... osmo-bsc.cfg: change logging level nm info -> notice Stop spamming logs with tons of DNM messages (state changes, events). GSMTAP emits all these messages (including 'debug' ones) anyway. Related: I9e60ea0968a44aa29753226626864ac9f4c1f8ab (osmo-ttcn3-hacks.git) Change-Id: I49352b3caf9f6bbdd594cfcdea54038fc0eaa874 --- M osmo-bsc-latest/osmo-bsc.cfg M osmo-bsc-master/osmo-bsc.cfg M ttcn3-bsc-test/osmo-bsc.cfg 3 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/01/28201/1 diff --git a/osmo-bsc-latest/osmo-bsc.cfg b/osmo-bsc-latest/osmo-bsc.cfg index 861bcc8..79d765f 100644 --- a/osmo-bsc-latest/osmo-bsc.cfg +++ b/osmo-bsc-latest/osmo-bsc.cfg @@ -12,7 +12,7 @@ logging level mm notice logging level rr notice logging level rsl notice - logging level nm info + logging level nm notice logging level pag notice logging level meas notice logging level msc notice diff --git a/osmo-bsc-master/osmo-bsc.cfg b/osmo-bsc-master/osmo-bsc.cfg index 5731014..4d331de 100644 --- a/osmo-bsc-master/osmo-bsc.cfg +++ b/osmo-bsc-master/osmo-bsc.cfg @@ -13,7 +13,7 @@ logging level mm notice logging level rr notice logging level rsl notice - logging level nm info + logging level nm notice logging level pag notice logging level meas notice logging level msc notice diff --git a/ttcn3-bsc-test/osmo-bsc.cfg b/ttcn3-bsc-test/osmo-bsc.cfg index 532999e..cfc6186 100644 --- a/ttcn3-bsc-test/osmo-bsc.cfg +++ b/ttcn3-bsc-test/osmo-bsc.cfg @@ -17,7 +17,7 @@ logging level mm notice logging level rr notice logging level rsl notice - logging level nm info + logging level nm notice logging level pag notice logging level meas notice logging level msc notice -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/28201 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I49352b3caf9f6bbdd594cfcdea54038fc0eaa874 Gerrit-Change-Number: 28201 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: bsc_vty: use llist_for_each_entry in lchan_act_all_cmd
by fixeria 29 May '22

29 May '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28194 ) Change subject: bsc_vty: use llist_for_each_entry in lchan_act_all_cmd ...................................................................... bsc_vty: use llist_for_each_entry in lchan_act_all_cmd Change-Id: Iaa29696c8de268796da118e7ea3384b6186bf688 --- M src/osmo-bsc/bsc_vty.c 1 file changed, 2 insertions(+), 7 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index d293862..fc03c78 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -1787,9 +1787,7 @@ struct gsm_network *net = gsmnet_from_vty(vty); const char *act_str = argv[0]; int activate; - int bts_nr; struct gsm_bts *bts; - int trx_nr; struct gsm_bts_trx *trx; if (!strcmp(act_str, "activate-all-lchan")) @@ -1797,12 +1795,9 @@ else activate = 0; - for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) { - bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr); - for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) { - trx = gsm_bts_trx_num(bts, trx_nr); + llist_for_each_entry(bts, &net->bts_list, list) { + llist_for_each_entry(trx, &bts->trx_list, list) lchan_act_trx(vty, trx, activate); - } } vty_out(vty, "%% All channels have been %s on all BTS/TRX, please " -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28194 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Iaa29696c8de268796da118e7ea3384b6186bf688 Gerrit-Change-Number: 28194 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-bsc[master]: fix gsm_lchan_and_pchan2chan_nr(): log proper lchan_nr value
by fixeria 29 May '22

29 May '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28195 ) Change subject: fix gsm_lchan_and_pchan2chan_nr(): log proper lchan_nr value ...................................................................... fix gsm_lchan_and_pchan2chan_nr(): log proper lchan_nr value VAMOS lchans are behind the primary ones in the ts->lchan[] array. For example, for TCH/F, there is a primary ts->lchan[0] and a VAMOS ts->lchan[1]. We should print 'ss 0' for both of them. Change-Id: I8e7a5a2ecc9b9a33e3ddb76cb1bc04d7802fd320 --- M src/osmo-bsc/gsm_data.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 64c348f..1d6df12 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -600,7 +600,7 @@ if (rc < 0) LOG_LCHAN(lchan, LOGL_ERROR, "Error encoding Channel Number: pchan %s ts %u ss %u%s\n", - gsm_pchan_name(lchan->ts->pchan_from_config), lchan->ts->nr, lchan->nr, + gsm_pchan_name(lchan->ts->pchan_from_config), lchan->ts->nr, lchan_nr, lchan->vamos.is_secondary ? " (VAMOS shadow)" : ""); return rc; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28195 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I8e7a5a2ecc9b9a33e3ddb76cb1bc04d7802fd320 Gerrit-Change-Number: 28195 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-bsc[master]: bsc_vty: use llist_for_each_entry in lchan_act_all_cmd
by laforge 29 May '22

29 May '22
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28194 ) Change subject: bsc_vty: use llist_for_each_entry in lchan_act_all_cmd ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28194 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Iaa29696c8de268796da118e7ea3384b6186bf688 Gerrit-Change-Number: 28194 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Sun, 29 May 2022 13:42:09 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • ...
  • 135
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.