aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-07-05 16:59:27 +0200
committerHarald Welte <laforge@gnumonks.org>2011-07-05 16:59:27 +0200
commit39eadbbb17c8e634b2f641c2f6148f27a975f7de (patch)
tree259d07d1b30559ba6a0f3924ac3ee253af2e81ca
parent547b1d1916a89a6ebd2ba980005582a426bf3a31 (diff)
sysmbts L1 if: implement 'dead DSP L1 detection'
when we activate the SCH in the DSP, we start a 5-second timer. If we ever do not receive any MPH-TIME.ind primitives from L1 within that time frame, we stop the process (and will be re-spawned)
-rw-r--r--src/osmo-bts-sysmo/l1_if.c3
-rw-r--r--src/osmo-bts-sysmo/l1_if.h3
-rw-r--r--src/osmo-bts-sysmo/oml.c24
3 files changed, 30 insertions, 0 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index b87cfdc..8d2c8f6 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -357,6 +357,9 @@ static int handle_mph_time_ind(struct femtol1_hdl *fl1,
* and pre-compute the respective measurement */
trx_meas_check_compute(fl1->priv, time_ind->u32Fn -1);
+ /* increment the primitive count for the alive timer */
+ fl1->alive_prim_cnt++;
+
return 0;
}
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
index 1893420..3bba399 100644
--- a/src/osmo-bts-sysmo/l1_if.h
+++ b/src/osmo-bts-sysmo/l1_if.h
@@ -25,6 +25,9 @@ struct femtol1_hdl {
void *priv; /* user reference */
+ struct osmo_timer_list alive_timer;
+ unsigned int alive_prim_cnt;
+
struct osmo_fd read_ofd[_NUM_MQ_READ]; /* osmo file descriptors */
struct osmo_wqueue write_q[_NUM_MQ_WRITE];
};
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 014730f..a7469e2 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -437,6 +437,19 @@ l1if_hLayer2_to_lchan(struct gsm_bts_trx *trx, uint32_t hLayer2)
return &ts->lchan[lchan_nr];
}
+/* we regularly check if the DSP L1 is still sending us primitives.
+ * if not, we simply stop the BTS program (and be re-spawned) */
+static void alive_timer_cb(void *data)
+{
+ struct femtol1_hdl *fl1h = data;
+
+ if (fl1h->alive_prim_cnt == 0) {
+ LOGP(DL1C, LOGL_FATAL, "DSP L1 is no longer sending primitives!\n");
+ exit(23);
+ }
+ fl1h->alive_prim_cnt = 0;
+ osmo_timer_schedule(&fl1h->alive_timer, 5, 0);
+}
int lchan_activate(struct gsm_lchan *lchan)
@@ -460,6 +473,13 @@ int lchan_activate(struct gsm_lchan *lchan)
act_req->hLayer2 = l1if_lchan_to_hLayer2(lchan);
switch (act_req->sapi) {
+ case GsmL1_Sapi_Sch:
+ /* once we activate the SCH, we should get MPH-TIME.ind */
+ fl1h->alive_timer.cb = alive_timer_cb;
+ fl1h->alive_timer.data = fl1h;
+ fl1h->alive_prim_cnt = 0;
+ osmo_timer_schedule(&fl1h->alive_timer, 5, 0);
+ break;
case GsmL1_Sapi_Rach:
lch_par->rach.u8Bsic = lchan->ts->trx->bts->bsic;
break;
@@ -552,6 +572,10 @@ int lchan_deactivate(struct gsm_lchan *lchan)
gsm_lchan_name(lchan),
get_value_string(femtobts_l1sapi_names, deact_req->sapi));
+ /* Stop the alive timer once we deactivate the SCH */
+ if (deact_req->sapi == GsmL1_Sapi_Sch)
+ osmo_timer_del(&fl1h->alive_timer);
+
/* send the primitive for all GsmL1_Sapi_* that match the LCHAN */
l1if_req_compl(fl1h, msg, 0, lchan_deact_compl_cb, lchan);