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

June 2022

  • 3 participants
  • 1374 discussions
Change in osmo-ttcn3-hacks[master]: BSC_Tests: add TC_chan_alloc_algo_{a,de}scending
by neels 02 Jun '22

02 Jun '22
Attention is currently required from: pespin, fixeria. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28214 ) Change subject: BSC_Tests: add TC_chan_alloc_algo_{a,de}scending ...................................................................... Patch Set 1: (1 comment) File bsc/BSC_Tests.ttcn: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28214/comment/b5c05e65_6408… PS1, Line 11551: /* HACK: work around "Couldn't find Expect for CRCX" */ > This needs some further explanation... (maybe you want to var ExpectCriteria mgcpcrit := { connid := omit, endpoint := omit, transid := omit }; f_create_mgcp_expect(mgcpcrit); ?) -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28214 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: Ic74a9cd264320a9a17648f9331b67fb2c2404122 Gerrit-Change-Number: 28214 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 02 Jun 2022 18:44:02 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ttcn3-hacks[master]: DIAMETER: Send QoS AVPs in Gx CCA
by neels 02 Jun '22

02 Jun '22
Attention is currently required from: pespin. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28219 ) Change subject: DIAMETER: Send QoS AVPs in Gx CCA ...................................................................... Patch Set 1: Code-Review+1 (3 comments) File library/DIAMETER_Templates.ttcn: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28219/comment/25a6f723_f6df… PS1, Line 863: P_ should this also be called _PCC_? https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28219/comment/2fa373b5_8e28… PS1, Line 871: ts_AVP_3GPP_QosClassId() dropped intentionally? https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28219/comment/088eaae2_1a41… PS1, Line 1541: ault eps bea also drop this line apparently -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28219 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: Ib758d4e3acc331954aca6423372410cb1e341ebd Gerrit-Change-Number: 28219 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 02 Jun 2022 18:42:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in pysim[master]: commands: add ".." notation to expand hexstrings
by neels 02 Jun '22

02 Jun '22
Attention is currently required from: dexter. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/28218 ) Change subject: commands: add ".." notation to expand hexstrings ...................................................................... Patch Set 1: Code-Review+1 (1 comment) Patchset: PS1: i don't know this code, but the patch looks ok to me -- To view, visit https://gerrit.osmocom.org/c/pysim/+/28218 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Iedd7887bf7d706878f4a3beca8dbea456404610b Gerrit-Change-Number: 28218 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Thu, 02 Jun 2022 18:37:49 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-bsc[master]: fix performance for chan_counts and all_allocated stats
by neels 02 Jun '22

02 Jun '22
neels has submitted this change. ( 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, 323 insertions(+), 94 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve neels: Looks good to me, approved 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 e540f29..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,20 +224,13 @@ + c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H])); } +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..173bda0 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,241 @@ 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_NUM] = { + [CHAN_COUNTS1_ALL] = "all", + [CHAN_COUNTS1_STATIC] = "static", + [CHAN_COUNTS1_DYNAMIC] = "dynamic", +}; + +static const char *chan_counts_dim2_name[_CHAN_COUNTS2_NUM] = { + [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) + return 0; + nsd = signal_data; + switch (nsd->obj_class) { + case NM_OC_RADIO_CARRIER: + trx = (struct gsm_bts_trx *)nsd->obj; + break; + case NM_OC_BASEB_TRANSC: + trx = gsm_bts_bb_trx_get_trx((struct gsm_bts_bb_trx *)nsd->obj); + break; + default: + return 0; + } + chan_counts_trx_update(trx); + 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: 4 Gerrit-Owner: neels <nhofmeyr(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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-bsc[master]: drop log from ts_is_usable()
by neels 02 Jun '22

02 Jun '22
neels has submitted this change. ( 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(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve 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; 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- 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: 3 Gerrit-Owner: neels <nhofmeyr(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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-bsc[master]: code cleanup for all_allocated timers, no functional change
by neels 02 Jun '22

02 Jun '22
neels has submitted this change. ( 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, 51 insertions(+), 70 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved fixeria: Looks good to me, but someone else must approve 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..e540f29 100644 --- a/src/osmo-bsc/bsc_stats.c +++ b/src/osmo-bsc/bsc_stats.c @@ -195,67 +195,46 @@ 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; 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- 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: 3 Gerrit-Owner: neels <nhofmeyr(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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-bsc[master]: fix performance for chan_counts and all_allocated stats
by neels 02 Jun '22

02 Jun '22
Attention is currently required from: fixeria. neels 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 4: Code-Review+2 (1 comment) Patchset: PS4: combining votes -- 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: 4 Gerrit-Owner: neels <nhofmeyr(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-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 02 Jun 2022 18:30:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ttcn3-hacks[master]: DIAMETER: Send QoS AVPs in Gx CCA
by pespin 02 Jun '22

02 Jun '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28219 ) Change subject: DIAMETER: Send QoS AVPs in Gx CCA ...................................................................... DIAMETER: Send QoS AVPs in Gx CCA This way we can trigger code paths in GGSN/PGW parsing those. Change-Id: Ib758d4e3acc331954aca6423372410cb1e341ebd --- M library/DIAMETER_Templates.ttcn 1 file changed, 50 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/19/28219/1 diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn index 2bc9e77..03d136c 100644 --- a/library/DIAMETER_Templates.ttcn +++ b/library/DIAMETER_Templates.ttcn @@ -869,11 +869,47 @@ } } -template (value) GenericAVP ts_AVP_3GPP_QosClassId(uint32_t id) := { +template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Information(template (value) AVP_list list) := { + avp := { + avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information), + avp_data := { + avp_PCC_3GPP_QoS_Information := list + } + } +} + +template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(uint32_t val) := { + avp := { + avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL), + avp_data := { + avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL := int2oct(val, 4) + } + } +} + +template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(uint32_t val) := { + avp := { + avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL), + avp_data := { + avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL := int2oct(val, 4) + } + } +} + +template (value) GenericAVP ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS(template (value) AVP_list list) := { + avp := { + avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Default_EPS_Bearer_QoS), + avp_data := { + avp_PCC_3GPP_Default_EPS_Bearer_QoS := list + } + } +} + +template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Class_Identifier(uint32_t val) := { avp := { avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier), avp_data := { - avp_PCC_3GPP_QoS_Class_Identifier := int2oct(id, 4) + avp_PCC_3GPP_QoS_Class_Identifier := int2oct(val, 4) } } } @@ -887,8 +923,7 @@ } } - -template (value) GenericAVP ts_AVP_3GPP_AllocRetenPrio(uint32_t prio) := { +template (value) GenericAVP ts_AVP_PCC_3GPP_AllocRetenPrio(uint32_t prio) := { avp := { avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority), avp_data := { @@ -906,8 +941,8 @@ avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile), avp_data := { avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := { - ts_AVP_3GPP_QosClassId(qos_class), - ts_AVP_3GPP_AllocRetenPrio(prio) + ts_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class), + ts_AVP_PCC_3GPP_AllocRetenPrio(prio) } } } @@ -1494,8 +1529,15 @@ ts_AVP_OriginRealm("localdomain"), ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), ts_AVP_CcReqType(req_type), - ts_AVP_CcReqNum(req_num)//, - // qos + ts_AVP_CcReqNum(req_num), + ts_AVP_PCC_3GPP_QoS_Information({ + ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(33554432), + ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(52428800) + }), + ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS({ + ts_AVP_PCC_3GPP_QoS_Class_Identifier(9), + ts_AVP_PCC_3GPP_AllocRetenPrio(2) + }) // default eps bearer qos // supported features // origin -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28219 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: Ib758d4e3acc331954aca6423372410cb1e341ebd Gerrit-Change-Number: 28219 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in pysim[master]: commands: add ".." notation to expand hexstrings
by dexter 02 Jun '22

02 Jun '22
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/28218 ) Change subject: commands: add ".." notation to expand hexstrings ...................................................................... commands: add ".." notation to expand hexstrings When updating files and records there are sometimes huge portions that are just 0xff. Mostly this is at the end of a file or record that is not completely used. Lets add a notation to tell PySim-shell how to fill those sections. Change-Id: Iedd7887bf7d706878f4a3beca8dbea456404610b --- M pySim/commands.py M pySim/utils.py 2 files changed, 64 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/18/28218/1 diff --git a/pySim/commands.py b/pySim/commands.py index a959851..7b50677 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -23,7 +23,7 @@ from construct import * from pySim.construct import LV -from pySim.utils import rpad, b2h, h2b, sw_match, bertlv_encode_len, Hexstr, h2i, str_sanitize +from pySim.utils import rpad, b2h, h2b, sw_match, bertlv_encode_len, Hexstr, h2i, str_sanitize, expand_hex from pySim.exceptions import SwMatchError @@ -190,6 +190,10 @@ offset : byte offset in file from which to start writing verify : Whether or not to verify data after write """ + + file_len = self.binary_size(ef) + data = expand_hex(data, file_len) + data_length = len(data) // 2 # Save write cycles by reading+comparing before write @@ -255,16 +259,17 @@ verify : verify data by re-reading the record conserve : read record and compare it with data, skip write on match """ + res = self.select_path(ef) + rec_length = self.__record_len(res) + data = expand_hex(data, rec_length) if force_len: # enforce the record length by the actual length of the given data input rec_length = len(data) // 2 else: - # determine the record length from the select response of the file and pad - # the input data with 0xFF if necessary. In cases where the input data - # exceed we throw an exception. - rec_length = self.__record_len(res) + # make sure the input data is padded to the record length using 0xFF. + # In cases where the input data exceed we throw an exception. if (len(data) // 2 > rec_length): raise ValueError('Data length exceeds record length (expected max %d, got %d)' % ( rec_length, len(data) // 2)) diff --git a/pySim/utils.py b/pySim/utils.py index ef770f9..6b8ee37 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -1225,6 +1225,60 @@ return int(x, 0) +def expand_hex(hexstring, length): + """Expand a given hexstring to a specified length by replacing "." or ".." + with a filler that is derived from the neighboring nibbles respective + bytes. Usually this will be the nibble respective byte before "." or + "..", execpt when the string begins with "." or "..", then the nibble + respective byte after "." or ".." is used.". In case the string cannot + be expanded for some reason, the input string is returned unmodified. + + Args: + hexstring : hexstring to expand + length : desired length of the resulting hexstring. + Returns: + expanded hexstring + """ + + # expand digit aligned + if hexstring.count(".") == 1: + pos = hexstring.index(".") + if pos > 0: + filler = hexstring[pos - 1] + else: + filler = hexstring[pos + 1] + + missing = length * 2 - (len(hexstring) - 1) + if missing <= 0: + return hexstring + + return hexstring.replace(".", filler * missing) + + # expand byte aligned + elif hexstring.count("..") == 1: + if len(hexstring) % 2: + return hexstring + + pos = hexstring.index("..") + + if pos % 2: + return hexstring + + if pos > 1: + filler = hexstring[pos - 2:pos] + else: + filler = hexstring[pos + 2:pos+4] + + missing = length * 2 - (len(hexstring) - 2) + if missing <= 0: + return hexstring + + return hexstring.replace("..", filler * (missing // 2)) + + # no change + return hexstring + + class JsonEncoder(json.JSONEncoder): """Extend the standard library JSONEncoder with support for more types.""" -- To view, visit https://gerrit.osmocom.org/c/pysim/+/28218 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Iedd7887bf7d706878f4a3beca8dbea456404610b Gerrit-Change-Number: 28218 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(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 pespin 02 Jun '22

02 Jun '22
Attention is currently required from: neels, fixeria. pespin 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 4: Code-Review+1 -- 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: 4 Gerrit-Owner: neels <nhofmeyr(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-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 02 Jun 2022 12:40:57 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • ...
  • 138
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.