aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-10-28 14:23:39 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-10-29 04:20:21 +0100
commit5ba6f480926bee1eeeaf2997a5f18a4a533d5374 (patch)
treec17db5e8027caa72f2b82e0836b0bd6ef5527def /openbsc
parent5ea731338d9497e26b8bde1483de7c768f17c244 (diff)
[lchan] Keep track which SAPIs has been established with the BTS
Keep track of which SAPIs have been established either by the BTS (from the MS) or by us. This can be used by the on-waves BSC code to figure out if a new request should be made.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/gsm_data.h8
-rw-r--r--openbsc/src/abis_rsl.c4
-rw-r--r--openbsc/src/chan_alloc.c3
3 files changed, 15 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 927c32846..94a70818a 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -131,6 +131,11 @@ struct gsm_loc_updating_operation {
#define MAX_A5_KEY_LEN (128/8)
#define RSL_ENC_ALG_A5(x) (x+1)
+/* is the data link established? who established it? */
+#define LCHAN_SAPI_UNUSED 0
+#define LCHAN_SAPI_MS 1
+#define LCHAN_SAPI_NET 2
+
struct gsm_lchan {
/* The TS that we're part of */
struct gsm_bts_trx_ts *ts;
@@ -160,6 +165,9 @@ struct gsm_lchan {
struct timer_list T3101;
+ /* Established data link layer services */
+ u_int8_t sapis[8];
+
/*
* Operations that have a state and might be pending
*/
diff --git a/openbsc/src/abis_rsl.c b/openbsc/src/abis_rsl.c
index a4764f5fb..acd41dd63 100644
--- a/openbsc/src/abis_rsl.c
+++ b/openbsc/src/abis_rsl.c
@@ -1294,6 +1294,7 @@ static int abis_rsl_rx_rll(struct msgb *msg)
case RSL_MT_EST_IND:
DEBUGPC(DRLL, "ESTABLISH INDICATION\n");
/* lchan is established, stop T3101 */
+ msg->lchan->sapis[rllh->link_id & 0x7] = LCHAN_SAPI_MS;
bsc_del_timer(&msg->lchan->T3101);
if (msgb_l2len(msg) >
sizeof(struct abis_rsl_common_hdr) + sizeof(*rllh) &&
@@ -1304,12 +1305,14 @@ static int abis_rsl_rx_rll(struct msgb *msg)
break;
case RSL_MT_EST_CONF:
DEBUGPC(DRLL, "ESTABLISH CONFIRM\n");
+ msg->lchan->sapis[rllh->link_id & 0x7] = LCHAN_SAPI_NET;
rll_indication(msg->lchan, rllh->link_id,
BSC_RLLR_IND_EST_CONF);
break;
case RSL_MT_REL_IND:
/* BTS informs us of having received DISC from MS */
DEBUGPC(DRLL, "RELEASE INDICATION\n");
+ msg->lchan->sapis[rllh->link_id & 0x7] = LCHAN_SAPI_UNUSED;
rll_indication(msg->lchan, rllh->link_id,
BSC_RLLR_IND_REL_IND);
/* we can now releae the channel on the BTS/Abis side */
@@ -1321,6 +1324,7 @@ static int abis_rsl_rx_rll(struct msgb *msg)
/* BTS informs us of having received UA from MS,
* in response to DISC that we've sent earlier */
DEBUGPC(DRLL, "RELEASE CONFIRMATION\n");
+ msg->lchan->sapis[rllh->link_id & 0x7] = LCHAN_SAPI_UNUSED;
/* we can now releae the channel on the BTS/Abis side */
/* FIXME: officially we need to start T3111 and wait for
* some grace period */
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c
index 541c6c35e..7464aa96b 100644
--- a/openbsc/src/chan_alloc.c
+++ b/openbsc/src/chan_alloc.c
@@ -212,6 +212,9 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type)
lchan->type = type;
lchan->use_count = 0;
+ /* clear sapis */
+ memset(lchan->sapis, 0, sizeof(lchan->sapis));
+
/* Configure the time and start it so it will be closed */
lchan->release_timer.cb = auto_release_channel;
lchan->release_timer.data = lchan;