aboutsummaryrefslogtreecommitdiffstats
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-04-19 17:38:33 +0200
commita934e5a2f99071b541fe76af108464d6ae6abb84 (patch)
tree3e499fe4f0fa3668d706feed0acf54d6c1abb96e
parent4e986da48ac4219592e94bb758bbe2f69a664fa8 (diff)
rsl: Check if the channel is active and then start the channel release
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 2ab66d650..b70bcd959 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;