Change in osmo-bsc[master]: codec_pref: also check amr codec rates in check_codec_pref()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Oct 23 16:02:49 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/11442


Change subject: codec_pref: also check amr codec rates in check_codec_pref()
......................................................................

codec_pref: also check amr codec rates in check_codec_pref()

The function check_codec_pref() currently only does a basic check over
the general codec configuration of bts and msc. However, it does not yet
check if the amr codec rate settings for the BTSs contradict the
allowed/forbidden amr codec rates of the MSC. When the two settings do
contradict AMR would not work, even when everything else is correctly
configured. We need to check this on startup to spot configuration
problems quickly.

- Add function to calculate intersections of struct
  gsm48_multi_rate_conf variables.
- Calculate the intersection between the multi rate config of
  each BTS with the one of the MSC

Change-Id: I3537d1c89e2520d35cc0e150ba8e6d3693e06710
Related: OS#3529
---
M include/osmocom/bsc/codec_pref.h
M src/osmo-bsc/codec_pref.c
2 files changed, 53 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/42/11442/1

diff --git a/include/osmocom/bsc/codec_pref.h b/include/osmocom/bsc/codec_pref.h
index d62d29f..51340c1 100644
--- a/include/osmocom/bsc/codec_pref.h
+++ b/include/osmocom/bsc/codec_pref.h
@@ -22,4 +22,8 @@
 				  const struct bsc_msc_data *msc,
 				  const struct gsm_bts *bts);
 
+int calc_amr_rate_intersection(struct gsm48_multi_rate_conf *c,
+			       const struct gsm48_multi_rate_conf *b,
+			       const struct gsm48_multi_rate_conf *a);
+
 int check_codec_pref(struct llist_head *mscs);
diff --git a/src/osmo-bsc/codec_pref.c b/src/osmo-bsc/codec_pref.c
index 9f30c7b..b031220 100644
--- a/src/osmo-bsc/codec_pref.c
+++ b/src/osmo-bsc/codec_pref.c
@@ -393,6 +393,35 @@
 	}
 }
 
+/*! Calculate the intersection of the rate configuration of two multirate configuration
+ *  IE structures. The result c will be a copy of a, but the rate configuration bits
+ *  will be the intersection of the rate configuration bits in a and b.
+ *  \param[out] c user provided memory to store the result.
+ *  \param[in] a multi rate configuration a.
+ *  \param[in] b multi rate configuration b.
+ *  \returns 0 on success, -1 when the result contains an empty set of modes. */
+int calc_amr_rate_intersection(struct gsm48_multi_rate_conf *c,
+			       const struct gsm48_multi_rate_conf *b,
+			       const struct gsm48_multi_rate_conf *a)
+{
+	struct gsm48_multi_rate_conf res;
+	uint8_t *_a = (uint8_t *) a;
+	uint8_t *_b = (uint8_t *) b;
+	uint8_t *_res = (uint8_t *) & res;
+
+	memcpy(&res, a, sizeof(res));
+
+	_res[1] = _a[1] & _b[1];
+
+	if (_res[1] == 0x00)
+		return -1;
+
+	if (c)
+		memcpy(c, &res, sizeof(*c));
+
+	return 0;
+}
+
 /*! Visit the codec settings for the MSC and for each BTS in order to make sure
  *  that the configuration does not contain any combinations that lead into a
  *  mutually exclusive codec configuration (empty intersection).
@@ -404,6 +433,8 @@
 	struct gsm_bts *bts;
 	struct gsm0808_speech_codec_list scl;
 	int rc = 0;
+	int rc_rate;
+	const struct gsm48_multi_rate_conf *bts_gsm48_ie;
 
 	llist_for_each_entry(msc, mscs, entry) {
 		llist_for_each_entry(bts, &msc->network->bts_list, list) {
@@ -414,6 +445,24 @@
 				     bts->nr, msc->nr);
 				rc = -1;
 			}
+
+			bts_gsm48_ie = (struct gsm48_multi_rate_conf *)&bts->mr_full.gsm48_ie;
+			rc_rate = calc_amr_rate_intersection(NULL, &msc->amr_conf, bts_gsm48_ie);
+			if (rc_rate < 0) {
+				LOGP(DMSC, LOGL_FATAL,
+				     "network amr tch-f mode config of BTS %u does not intersect with amr-config of MSC %u\n",
+				     bts->nr, msc->nr);
+				rc = -1;
+			}
+
+			bts_gsm48_ie = (struct gsm48_multi_rate_conf *)&bts->mr_half.gsm48_ie;
+			rc_rate = calc_amr_rate_intersection(NULL, &msc->amr_conf, bts_gsm48_ie);
+			if (rc_rate < 0) {
+				LOGP(DMSC, LOGL_FATAL,
+				     "network amr tch-f mode config of BTS %u does not intersect with amr-config of MSC %u\n",
+				     bts->nr, msc->nr);
+				rc = -1;
+			}
 		}
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/11442
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3537d1c89e2520d35cc0e150ba8e6d3693e06710
Gerrit-Change-Number: 11442
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181023/68bff6b6/attachment.htm>


More information about the gerrit-log mailing list