aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-12-25 23:45:14 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-12-26 00:20:18 +0100
commit006e3d87e019b202a38c5393ab8f5b6df763e664 (patch)
treef3da7f322fc3bd432d497ea27c8e15c74d711632
parent48ea4e8aec9fa07b3611e001557bd3bcebb0f178 (diff)
gsm: Do not attempt to release SAPI=0 if it was never allocated
In case of handover (but probably on RACH) we would send a RLL for SAPI=0 even if this SAPI was never established. After we have released all SAPI>0 locally check that SAPI=0 is established and if not release the rf channel directly.
-rw-r--r--openbsc/include/openbsc/abis_rsl.h2
-rw-r--r--openbsc/src/libbsc/abis_rsl.c22
-rw-r--r--openbsc/src/libbsc/chan_alloc.c2
3 files changed, 26 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h
index 4f2b6b551..06f0a721c 100644
--- a/openbsc/include/openbsc/abis_rsl.h
+++ b/openbsc/include/openbsc/abis_rsl.h
@@ -101,5 +101,7 @@ int rsl_release_sapis_from(struct gsm_lchan *lchan, int start,
enum rsl_rel_mode release_mode);
int rsl_start_t3109(struct gsm_lchan *lchan);
+int rsl_direct_rf_release(struct gsm_lchan *lchan);
+
#endif /* RSL_MT_H */
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 6e1ce7852..42dad7fde 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -2141,3 +2141,25 @@ int rsl_start_t3109(struct gsm_lchan *lchan)
osmo_timer_schedule(&lchan->T3109, bts->network->T3109, 0);
return 0;
}
+
+/**
+ * \brief directly RF Channel Release the lchan
+ *
+ * When no SAPI was allocated, directly release the logical channel. This
+ * should only be called from chan_alloc.c on channel release handling. In
+ * case no SAPI was established the RF Channel can be directly released,
+ */
+int rsl_direct_rf_release(struct gsm_lchan *lchan)
+{
+ int i;
+ for (i = 0; i < ARRAY_SIZE(lchan->sapis); ++i) {
+ if (lchan->sapis[i] != LCHAN_SAPI_UNUSED) {
+ LOGP(DRSL, LOGL_ERROR, "%s SAPI(%d) still allocated.\n",
+ gsm_lchan_name(lchan), i);
+ return -1;
+ }
+ }
+
+ /* Now release it */
+ return rsl_rf_chan_release(lchan, 0, SACCH_NONE);
+}
diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index 9b59d5df0..411a6cbef 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -393,6 +393,8 @@ static void _lchan_handle_release(struct gsm_lchan *lchan,
/* Deactivate the SACCH on the BTS side */
rsl_deact_sacch(lchan);
rsl_start_t3109(lchan);
+ } else if (lchan->sapis[0] == LCHAN_SAPI_UNUSED) {
+ rsl_direct_rf_release(lchan);
} else {
rsl_release_request(lchan, 0, mode);
}