oml: Create mph_send_activate_req for sending the activation request
Move the channel activation out of the loop into a dedicated function. This is done in preparation of separating the decision to activate something and sending the request.
This commit is contained in:
parent
f0c5a424af
commit
bcd50d3219
|
@ -648,13 +648,9 @@ static void lchan2lch_par(GsmL1_LogChParam_t *lch_par, struct gsm_lchan *lchan)
|
|||
}
|
||||
}
|
||||
|
||||
int lchan_activate(struct gsm_lchan *lchan)
|
||||
static int mph_send_activate_req(struct gsm_lchan *lchan, int sapi, int dir)
|
||||
{
|
||||
struct femtol1_hdl *fl1h = trx_femtol1_hdl(lchan->ts->trx);
|
||||
const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type];
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < s4l->num_sapis; i++) {
|
||||
struct msgb *msg = l1p_msgb_alloc();
|
||||
GsmL1_MphActivateReq_t *act_req;
|
||||
GsmL1_LogChParam_t *lch_par;
|
||||
|
@ -663,19 +659,12 @@ int lchan_activate(struct gsm_lchan *lchan)
|
|||
lch_par = &act_req->logChPrm;
|
||||
act_req->u8Tn = lchan->ts->nr;
|
||||
act_req->subCh = lchan_to_GsmL1_SubCh_t(lchan);
|
||||
act_req->dir = s4l->sapis[i].dir;
|
||||
act_req->sapi = s4l->sapis[i].sapi;
|
||||
act_req->dir = dir;
|
||||
act_req->sapi = sapi;
|
||||
act_req->hLayer2 = l1if_lchan_to_hLayer(lchan);
|
||||
act_req->hLayer3 = act_req->hLayer2;
|
||||
|
||||
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;
|
||||
|
@ -717,9 +706,24 @@ int lchan_activate(struct gsm_lchan *lchan)
|
|||
get_value_string(femtobts_dir_names, act_req->dir));
|
||||
|
||||
/* send the primitive for all GsmL1_Sapi_* that match the LCHAN */
|
||||
l1if_gsm_req_compl(fl1h, msg, lchan_act_compl_cb,
|
||||
lchan->ts->trx);
|
||||
return l1if_gsm_req_compl(fl1h, msg, lchan_act_compl_cb, lchan->ts->trx);
|
||||
}
|
||||
|
||||
int lchan_activate(struct gsm_lchan *lchan)
|
||||
{
|
||||
struct femtol1_hdl *fl1h = trx_femtol1_hdl(lchan->ts->trx);
|
||||
const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type];
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < s4l->num_sapis; i++) {
|
||||
if (s4l->sapis[i].sapi == 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);
|
||||
}
|
||||
mph_send_activate_req(lchan, s4l->sapis[i].sapi, s4l->sapis[i].dir);
|
||||
}
|
||||
lchan_set_state(lchan, LCHAN_S_ACT_REQ);
|
||||
|
||||
|
|
Loading…
Reference in New Issue