diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-07-29 17:09:36 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-07-31 04:09:38 +0800 |
commit | 4b85a323600a623afc7728f9d3433e4745765a7c (patch) | |
tree | 8c4110976d5024ef1275ce930ef661bcbc0ac940 /openbsc/src/abis_rsl.c | |
parent | aeb45f518675db74135ac5067c15292ba6d4db31 (diff) |
chan_alloc: Change Channel Release to release SAPIs, then the channel
Currently every SAPI release indication will trigger the channel. It
was possible that we had SAPI=3 and SAPI=0 allocated and we tried to
release the channel by sending a RF Channel Release, the BTS answered
with a RF Channel Release ACK but also sent the SAPI Release Indication
which triggered a channel release here. So it was possible that we
would have released a newly allocated channel because of the SAPI
release of the old connection.
This code now works by releasing all SAPIs from highest to lowest,
then sending a SACH Deactivate and finally releasing the channel. This
approach is in use on the on-waves/bsc-master.
Diffstat (limited to 'openbsc/src/abis_rsl.c')
-rw-r--r-- | openbsc/src/abis_rsl.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c index 7b19d7f43..706842225 100644 --- a/openbsc/src/abis_rsl.c +++ b/openbsc/src/abis_rsl.c @@ -1356,11 +1356,21 @@ static int rsl_rx_rll_err_ind(struct msgb *msg) static void rsl_handle_release(struct gsm_lchan *lchan) { + int sapi; struct gsm_bts *bts; + + /* maybe we have only brought down one RLL */ if (lchan->state != LCHAN_S_REL_REQ) - LOGP(DRSL, LOGL_ERROR, "RF release on %s but state %s\n", - gsm_lchan_name(lchan), - gsm_lchans_name(lchan->state)); + return; + + for (sapi = 0; sapi < ARRAY_SIZE(lchan->sapis); ++sapi) { + if (lchan->sapis[sapi] == LCHAN_SAPI_UNUSED) + continue; + LOGP(DRSL, LOGL_NOTICE, "%s waiting for SAPI=%d to be released.\n", + gsm_lchan_name(lchan), sapi); + return; + } + /* wait a bit to send the RF Channel Release */ @@ -1422,6 +1432,7 @@ static int abis_rsl_rx_rll(struct msgb *msg) rll_indication(msg->lchan, rllh->link_id, BSC_RLLR_IND_REL_IND); rsl_handle_release(msg->lchan); + rsl_lchan_rll_release(msg->lchan, rllh->link_id); break; case RSL_MT_REL_CONF: /* BTS informs us of having received UA from MS, @@ -1429,6 +1440,7 @@ static int abis_rsl_rx_rll(struct msgb *msg) DEBUGPC(DRLL, "RELEASE CONFIRMATION\n"); msg->lchan->sapis[rllh->link_id & 0x7] = LCHAN_SAPI_UNUSED; rsl_handle_release(msg->lchan); + rsl_lchan_rll_release(msg->lchan, rllh->link_id); break; case RSL_MT_ERROR_IND: rc = rsl_rx_rll_err_ind(msg); |