<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/24947">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cosmetic: Small improvements to _select_sdcch_for_call<br><br>This commit improves some cosmetic and logical aspects from recent<br>commit (see "Fixes" below).<br><br>* Fix typo s/free_tcch/free_tchh/"<br>* Improve some comments<br><br>Fixes: fdb87343d7a747575fae0bb436cd9d105b9748e9<br>Change-Id: Id6217c929068b0182cb2d4a9922bfbf544c8c75d<br>---<br>M src/osmo-bsc/abis_rsl.c<br>1 file changed, 14 insertions(+), 13 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/47/24947/1</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 b41fe79..42d77b3 100644</span><br><span>--- a/src/osmo-bsc/abis_rsl.c</span><br><span>+++ b/src/osmo-bsc/abis_rsl.c</span><br><span>@@ -1915,10 +1915,9 @@</span><br><span> struct gsm_lchan *_select_sdcch_for_call(struct gsm_bts *bts, const struct chan_rqd *rqd, enum gsm_chan_t lctype)</span><br><span> {</span><br><span>    struct gsm_lchan *lchan = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- int free_tchf, free_tcch;</span><br><span style="color: hsl(120, 100%, 40%);">+     int free_tchf, free_tchh;</span><br><span>    bool needs_dyn_switch;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>   lchan = lchan_avail_by_type(bts, GSM_LCHAN_SDCCH, false);</span><br><span>    if (!lchan)</span><br><span>          return NULL;</span><br><span>@@ -1927,20 +1926,21 @@</span><br><span>                                       lchan->ts->pchan_is != GSM_PCHAN_SDCCH8_SACCH8C;</span><br><span> </span><br><span>   free_tchf = bts_count_free_ts(bts, GSM_PCHAN_TCH_F);</span><br><span style="color: hsl(0, 100%, 40%);">-    free_tcch = bts_count_free_ts(bts, GSM_PCHAN_TCH_H);</span><br><span style="color: hsl(0, 100%, 40%);">-    if (free_tchf == 0 && free_tcch == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+       free_tchh = bts_count_free_ts(bts, GSM_PCHAN_TCH_H);</span><br><span style="color: hsl(120, 100%, 40%);">+  if (free_tchf == 0 && free_tchh == 0) {</span><br><span>              LOG_BTS(bts, DRSL, LOGL_INFO,</span><br><span>                        "CHAN RQD: 0x%x Requesting %s reason=call but no TCH available\n",</span><br><span>                         rqd->ref.ra, gsm_lchant_name(lctype));</span><br><span>            return NULL;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   /* There's a TCH available and we'll not switch any of them, so we are fine */</span><br><span style="color: hsl(120, 100%, 40%);">+        /* There's a TCH available and we'll not switch any dyn ts, so we are</span><br><span style="color: hsl(120, 100%, 40%);">+  * fine (we can switch one of them to SDCCH8 and still have one left) */</span><br><span>     if (!needs_dyn_switch)</span><br><span>               goto select_lchan;</span><br><span> </span><br><span>       /* We need to switch, but there's at least 2 TCH TS available so we are fine: */</span><br><span style="color: hsl(0, 100%, 40%);">-    if (free_tchf > 1 || free_tcch > 2)</span><br><span style="color: hsl(120, 100%, 40%);">+     if (free_tchf > 1 || free_tchh > 2)</span><br><span>            goto select_lchan;</span><br><span> </span><br><span>       /* At this point (needs_dyn_switch==true), following cases are possible:</span><br><span>@@ -1948,13 +1948,14 @@</span><br><span>    * [B] H=1, F=0</span><br><span>       * [B] H=1, F=1</span><br><span>       * [C] H=2, F=1</span><br><span style="color: hsl(0, 100%, 40%);">-  * If condition [C] is met, it means there's 1 dynamic TS and it's the</span><br><span style="color: hsl(0, 100%, 40%);">-   * same as the dynamic TS available for SDCCH requiring switch, so selecting</span><br><span style="color: hsl(0, 100%, 40%);">-     * it would basically leave us without free TCH, so avoid selecting it.</span><br><span style="color: hsl(0, 100%, 40%);">-  * Regarding the other conditions, it basically results in them being</span><br><span style="color: hsl(0, 100%, 40%);">-    * different TS than the one we want to switch, so we are fine selecting</span><br><span style="color: hsl(0, 100%, 40%);">-         * the TS for SDCCH */</span><br><span style="color: hsl(0, 100%, 40%);">-  if (free_tchf == 1 && free_tcch == 2) {</span><br><span style="color: hsl(120, 100%, 40%);">+        * If condition [C] is met, it means there's 1 dynamic TS (because a dyn</span><br><span style="color: hsl(120, 100%, 40%);">+   * TS is counted both as 1 free TCH/F and 2 free TCH/H at the same time)</span><br><span style="color: hsl(120, 100%, 40%);">+       * and it's the same as the dynamic TS available for SDCCH requiring</span><br><span style="color: hsl(120, 100%, 40%);">+       * switch, so selecting it would basically leave us without free TCH, so</span><br><span style="color: hsl(120, 100%, 40%);">+       * avoid selecting it. Regarding the other conditions, it basically</span><br><span style="color: hsl(120, 100%, 40%);">+    * results in them being different TS than the one we want to switch, so</span><br><span style="color: hsl(120, 100%, 40%);">+       * we are fine selecting the TS for SDCCH */</span><br><span style="color: hsl(120, 100%, 40%);">+  if (free_tchf == 1 && free_tchh == 2) {</span><br><span>              LOG_BTS(bts, DRSL, LOGL_INFO,</span><br><span>                        "CHAN RQD: 0x%x Requesting %s reason=call but dyn TS switch to "</span><br><span>                   "SDCCH would starve the single available TCH timeslot\n",</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/24947">change 24947</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/+/24947"/><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: Id6217c929068b0182cb2d4a9922bfbf544c8c75d </div>
<div style="display:none"> Gerrit-Change-Number: 24947 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>