hodec 2: favor moving dyn TS

When a used timeslot gets moved to another timeslot for load balancing, prefer
moving a dynamic timeslot, as illustrated by handover_test.c test 30.

Rationale: freeing up a dynamic timeslot is better for PDCH availability, as
well as for flexibility in timeslots. Test 30 shows that when freeing a static
TCH/F even though a dynamic one with identical ratings is in use, later
handovers to a TCH/H may become impossible, because no more dynamic timeslots
are available to switch to TCH/H. A freed dynamic timeslot allows congestion
resolution to continue and reduce more TCH/F to TCH/H.

The scope of this preference is per-TRX, where the RXLEV ratings used for
picking a target lchan are the same by definition. In other words, this never
overrules picking another lchan that has better RXLEV.

Among lchans on dynamic timeslots that could be moved, this code favors moving
later lchans; mainly because it makes for a simpler condition in the code.

Change-Id: Ic221b8d2687cdec0bf94410c84a4da43853f0900
This commit is contained in:
Neels Hofmeyr 2020-11-13 02:14:37 +01:00
parent 829db22eeb
commit dc69da17ad
2 changed files with 16 additions and 5 deletions

View File

@ -1362,6 +1362,12 @@ static void on_measurement_report(struct gsm_meas_rep *mr)
}
}
static bool lchan_is_on_dynamic_ts(struct gsm_lchan *lchan)
{
return lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_TCH_H_PDCH
|| lchan->ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH;
}
/* Given two candidates, pick the one that should rather be moved during handover.
* Return the better candidate in out-parameters best_cand and best_avg_db.
*/
@ -1377,6 +1383,12 @@ static void pick_better_lchan_to_move(bool want_highest_db,
if (!want_highest_db && (*best_avg_db_p > other_avg_db))
goto return_other;
/* The two lchans have identical ratings, prefer picking a dynamic timeslot: free PDCH and allow more timeslot
* type flexibility for further congestion resolution. If both are dynamic, it does not matter which one is
* picked. */
if (lchan_is_on_dynamic_ts(other_cand->lchan))
goto return_other;
/* keep the same candidate. */
return;

View File

@ -1679,16 +1679,15 @@ static char *test_case_30[] = {
"congestion-check",
"expect-chan", "0", "6",
"ack-chan",
/* Not so good: rather than moving static TCH/F, we should favor freeing dyn TS, for more PDCH */
"expect-ho", "0", "1",
"expect-ho", "0", "5",
"ho-complete",
"expect-ts-use", "0", "0", "*", "-", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H-", "PDCH",
"expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "PDCH", "TCH/H-", "PDCH",
"congestion-check",
"expect-chan", "0", "6",
"ack-chan",
"expect-ho", "0", "2",
"expect-ho", "0", "4",
"ho-complete",
"expect-ts-use", "0", "0", "*", "-", "-", "TCH/F", "TCH/F", "TCH/F", "TCH/HH", "PDCH",
"expect-ts-use", "0", "0", "*", "TCH/F", "TCH/F", "TCH/F", "PDCH", "PDCH", "TCH/HH", "PDCH",
"congestion-check",
"expect-no-chan",
NULL