laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/33382 )
Change subject: prevent bogus NCH related error message if no NCH is configured ......................................................................
prevent bogus NCH related error message if no NCH is configured
Back in Change-Id Iefde0af44a663f22462a54d68a58caa560eceb2f I introduced indication of the NCH position in the SI1 rest octets.
However, a related ERROR messages is accidentially also printed in case no NCH is configured at all.
Let's split the already overly-complex if clause into a separate function which then also handles the "bts->nch.num_blocks == 0" case as permitted.
Change-Id: Iab2120a343cb0f6553f13a821b44b3c312587579 Related: OS#5781 --- M src/osmo-bsc/osmo_bsc_main.c 1 file changed, 43 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/82/33382/1
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index c4b5780..0757da0 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -375,6 +375,28 @@ osmo_timer_schedule(&update_connection_stats_timer, 1, 0); }
+static bool nch_position_compatible_with_combined_ccch(const struct gsm_bts *bts) +{ + switch (bts->nch.num_blocks) { + case 0: + /* no NCH enabled, so we are fine */ + return true; + case 1: + if (bts->nch.first_block == 0 || bts->nch.first_block == 1) + return true; + break; + case 2: + if (bts->nch.first_block == 0) + return true; + break; + default: + break; + } + + /* anything else is not permitted */ + return false; +} + static void bootstrap_bts(struct gsm_bts *bts) { unsigned int n = 0; @@ -394,8 +416,7 @@ bts->si_common.chan_desc.bs_ag_blks_res = 2; }
- if (!(bts->nch.num_blocks == 1 && (bts->nch.first_block == 0 || bts->nch.first_block == 1)) && - !(bts->nch.num_blocks == 2 && bts->nch.first_block == 0)) { + if (!nch_position_compatible_with_combined_ccch(bts)) { LOG_BTS(bts, DNM, LOGL_ERROR, "CCCH is combined with SDCCHs, but NCH position/size is " "incompatible with that. Please fix your config!\n"); }