From d2dc1de9d984b89a64effe58d8f334373584fb30 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 8 Aug 2009 13:15:07 +0200 Subject: [PATCH] start using the RLL RELEASE procedures So far, we immediately disable the RF channel without following a proper RLL RELEASE procedure. This patch changes this. If we locally terminate the connection, the channel allocator now triggers a RLL RELEASE REQuest, which is responsed by the MS with a RLL RELEASE CONFirm, based on which we send the RF CHANnel RELease to the BTS. If the MS terminates the connection, we receive a RLL RELEASE INDication, based on which we trigger RF CHANnel RELease to the BTS. --- openbsc/include/openbsc/abis_rsl.h | 1 + openbsc/src/abis_rsl.c | 28 ++++++++++++++++++++++++++++ openbsc/src/chan_alloc.c | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 201c77fbc..02bc52130 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -476,6 +476,7 @@ int rsl_paging_cmd_subscr(struct gsm_bts *bts, u_int8_t chan_needed, int rsl_imm_assign_cmd(struct gsm_bts *bts, u_int8_t len, u_int8_t *val); int rsl_data_request(struct msgb *msg, u_int8_t link_id); +int rsl_relase_request(struct gsm_lchan *lchan, u_int8_t link_id); /* ip.access specfic RSL extensions */ int rsl_ipacc_bind(struct gsm_lchan *lchan); diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c index 1a2c58b16..726ef23a6 100644 --- a/openbsc/src/abis_rsl.c +++ b/openbsc/src/abis_rsl.c @@ -840,6 +840,27 @@ int rsl_data_request(struct msgb *msg, u_int8_t link_id) return abis_rsl_sendmsg(msg); } +/* Chapter 8.3.7 Request the release of multiframe mode of RLL connection. + This is what higher layers should call. The BTS then responds with + RELEASE CONFIRM, which we in turn use to trigger RSL CHANNEL RELEASE, + which in turn is acknowledged by RSL CHANNEL RELEASE ACK, which calls + lchan_free() */ +int rsl_release_request(struct gsm_lchan *lchan, u_int8_t link_id) +{ + struct msgb *msg = rsl_msgb_alloc(); + struct abis_rsl_rll_hdr *rh; + + rh = (struct abis_rsl_rll_hdr *) msgb_put(msg, sizeof(*rh)); + init_llm_hdr(rh, RSL_MT_REL_REQ); + //rh->c.msg_discr |= ABIS_RSL_MDISC_TRANSP; + rh->chan_nr = lchan2chan_nr(lchan); + rh->link_id = link_id; + + msg->trx = lchan->ts->trx; + + return abis_rsl_sendmsg(msg); +} + /* Chapter 8.4.2: Channel Activate Acknowledge */ static int rsl_rx_chan_act_ack(struct msgb *msg) { @@ -1234,10 +1255,17 @@ static int abis_rsl_rx_rll(struct msgb *msg) } break; case RSL_MT_REL_IND: + /* BTS informs us of having received DISC from MS */ DEBUGPC(DRLL, "RELEASE INDICATION\n"); + /* we can now releae the channel on the BTS/Abis side */ + rsl_chan_release(msg->lchan); break; case RSL_MT_REL_CONF: + /* BTS informs us of having received UA from MS, + * in response to DISC that we've sent earlier */ DEBUGPC(DRLL, "RELEASE CONFIRMATION\n"); + /* we can now releae the channel on the BTS/Abis side */ + rsl_chan_release(msg->lchan); break; case RSL_MT_ERROR_IND: rc = rsl_rx_rll_err_ind(msg); diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c index e3d6ae67e..a66f70e8c 100644 --- a/openbsc/src/chan_alloc.c +++ b/openbsc/src/chan_alloc.c @@ -239,7 +239,7 @@ int lchan_auto_release(struct gsm_lchan *lchan) } DEBUGP(DRLL, "Recycling the channel with: %d (%x)\n", lchan->nr, lchan->nr); - rsl_chan_release(lchan); + rsl_release_request(lchan, 0); return 1; }