<p>ipse <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18090">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ctrs: Correctly count load total for dynamic timeslots.<br><br>From the CS perspective, there is no difference whether this is<br>a dynamic TS in NONE/PDCH mode or a static TCH in UNUSED mode since<br>BSC can switch into USED mode at any moment. So we should count<br>dynamic timeslots in the "total" count.<br><br>A bit of a challenge here is that GSM_PCHAN_TCH_F_TCH_H_PDCH<br>timeslots could be either switched to a single TCH/F or to<br>two TCH/H, so the total can't be calculated reliably beforehand.<br>In this code we assume TCH/F since this gives a lower total<br>count.<br><br>Change-Id: Iabd70e8adbf15eb3b7a7be597281ea99b352317b<br>---<br>M src/osmo-bsc/chan_alloc.c<br>1 file changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/chan_alloc.c b/src/osmo-bsc/chan_alloc.c</span><br><span>index 669eb8e..ac246e0 100644</span><br><span>--- a/src/osmo-bsc/chan_alloc.c</span><br><span>+++ b/src/osmo-bsc/chan_alloc.c</span><br><span>@@ -58,6 +58,28 @@</span><br><span>                        if (!nm_is_running(&ts->mo.nm_state))</span><br><span>                                 continue;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+                 /* Dynamic timeslots have to be counted separately</span><br><span style="color: hsl(120, 100%, 40%);">+                     * when not in TCH/F or TCH/H mode because they don't</span><br><span style="color: hsl(120, 100%, 40%);">+                      * have an lchan's allocated to them. At the same time,</span><br><span style="color: hsl(120, 100%, 40%);">+                    * dynamic timeslots in NONE and PDCH modes are same</span><br><span style="color: hsl(120, 100%, 40%);">+                   * as in UNUSED mode from the CS channel load perspective</span><br><span style="color: hsl(120, 100%, 40%);">+                      * beause they can be switched to TCH mode at any moment.</span><br><span style="color: hsl(120, 100%, 40%);">+                      * I.e. they are "available" for TCH. */</span><br><span style="color: hsl(120, 100%, 40%);">+                    if ((ts->pchan_on_init == GSM_PCHAN_TCH_F_TCH_H_PDCH ||</span><br><span style="color: hsl(120, 100%, 40%);">+                         ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH) &&</span><br><span style="color: hsl(120, 100%, 40%);">+                     (ts->pchan_is == GSM_PCHAN_NONE ||</span><br><span style="color: hsl(120, 100%, 40%);">+                          ts->pchan_is == GSM_PCHAN_PDCH)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                            pl->total++;</span><br><span style="color: hsl(120, 100%, 40%);">+                       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                   /* Count allocated logical channels.</span><br><span style="color: hsl(120, 100%, 40%);">+                   * Note: A GSM_PCHAN_TCH_F_TCH_H_PDCH can be switched</span><br><span style="color: hsl(120, 100%, 40%);">+                  * to a single TCH/F or to two TCH/H. So when it's in</span><br><span style="color: hsl(120, 100%, 40%);">+                      * the TCH/H mode, total number of available channels</span><br><span style="color: hsl(120, 100%, 40%);">+                  * is 1 more than when it's in the TCH/F mode.</span><br><span style="color: hsl(120, 100%, 40%);">+                     * I.e. "total" count will fluctuate depending on</span><br><span style="color: hsl(120, 100%, 40%);">+                    * whether GSM_PCHAN_TCH_F_TCH_H_PDCH timeslot is</span><br><span style="color: hsl(120, 100%, 40%);">+                      * in TCH/F or TCH/H (or in NONE/PDCH) mode. */</span><br><span>                      ts_for_each_lchan(lchan, ts) {</span><br><span>                               /* don't even count CBCH slots in total */</span><br><span>                               if (lchan->type == GSM_LCHAN_CBCH)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18090">change 18090</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/+/18090"/><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: Iabd70e8adbf15eb3b7a7be597281ea99b352317b </div>
<div style="display:none"> Gerrit-Change-Number: 18090 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: ipse <Alexander.Chemeris@gmail.com> </div>
<div style="display:none"> Gerrit-Assignee: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: ipse <Alexander.Chemeris@gmail.com> </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>