From 2544109c1be180bd67c5b929aabd67dd659bb4c1 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Fri, 31 May 2013 15:05:52 +0200 Subject: HO: Assign SDCCH on channel request This is needed, so channel can be negotiated before the actual channel type is assigned. In case there is no SDCCH available, try to assign what ever the MS requested. If this is not possible try to assign TCH/F. If this is still not possible, reject channel request. --- src/libbsc/abis_rsl.c | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'src/libbsc/abis_rsl.c') diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c index de8207687..23836c73f 100644 --- a/src/libbsc/abis_rsl.c +++ b/src/libbsc/abis_rsl.c @@ -1383,21 +1383,47 @@ static int rsl_rx_chan_rqd(struct msgb *msg) */ is_lu = !!(chreq_reason == GSM_CHREQ_REASON_LOCATION_UPD); - /* check availability / allocate channel */ - lchan = lchan_alloc(bts, lctype, is_lu); - if (!lchan && (rqd_ref->ra & 0xf0) == 0x30) { - 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(lctype), rqd_ref->ra, gsm_lchant_name(GSM_LCHAN_TCH_F)); - lctype = GSM_LCHAN_TCH_F; - lchan = lchan_alloc(bts, lctype, is_lu); + /* 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, and MS requested not TCH/F, + * try to allocate TCH/F. + * + * If there is still no channel available, reject channel request. + * + * 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_alloc(bts, GSM_LCHAN_SDCCH, 0); + 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_alloc(bts, lctype, 0); + } + if (!lchan && lctype != GSM_LCHAN_TCH_F) { + 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(lctype), + rqd_ref->ra, gsm_lchant_name(GSM_LCHAN_TCH_F)); + lchan = lchan_alloc(bts, GSM_LCHAN_TCH_F, 0); } if (!lchan) { - LOGP(DRSL, LOGL_NOTICE, "BTS %d CHAN RQD: no resources for %s 0x%x\n", - msg->lchan->ts->trx->bts->nr, gsm_lchant_name(lctype), rqd_ref->ra); + LOGP(DRSL, LOGL_NOTICE, "BTS %d CHAN RQD: no resources for %s " + "0x%x, rejecting channel request\n", + msg->lchan->ts->trx->bts->nr, gsm_lchant_name(lctype), + rqd_ref->ra); osmo_counter_inc(bts->network->stats.chreq.no_channel); /* FIXME gather multiple CHAN RQD and reject up to 4 at the same time */ - if (bts->network->T3122) - rsl_send_imm_ass_rej(bts, 1, rqd_ref, bts->network->T3122 & 0xff); + if (bts->network->T3122) { + rsl_send_imm_ass_rej(bts, 1, rqd_ref, + bts->network->T3122 & 0xff); + } return -ENOMEM; } -- cgit v1.2.3