<p>neels <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/24357">View Change</a></p><div style="white-space:pre-wrap">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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">AMR config cleanup step 2: filter modes also for VTY<br><br>The previous patch reshuffled the code without having any functional<br>change. In this patch, a functional change follows:<br><br>It does not really make sense to decide on AMR mode filtering based on<br>whether an activation request came from the VTY:<br>a) BTS: There is no need to skip AMR mode filtering for the BTS config<br>   at all. There is always a BTS.<br>b) MSC: Instead of testing for a VTY origin of the request, rather skip<br>   the MSC AMR config filtering exactly when there is no conn associated<br>   with the lchan.<br><br>Move the bts filtering directly into mr_config_filter().<br><br>Related: SYS#5315 OS#4940 OS#3787 OS#3833<br>Change-Id: Ia7519d2fa9e7f0b61b222d27d077bde4660c40b9<br>---<br>M src/osmo-bsc/lchan_fsm.c<br>1 file changed, 14 insertions(+), 18 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c</span><br><span>index 4aac6da..2e810bc 100644</span><br><span>--- a/src/osmo-bsc/lchan_fsm.c</span><br><span>+++ b/src/osmo-bsc/lchan_fsm.c</span><br><span>@@ -487,12 +487,12 @@</span><br><span> static int mr_config_filter(struct gsm48_multi_rate_conf *mr_conf_result,</span><br><span>                            bool full_rate,</span><br><span>                      const struct amr_multirate_conf *amr_mrc,</span><br><span style="color: hsl(0, 100%, 40%);">-                       const struct gsm48_multi_rate_conf *mr_filter_bts,</span><br><span>                           const struct gsm48_multi_rate_conf *mr_filter_msc,</span><br><span>                           uint16_t s15_s0,</span><br><span>                             const struct gsm_lchan *lchan_for_logging)</span><br><span> {</span><br><span>  int rc;</span><br><span style="color: hsl(120, 100%, 40%);">+       struct gsm48_multi_rate_conf *mr_filter_bts = (struct gsm48_multi_rate_conf*)amr_mrc->gsm48_ie;</span><br><span> </span><br><span>       /* Generate mr conf struct from S15-S0 bits */</span><br><span>       if (gsm48_mr_cfg_from_gsm0808_sc_cfg(mr_conf_result, s15_s0) < 0) {</span><br><span>@@ -522,20 +522,18 @@</span><br><span>               }</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (mr_filter_bts) {</span><br><span style="color: hsl(0, 100%, 40%);">-            rc = calc_amr_rate_intersection(mr_conf_result, mr_filter_bts, mr_conf_result);</span><br><span style="color: hsl(0, 100%, 40%);">-         if (rc < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-                        LOG_LCHAN(lchan_for_logging, LOGL_ERROR,</span><br><span style="color: hsl(0, 100%, 40%);">-                                  "can not encode multirate configuration (invalid amr rate setting, BTS)\n");</span><br><span style="color: hsl(0, 100%, 40%);">-                        return -EINVAL;</span><br><span style="color: hsl(0, 100%, 40%);">-         }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               /* Set the ICMI according to the BTS. Above gsm48_mr_cfg_from_gsm0808_sc_cfg() always sets ICMI = 1, which</span><br><span style="color: hsl(0, 100%, 40%);">-               * carried through all of the above rate intersections. */</span><br><span style="color: hsl(0, 100%, 40%);">-              mr_conf_result->icmi = mr_filter_bts->icmi;</span><br><span style="color: hsl(0, 100%, 40%);">-               mr_conf_result->smod = mr_filter_bts->smod;</span><br><span style="color: hsl(120, 100%, 40%);">+     rc = calc_amr_rate_intersection(mr_conf_result, mr_filter_bts, mr_conf_result);</span><br><span style="color: hsl(120, 100%, 40%);">+       if (rc < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+              LOG_LCHAN(lchan_for_logging, LOGL_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                        "can not encode multirate configuration (invalid amr rate setting, BTS)\n");</span><br><span style="color: hsl(120, 100%, 40%);">+              return -EINVAL;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* Set the ICMI according to the BTS. Above gsm48_mr_cfg_from_gsm0808_sc_cfg() always sets ICMI = 1, which</span><br><span style="color: hsl(120, 100%, 40%);">+     * carried through all of the above rate intersections. */</span><br><span style="color: hsl(120, 100%, 40%);">+    mr_conf_result->icmi = mr_filter_bts->icmi;</span><br><span style="color: hsl(120, 100%, 40%);">+     mr_conf_result->smod = mr_filter_bts->smod;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* 10k2 and 12k2 only work for full rate */</span><br><span>  if (!full_rate) {</span><br><span>            if (mr_conf_result->m10_2 || mr_conf_result->m12_2)</span><br><span>@@ -570,19 +568,17 @@</span><br><span>    struct gsm_bts *bts = lchan->ts->trx->bts;</span><br><span>  bool full_rate = lchan->type == GSM_LCHAN_TCH_F;</span><br><span>  struct amr_multirate_conf *amr_mrc = full_rate ? &bts->mr_full : &bts->mr_half;</span><br><span style="color: hsl(0, 100%, 40%);">-   struct gsm48_multi_rate_conf *mr_filter_bts = NULL;</span><br><span>  struct gsm48_multi_rate_conf *mr_filter_msc = NULL;</span><br><span>  struct gsm48_multi_rate_conf mr_conf;</span><br><span>        int rc;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     if (lchan->activate.info.activ_for != ACTIVATE_FOR_VTY) {</span><br><span style="color: hsl(0, 100%, 40%);">-            mr_filter_bts = (struct gsm48_multi_rate_conf*)amr_mrc->gsm48_ie;</span><br><span style="color: hsl(120, 100%, 40%);">+  /* If activated for VTY, there may not be a conn indicating an MSC AMR configuration. */</span><br><span style="color: hsl(120, 100%, 40%);">+      if (lchan->conn && lchan->conn->sccp.msc)</span><br><span>           mr_filter_msc = &lchan->conn->sccp.msc->amr_conf;</span><br><span style="color: hsl(0, 100%, 40%);">-  }</span><br><span> </span><br><span>        rc = mr_config_filter(&mr_conf,</span><br><span>                        full_rate,</span><br><span style="color: hsl(0, 100%, 40%);">-                              amr_mrc, mr_filter_bts, mr_filter_msc,</span><br><span style="color: hsl(120, 100%, 40%);">+                        amr_mrc, mr_filter_msc,</span><br><span>                              s15_s0,</span><br><span>                              lchan);</span><br><span>        if (rc)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/24357">change 24357</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/24357"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia7519d2fa9e7f0b61b222d27d077bde4660c40b9 </div>
<div style="display:none"> Gerrit-Change-Number: 24357 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>