aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-09-26 23:45:25 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-10-13 16:14:55 +0200
commit9b421fca4fa2226aebdefa8b6e31fdfb0e77c420 (patch)
tree0fde22848143039c5816faecb373fe9134866558
parent44378d6ce9ea0cfc4bee8cf8dde94a4c6e82868f (diff)
log error if any of the AMR S1 rates are forbiddenneels/codec
-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 cfe7a287c..f3549b92d 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_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 920693f6c..3e80a6ae7 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -989,6 +989,9 @@ int main(int argc, char **argv)
}
}
+ /* 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");