diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2022-09-26 23:45:25 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2023-03-22 18:42:43 +0100 |
commit | 44c6d131a6c4cd02ff740a1f9e2298c05221afb6 (patch) | |
tree | 6084dd92258ddd0265dea11bc9b035c31c8eed98 | |
parent | 3ee1f4b5f30ceb14371cc1ebc0c7e0db64090fa5 (diff) |
log error if any of the AMR S1 rates are forbidden
Change-Id: Id4b1c81bca92d7ec06963643a24150ce8e187f26
-rw-r--r-- | include/osmocom/bsc/codec_pref.h | 1 | ||||
-rw-r--r-- | src/osmo-bsc/codec_pref.c | 21 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_main.c | 3 |
3 files changed, 25 insertions, 0 deletions
diff --git a/include/osmocom/bsc/codec_pref.h b/include/osmocom/bsc/codec_pref.h index 5944a4a1d..66adf33ed 100644 --- a/include/osmocom/bsc/codec_pref.h +++ b/include/osmocom/bsc/codec_pref.h @@ -36,3 +36,4 @@ int calc_amr_rate_intersection(struct gsm48_multi_rate_conf *c, const struct gsm48_multi_rate_conf *a); int check_codec_pref(struct llist_head *mscs); +int check_amr_modes(struct llist_head *mscs); diff --git a/src/osmo-bsc/codec_pref.c b/src/osmo-bsc/codec_pref.c index 31b521593..4092c1ac0 100644 --- a/src/osmo-bsc/codec_pref.c +++ b/src/osmo-bsc/codec_pref.c @@ -503,3 +503,24 @@ int check_codec_pref(struct llist_head *mscs) return rc; } + +/* The AMR modes represented by S1 (3GPP TS 28.062 Table 7.11.3.1.3-2) are mandatory in BSSAP. + * Check each msc's cfg whether all rates required for S1 are allowed. */ +int check_amr_modes(struct llist_head *mscs) +{ + struct bsc_msc_data *msc; + int rc = 0; + /* Get the modes defined by FR S1: */ + const uint8_t s1_modes = gsm0808_amr_modes_from_cfg[1][1]; + + llist_for_each_entry(msc, mscs, entry) { + const uint8_t msc_modes = gsm48_multi_rate_conf_get_amr_modes(&msc->amr_conf); + if ((msc_modes & s1_modes) != s1_modes) { + LOGP(DMSC, LOGL_ERROR, + "msc %d: WARNING: 'amr-config' forbids one or more of the S1 rates, which are mandatory" + " on BSSAP (4.75, 5.90, 7.40, 12.2)\n", msc->nr); + rc = -1; + } + } + return rc; +} diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index 69f272135..f3a6a02c2 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -992,6 +992,9 @@ int main(int argc, char **argv) if (bsc_mgw_setup() != 0) exit(1); + /* Do not fail on AMR modes warnings, just warn. */ + check_amr_modes(&bsc_gsmnet->mscs); + llist_for_each_entry(msc, &bsc_gsmnet->mscs, entry) { if (osmo_bsc_msc_init(msc) != 0) { LOGP(DMSC, LOGL_ERROR, "Failed to start up. Exiting.\n"); |