<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/12677">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Neels Hofmeyr: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">abis_rsl: Fix TCH-as-SDCCH allocation on Channel Request<br><br>On rsl_rx_chan_rqd(), so far osmo-bsc tried to preferably assign the lchan type<br>that was asked for in the RACH. Firstly, this contained a bug, and secondly,<br>it does not make sense to heed that preference, since we do late assignment.<br><br>Ignore the preference for the MS' TCH kind.<br>We do late assignment to avoid codec mismatches. In the "old days", we would<br>heed the MS' TCH channel kind, even if the MSC or BSC didn't actually allow<br>or prefer that channel kind. Hence, in the presence of both TCH/F and TCH/H,<br>the MS could ask for TCH/F (which we would grant on the MO side) and the BSC<br>or MSC could prefer TCH/H (which we would apply on the MT side), and hence<br>fabricate a codec mismatch. Instead, since quite some time now, we *always*<br>assign an SDCCH first, and only later on do another Assignment to hand out<br>a proper voice lchan that heeds the MS capability bits as well as MSC's and<br>BSC's preferences.<br><br>By completely ignoring the channel kind the MS asked for in the RACH, we<br>also eliminate this bug in rsl_rx_chan_rqd():<br>- If the first "lchan_select_by_type(GSM_LCHAN_SDDCH)" fails (all SDDCH in use),<br>  we should try to fall back to any TCH instead, to serve as SDCCH.<br>- the first "if (!lchan && lctype != GSM_LCHAN_SDCCH)" was an attempt to prefer<br>  a fallback to the lchan type the MS requested.<br>- the remaining two "if (!lchan && lctype == GSM_LCHAN_SDCCH)" were obviously<br>  only applied if the MS asked for an SDCCH, and skipped if the type was TCH/*.<br>- hence, missing was: if the MS asked for a TCH, to also try the *other* TCH<br>  kind that the MS did not ask for. (Example: all SDCCH in use, MS asks for<br>  TCH/F, but BSC has only TCH/H lchans; we should assign TCH/H as SDCCH, instead<br>  we said "no resources")<br><br>Change-Id: Ie3684cf071751f9528183d761c588102936e498c<br>Related: OS#3503<br>---<br>M src/osmo-bsc/abis_rsl.c<br>1 file changed, 4 insertions(+), 14 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c</span><br><span>index d67573f..fd6dbdb 100644</span><br><span>--- a/src/osmo-bsc/abis_rsl.c</span><br><span>+++ b/src/osmo-bsc/abis_rsl.c</span><br><span>@@ -1375,22 +1375,12 @@</span><br><span>       /* check availability / allocate channel</span><br><span>      *</span><br><span>    * - First try to allocate SDCCH.</span><br><span style="color: hsl(0, 100%, 40%);">-        * - If SDCCH is not available, try whatever MS requested, if not SDCCH.</span><br><span style="color: hsl(0, 100%, 40%);">-         * - If there is still no channel available, reject channel request.</span><br><span style="color: hsl(120, 100%, 40%);">+   * - If SDCCH is not available, try a TCH/H (less bandwith).</span><br><span style="color: hsl(120, 100%, 40%);">+   * - If there is still no channel available, try a TCH/F.</span><br><span>     *</span><br><span style="color: hsl(0, 100%, 40%);">-       * Note: If the MS requests not TCH/H, we don't know if the phone</span><br><span style="color: hsl(0, 100%, 40%);">-    *       supports TCH/H, so we must assign TCH/F or SDCCH.</span><br><span>    */</span><br><span>  lchan = lchan_select_by_type(bts, GSM_LCHAN_SDCCH);</span><br><span style="color: hsl(0, 100%, 40%);">-     if (!lchan && lctype != GSM_LCHAN_SDCCH) {</span><br><span style="color: hsl(0, 100%, 40%);">-              LOGP(DRSL, LOGL_NOTICE, "(bts=%d) CHAN RQD: no resources for %s "</span><br><span style="color: hsl(0, 100%, 40%);">-                     "0x%x, retrying with %s\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                   msg->lchan->ts->trx->bts->nr,</span><br><span style="color: hsl(0, 100%, 40%);">-                    gsm_lchant_name(GSM_LCHAN_SDCCH), rqd_ref->ra,</span><br><span style="color: hsl(0, 100%, 40%);">-                       gsm_lchant_name(lctype));</span><br><span style="color: hsl(0, 100%, 40%);">-               lchan = lchan_select_by_type(bts, lctype);</span><br><span style="color: hsl(0, 100%, 40%);">-      }</span><br><span style="color: hsl(0, 100%, 40%);">-       if (!lchan && lctype == GSM_LCHAN_SDCCH) {</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!lchan) {</span><br><span>                LOGP(DRSL, LOGL_NOTICE, "(bts=%d) CHAN RQD: no resources for %s "</span><br><span>                  "0x%x, retrying with %s\n",</span><br><span>                        msg->lchan->ts->trx->bts->nr,</span><br><span>@@ -1398,7 +1388,7 @@</span><br><span>                         gsm_lchant_name(GSM_LCHAN_TCH_H));</span><br><span>           lchan = lchan_select_by_type(bts, GSM_LCHAN_TCH_H);</span><br><span>  }</span><br><span style="color: hsl(0, 100%, 40%);">-       if (!lchan && lctype == GSM_LCHAN_SDCCH) {</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!lchan) {</span><br><span>                LOGP(DRSL, LOGL_NOTICE, "(bts=%d) CHAN RQD: no resources for %s "</span><br><span>                  "0x%x, retrying with %s\n",</span><br><span>                        msg->lchan->ts->trx->bts->nr,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12677">change 12677</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/12677"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ie3684cf071751f9528183d761c588102936e498c </div>
<div style="display:none"> Gerrit-Change-Number: 12677 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Kévin Redon <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Max <msuraev@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: daniel <daniel@totalueberwachung.de> </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>