Change in osmo-bsc[master]: AMR config cleanup step 2: filter modes also for VTY

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 1 17:29:38 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24357 )

Change subject: AMR config cleanup step 2: filter modes also for VTY
......................................................................

AMR config cleanup step 2: filter modes also for VTY

The previous patch reshuffled the code without having any functional
change. In this patch, a functional change follows:

It does not really make sense to decide on AMR mode filtering based on
whether an activation request came from the VTY:
a) BTS: There is no need to skip AMR mode filtering for the BTS config
   at all. There is always a BTS.
b) MSC: Instead of testing for a VTY origin of the request, rather skip
   the MSC AMR config filtering exactly when there is no conn associated
   with the lchan.

Move the bts filtering directly into mr_config_filter().

Related: SYS#5315 OS#4940 OS#3787 OS#3833
Change-Id: Ia7519d2fa9e7f0b61b222d27d077bde4660c40b9
---
M src/osmo-bsc/lchan_fsm.c
1 file changed, 14 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, but someone else must approve
  neels: Looks good to me, approved



diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 4aac6da..2e810bc 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -487,12 +487,12 @@
 static int mr_config_filter(struct gsm48_multi_rate_conf *mr_conf_result,
 			    bool full_rate,
 			    const struct amr_multirate_conf *amr_mrc,
-			    const struct gsm48_multi_rate_conf *mr_filter_bts,
 			    const struct gsm48_multi_rate_conf *mr_filter_msc,
 			    uint16_t s15_s0,
 			    const struct gsm_lchan *lchan_for_logging)
 {
 	int rc;
+	struct gsm48_multi_rate_conf *mr_filter_bts = (struct gsm48_multi_rate_conf*)amr_mrc->gsm48_ie;
 
 	/* Generate mr conf struct from S15-S0 bits */
 	if (gsm48_mr_cfg_from_gsm0808_sc_cfg(mr_conf_result, s15_s0) < 0) {
@@ -522,20 +522,18 @@
 		}
 	}
 
-	if (mr_filter_bts) {
-		rc = calc_amr_rate_intersection(mr_conf_result, mr_filter_bts, mr_conf_result);
-		if (rc < 0) {
-			LOG_LCHAN(lchan_for_logging, LOGL_ERROR,
-				  "can not encode multirate configuration (invalid amr rate setting, BTS)\n");
-			return -EINVAL;
-		}
-
-		/* Set the ICMI according to the BTS. Above gsm48_mr_cfg_from_gsm0808_sc_cfg() always sets ICMI = 1, which
-		 * carried through all of the above rate intersections. */
-		mr_conf_result->icmi = mr_filter_bts->icmi;
-		mr_conf_result->smod = mr_filter_bts->smod;
+	rc = calc_amr_rate_intersection(mr_conf_result, mr_filter_bts, mr_conf_result);
+	if (rc < 0) {
+		LOG_LCHAN(lchan_for_logging, LOGL_ERROR,
+			  "can not encode multirate configuration (invalid amr rate setting, BTS)\n");
+		return -EINVAL;
 	}
 
+	/* Set the ICMI according to the BTS. Above gsm48_mr_cfg_from_gsm0808_sc_cfg() always sets ICMI = 1, which
+	 * carried through all of the above rate intersections. */
+	mr_conf_result->icmi = mr_filter_bts->icmi;
+	mr_conf_result->smod = mr_filter_bts->smod;
+
 	/* 10k2 and 12k2 only work for full rate */
 	if (!full_rate) {
 		if (mr_conf_result->m10_2 || mr_conf_result->m12_2)
@@ -570,19 +568,17 @@
 	struct gsm_bts *bts = lchan->ts->trx->bts;
 	bool full_rate = lchan->type == GSM_LCHAN_TCH_F;
 	struct amr_multirate_conf *amr_mrc = full_rate ? &bts->mr_full : &bts->mr_half;
-	struct gsm48_multi_rate_conf *mr_filter_bts = NULL;
 	struct gsm48_multi_rate_conf *mr_filter_msc = NULL;
 	struct gsm48_multi_rate_conf mr_conf;
 	int rc;
 
-	if (lchan->activate.info.activ_for != ACTIVATE_FOR_VTY) {
-		mr_filter_bts = (struct gsm48_multi_rate_conf*)amr_mrc->gsm48_ie;
+	/* If activated for VTY, there may not be a conn indicating an MSC AMR configuration. */
+	if (lchan->conn && lchan->conn->sccp.msc)
 		mr_filter_msc = &lchan->conn->sccp.msc->amr_conf;
-	}
 
 	rc = mr_config_filter(&mr_conf,
 			      full_rate,
-			      amr_mrc, mr_filter_bts, mr_filter_msc,
+			      amr_mrc, mr_filter_msc,
 			      s15_s0,
 			      lchan);
 	if (rc)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/24357
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia7519d2fa9e7f0b61b222d27d077bde4660c40b9
Gerrit-Change-Number: 24357
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210601/9d18a6a7/attachment.htm>


More information about the gerrit-log mailing list