summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-04-19 17:38:33 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-26 08:19:31 +0200
commit8270e04c3284b6301b57ac68845584b3bd6e7285 (patch)
tree4a726706da69598a56daf222def52971ec36e263
parentd0ddfdadb548b162e55f2d5b07aa102bde994cec (diff)
rsl: Check if the channel is active and then start the channel releasehfreyther/fixes/channel-release-handling
In case we receive ERROR INDICATION and CONNECTION FAILURE we only want to RF Channel Release the lchan once. This code is more simple and should work as reliable as the previous commit.
-rw-r--r--openbsc/src/libbsc/abis_rsl.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index c9d29b670..f200257da 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -726,6 +726,16 @@ static int rsl_rf_chan_release(struct gsm_lchan *lchan, int error,
return rc;
}
+/*
+ * Special handling for channel releases in the error case.
+ */
+static int rsl_rf_chan_release_err(struct gsm_lchan *lchan)
+{
+ if (lchan->state != LCHAN_S_ACTIVE)
+ return 0;
+ return rsl_rf_chan_release(lchan, 1, SACCH_DEACTIVATE);
+}
+
static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan)
{
@@ -1017,12 +1027,6 @@ static int rsl_rx_conn_fail(struct msgb *msg)
gsm_lchan_name(msg->lchan),
gsm_lchans_name(msg->lchan->state));
- /* We might have already received an ERROR INDICATION */
- if (msg->lchan->state != LCHAN_S_ACTIVE) {
- LOGPC(DRSL, LOGL_NOTICE, "\n");
- return 0;
- }
-
rsl_tlv_parse(&tp, dh->data, msgb_l2len(msg)-sizeof(*dh));
if (TLVP_PRESENT(&tp, RSL_IE_CAUSE))
@@ -1031,7 +1035,7 @@ static int rsl_rx_conn_fail(struct msgb *msg)
LOGPC(DRSL, LOGL_NOTICE, "\n");
osmo_counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rf_fail);
- return rsl_rf_chan_release(msg->lchan, 1, SACCH_DEACTIVATE);
+ return rsl_rf_chan_release_err(msg->lchan);
}
static void print_meas_rep_uni(struct gsm_meas_rep_unidir *mru,
@@ -1598,19 +1602,11 @@ static int rsl_rx_rll_err_ind(struct msgb *msg)
rsl_rlm_cause_name(rlm_cause),
gsm_lchans_name(msg->lchan->state));
- /* If the channel is already failing no need to inform anyone. */
- if (msg->lchan->state != LCHAN_S_ACTIVE)
- return 0;
-
rll_indication(msg->lchan, rllh->link_id, BSC_RLLR_IND_ERR_IND);
- /* The channel might have been released already. */
- if (msg->lchan->state != LCHAN_S_ACTIVE)
- return 0;
-
if (rlm_cause == RLL_CAUSE_T200_EXPIRED) {
osmo_counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rll_err);
- return rsl_rf_chan_release(msg->lchan, 1, SACCH_DEACTIVATE);
+ return rsl_rf_chan_release_err(msg->lchan);
}
return 0;