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)
This commit is contained in:
Harald Welte 2011-07-05 16:59:27 +02:00
parent 547b1d1916
commit 39eadbbb17
3 changed files with 30 additions and 0 deletions

View File

@ -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;
}

View File

@ -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];
};

View File

@ -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);