Commit 1ea52fbd authored by Karsten Keil's avatar Karsten Keil Committed by David S. Miller

mISDN: Layer1 statemachine fix

The timer3 and the activation delay timer need to be independent.
If timer3 fires do not reqest power up we have to send only INFO 0.
Now layer1 pass TBR3 again.
Signed-off-by: default avatarKarsten Keil <kkeil@linux-pingi.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c626c127
...@@ -28,7 +28,8 @@ static u_int *debug; ...@@ -28,7 +28,8 @@ static u_int *debug;
struct layer1 { struct layer1 {
u_long Flags; u_long Flags;
struct FsmInst l1m; struct FsmInst l1m;
struct FsmTimer timer; struct FsmTimer timer3;
struct FsmTimer timerX;
int delay; int delay;
int t3_value; int t3_value;
struct dchannel *dch; struct dchannel *dch;
...@@ -135,7 +136,7 @@ l1_deact_req_s(struct FsmInst *fi, int event, void *arg) ...@@ -135,7 +136,7 @@ l1_deact_req_s(struct FsmInst *fi, int event, void *arg)
struct layer1 *l1 = fi->userdata; struct layer1 *l1 = fi->userdata;
mISDN_FsmChangeState(fi, ST_L1_F3); mISDN_FsmChangeState(fi, ST_L1_F3);
mISDN_FsmRestartTimer(&l1->timer, 550, EV_TIMER_DEACT, NULL, 2); mISDN_FsmRestartTimer(&l1->timerX, 550, EV_TIMER_DEACT, NULL, 2);
test_and_set_bit(FLG_L1_DEACTTIMER, &l1->Flags); test_and_set_bit(FLG_L1_DEACTTIMER, &l1->Flags);
} }
...@@ -180,11 +181,11 @@ l1_info4_ind(struct FsmInst *fi, int event, void *arg) ...@@ -180,11 +181,11 @@ l1_info4_ind(struct FsmInst *fi, int event, void *arg)
mISDN_FsmChangeState(fi, ST_L1_F7); mISDN_FsmChangeState(fi, ST_L1_F7);
l1->dcb(l1->dch, INFO3_P8); l1->dcb(l1->dch, INFO3_P8);
if (test_and_clear_bit(FLG_L1_DEACTTIMER, &l1->Flags)) if (test_and_clear_bit(FLG_L1_DEACTTIMER, &l1->Flags))
mISDN_FsmDelTimer(&l1->timer, 4); mISDN_FsmDelTimer(&l1->timerX, 4);
if (!test_bit(FLG_L1_ACTIVATED, &l1->Flags)) { if (!test_bit(FLG_L1_ACTIVATED, &l1->Flags)) {
if (test_and_clear_bit(FLG_L1_T3RUN, &l1->Flags)) if (test_and_clear_bit(FLG_L1_T3RUN, &l1->Flags))
mISDN_FsmDelTimer(&l1->timer, 3); mISDN_FsmDelTimer(&l1->timer3, 3);
mISDN_FsmRestartTimer(&l1->timer, 110, EV_TIMER_ACT, NULL, 2); mISDN_FsmRestartTimer(&l1->timerX, 110, EV_TIMER_ACT, NULL, 2);
test_and_set_bit(FLG_L1_ACTTIMER, &l1->Flags); test_and_set_bit(FLG_L1_ACTTIMER, &l1->Flags);
} }
} }
...@@ -202,7 +203,7 @@ l1_timer3(struct FsmInst *fi, int event, void *arg) ...@@ -202,7 +203,7 @@ l1_timer3(struct FsmInst *fi, int event, void *arg)
} }
if (l1->l1m.state != ST_L1_F6) { if (l1->l1m.state != ST_L1_F6) {
mISDN_FsmChangeState(fi, ST_L1_F3); mISDN_FsmChangeState(fi, ST_L1_F3);
l1->dcb(l1->dch, HW_POWERUP_REQ); /* do not force anything here, we need send INFO 0 */
} }
} }
...@@ -234,8 +235,9 @@ l1_activate_s(struct FsmInst *fi, int event, void *arg) ...@@ -234,8 +235,9 @@ l1_activate_s(struct FsmInst *fi, int event, void *arg)
{ {
struct layer1 *l1 = fi->userdata; struct layer1 *l1 = fi->userdata;
mISDN_FsmRestartTimer(&l1->timer, l1->t3_value, EV_TIMER3, NULL, 2); mISDN_FsmRestartTimer(&l1->timer3, l1->t3_value, EV_TIMER3, NULL, 2);
test_and_set_bit(FLG_L1_T3RUN, &l1->Flags); test_and_set_bit(FLG_L1_T3RUN, &l1->Flags);
/* Tell HW to send INFO 1 */
l1->dcb(l1->dch, HW_RESET_REQ); l1->dcb(l1->dch, HW_RESET_REQ);
} }
...@@ -303,7 +305,8 @@ static struct FsmNode L1SFnList[] = ...@@ -303,7 +305,8 @@ static struct FsmNode L1SFnList[] =
static void static void
release_l1(struct layer1 *l1) { release_l1(struct layer1 *l1) {
mISDN_FsmDelTimer(&l1->timer, 0); mISDN_FsmDelTimer(&l1->timerX, 0);
mISDN_FsmDelTimer(&l1->timer3, 0);
if (l1->dch) if (l1->dch)
l1->dch->l1 = NULL; l1->dch->l1 = NULL;
module_put(THIS_MODULE); module_put(THIS_MODULE);
...@@ -395,7 +398,8 @@ create_l1(struct dchannel *dch, dchannel_l1callback *dcb) { ...@@ -395,7 +398,8 @@ create_l1(struct dchannel *dch, dchannel_l1callback *dcb) {
nl1->l1m.printdebug = l1m_debug; nl1->l1m.printdebug = l1m_debug;
nl1->dch = dch; nl1->dch = dch;
nl1->dcb = dcb; nl1->dcb = dcb;
mISDN_FsmInitTimer(&nl1->l1m, &nl1->timer); mISDN_FsmInitTimer(&nl1->l1m, &nl1->timer3);
mISDN_FsmInitTimer(&nl1->l1m, &nl1->timerX);
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
dch->l1 = nl1; dch->l1 = nl1;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment