abis_rsl: Fix TCH-as-SDCCH allocation on Channel Request

On rsl_rx_chan_rqd(), so far osmo-bsc tried to preferably assign the lchan type
that was asked for in the RACH. Firstly, this contained a bug, and secondly,
it does not make sense to heed that preference, since we do late assignment.

Ignore the preference for the MS' TCH kind.
We do late assignment to avoid codec mismatches. In the "old days", we would
heed the MS' TCH channel kind, even if the MSC or BSC didn't actually allow
or prefer that channel kind. Hence, in the presence of both TCH/F and TCH/H,
the MS could ask for TCH/F (which we would grant on the MO side) and the BSC
or MSC could prefer TCH/H (which we would apply on the MT side), and hence
fabricate a codec mismatch. Instead, since quite some time now, we *always*
assign an SDCCH first, and only later on do another Assignment to hand out
a proper voice lchan that heeds the MS capability bits as well as MSC's and
BSC's preferences.

By completely ignoring the channel kind the MS asked for in the RACH, we
also eliminate this bug in rsl_rx_chan_rqd():
- If the first "lchan_select_by_type(GSM_LCHAN_SDDCH)" fails (all SDDCH in use),
  we should try to fall back to any TCH instead, to serve as SDCCH.
- the first "if (!lchan && lctype != GSM_LCHAN_SDCCH)" was an attempt to prefer
  a fallback to the lchan type the MS requested.
- the remaining two "if (!lchan && lctype == GSM_LCHAN_SDCCH)" were obviously
  only applied if the MS asked for an SDCCH, and skipped if the type was TCH/*.
- hence, missing was: if the MS asked for a TCH, to also try the *other* TCH
  kind that the MS did not ask for. (Example: all SDCCH in use, MS asks for
  TCH/F, but BSC has only TCH/H lchans; we should assign TCH/H as SDCCH, instead
  we said "no resources")

Change-Id: Ie3684cf071751f9528183d761c588102936e498c
Related: OS#3503
This commit is contained in:
Neels Hofmeyr 2019-01-22 11:30:21 +01:00 committed by Philipp Maier
parent 3035892d95
commit 8d9c3e7f30
1 changed files with 4 additions and 14 deletions

View File

@ -1375,22 +1375,12 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
/* check availability / allocate channel
*
* - First try to allocate SDCCH.
* - If SDCCH is not available, try whatever MS requested, if not SDCCH.
* - If there is still no channel available, reject channel request.
* - If SDCCH is not available, try a TCH/H (less bandwith).
* - If there is still no channel available, try a TCH/F.
*
* Note: If the MS requests not TCH/H, we don't know if the phone
* supports TCH/H, so we must assign TCH/F or SDCCH.
*/
lchan = lchan_select_by_type(bts, GSM_LCHAN_SDCCH);
if (!lchan && lctype != GSM_LCHAN_SDCCH) {
LOGP(DRSL, LOGL_NOTICE, "(bts=%d) CHAN RQD: no resources for %s "
"0x%x, retrying with %s\n",
msg->lchan->ts->trx->bts->nr,
gsm_lchant_name(GSM_LCHAN_SDCCH), rqd_ref->ra,
gsm_lchant_name(lctype));
lchan = lchan_select_by_type(bts, lctype);
}
if (!lchan && lctype == GSM_LCHAN_SDCCH) {
if (!lchan) {
LOGP(DRSL, LOGL_NOTICE, "(bts=%d) CHAN RQD: no resources for %s "
"0x%x, retrying with %s\n",
msg->lchan->ts->trx->bts->nr,
@ -1398,7 +1388,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
gsm_lchant_name(GSM_LCHAN_TCH_H));
lchan = lchan_select_by_type(bts, GSM_LCHAN_TCH_H);
}
if (!lchan && lctype == GSM_LCHAN_SDCCH) {
if (!lchan) {
LOGP(DRSL, LOGL_NOTICE, "(bts=%d) CHAN RQD: no resources for %s "
"0x%x, retrying with %s\n",
msg->lchan->ts->trx->bts->nr,