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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">hodec 2: favor moving dyn TS<br><br>When a used timeslot gets moved to another timeslot for load balancing, prefer<br>moving a dynamic timeslot, as illustrated by handover_test.c test 30.<br><br>Rationale: freeing up a dynamic timeslot is better for PDCH availability, as<br>well as for flexibility in timeslots. Test 30 shows that when freeing a static<br>TCH/F even though a dynamic one with identical ratings is in use, later<br>handovers to a TCH/H may become impossible, because no more dynamic timeslots<br>are available to switch to TCH/H. A freed dynamic timeslot allows congestion<br>resolution to continue and reduce more TCH/F to TCH/H.<br><br>The scope of this preference is per-TRX, where the RXLEV ratings used for<br>picking a target lchan are the same by definition. In other words, this never<br>overrules picking another lchan that has better RXLEV.<br><br>Among lchans on dynamic timeslots that could be moved, this code favors moving<br>later lchans; mainly because it makes for a simpler condition in the code.<br><br>Change-Id: Ic221b8d2687cdec0bf94410c84a4da43853f0900<br>---<br>M src/osmo-bsc/handover_decision_2.c<br>M tests/handover/handover_test.c<br>2 files changed, 16 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c</span><br><span>index 7df8bb1..4e54368 100644</span><br><span>--- a/src/osmo-bsc/handover_decision_2.c</span><br><span>+++ b/src/osmo-bsc/handover_decision_2.c</span><br><span>@@ -1362,6 +1362,12 @@</span><br><span>         }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static bool lchan_is_on_dynamic_ts(struct gsm_lchan *lchan)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    return lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_TCH_H_PDCH</span><br><span style="color: hsl(120, 100%, 40%);">+           || lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Given two candidates, pick the one that should rather be moved during handover.</span><br><span>  * Return the better candidate in out-parameters best_cand and best_avg_db.</span><br><span>  */</span><br><span>@@ -1377,6 +1383,12 @@</span><br><span>         if (!want_highest_db && (*best_avg_db_p > other_avg_db))</span><br><span>          goto return_other;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+        /* The two lchans have identical ratings, prefer picking a dynamic timeslot: free PDCH and allow more timeslot</span><br><span style="color: hsl(120, 100%, 40%);">+         * type flexibility for further congestion resolution. If both are dynamic, it does not matter which one is</span><br><span style="color: hsl(120, 100%, 40%);">+    * picked. */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (lchan_is_on_dynamic_ts(other_cand->lchan))</span><br><span style="color: hsl(120, 100%, 40%);">+             goto return_other;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         /* keep the same candidate. */</span><br><span>       return;</span><br><span> </span><br><span>diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c</span><br><span>index 6befc5a..804ff4b 100644</span><br><span>--- a/tests/handover/handover_test.c</span><br><span>+++ b/tests/handover/handover_test.c</span><br><span>@@ -1679,16 +1679,15 @@</span><br><span>   "congestion-check",</span><br><span>        "expect-chan", "0", "6",</span><br><span>       "ack-chan",</span><br><span style="color: hsl(0, 100%, 40%);">-   /* Not so good: rather than moving static TCH/F, we should favor freeing dyn TS, for more PDCH */</span><br><span style="color: hsl(0, 100%, 40%);">-       "expect-ho", "0", "1",</span><br><span style="color: hsl(120, 100%, 40%);">+  "expect-ho", "0", "5",</span><br><span>         "ho-complete",</span><br><span style="color: hsl(0, 100%, 40%);">-        "expect-ts-use", "0", "0", "*", "-", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H-", "PDCH",</span><br><span style="color: hsl(120, 100%, 40%);">+      "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "PDCH", "TCH/H-", "PDCH",</span><br><span>  "congestion-check",</span><br><span>        "expect-chan", "0", "6",</span><br><span>       "ack-chan",</span><br><span style="color: hsl(0, 100%, 40%);">-   "expect-ho", "0", "2",</span><br><span style="color: hsl(120, 100%, 40%);">+  "expect-ho", "0", "4",</span><br><span>         "ho-complete",</span><br><span style="color: hsl(0, 100%, 40%);">-        "expect-ts-use", "0", "0", "*", "-", "-", "TCH/F", "TCH/F", "TCH/F", "TCH/HH", "PDCH",</span><br><span style="color: hsl(120, 100%, 40%);">+  "expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "PDCH", "PDCH", "TCH/HH", "PDCH",</span><br><span>   "congestion-check",</span><br><span>        "expect-no-chan",</span><br><span>  NULL</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/21204">change 21204</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/+/21204"/><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: Ic221b8d2687cdec0bf94410c84a4da43853f0900 </div>
<div style="display:none"> Gerrit-Change-Number: 21204 </div>
<div style="display:none"> Gerrit-PatchSet: 6 </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: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>