aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-09-26 23:45:25 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-03-03 16:27:41 +0100
commit9edf321e07efa6c9de615a8bb9476f9e8fc3d8b1 (patch)
tree620ecc1f10e0181ecc64fd6647f21ee679793040
parentdd0713c47dafcf3caf90a9bdce764ea4ffe2a701 (diff)
log error if any of the AMR S1 rates are forbidden
-rw-r--r--include/osmocom/bsc/codec_pref.h1
-rw-r--r--src/osmo-bsc/codec_pref.c21
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c3
3 files changed, 25 insertions, 0 deletions
diff --git a/include/osmocom/bsc/codec_pref.h b/include/osmocom/bsc/codec_pref.h
index adefe0473..3c4266d38 100644
--- a/include/osmocom/bsc/codec_pref.h
+++ b/include/osmocom/bsc/codec_pref.h
@@ -32,3 +32,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");