Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
a8a5aeea
Commit
a8a5aeea
authored
Oct 05, 2002
by
Kai Germaschewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ISDN: split isdn_net state machine
No code change, just splitting different states into separate functions.
parent
2cb28010
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
180 additions
and
137 deletions
+180
-137
drivers/isdn/i4l/isdn_net.c
drivers/isdn/i4l/isdn_net.c
+180
-137
No files found.
drivers/isdn/i4l/isdn_net.c
View file @
a8a5aeea
...
@@ -400,62 +400,11 @@ do_dialout(isdn_net_dev *idev)
...
@@ -400,62 +400,11 @@ do_dialout(isdn_net_dev *idev)
add_timer
(
&
idev
->
dial_timer
);
add_timer
(
&
idev
->
dial_timer
);
}
}
/* For EV_NET_DIAL, returns 1 if timer callback is needed
static
int
* For ISDN_STAT_*, returns 1 if event was for us
isdn_net_event_out_wait_dconn
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
*/
int
isdn_net_handle_event
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
{
{
isdn_net_local
*
mlp
=
idev
->
mlp
;
isdn_ctrl
*
c
=
arg
;
isdn_ctrl
cmd
;
isdn_ctrl
cmd
;
dbg_net_dial
(
"%s: dialstate=%d pr=%#x
\n
"
,
idev
->
name
,
idev
->
dialstate
,
pr
);
switch
(
idev
->
dialstate
)
{
case
ST_ACTIVE
:
switch
(
pr
)
{
case
ISDN_STAT_BSENT
:
/* A packet has successfully been sent out */
isdn_net_dec_frame_cnt
(
idev
);
mlp
->
stats
.
tx_packets
++
;
mlp
->
stats
.
tx_bytes
+=
c
->
parm
.
length
;
return
1
;
case
ISDN_STAT_DHUP
:
if
(
mlp
->
ops
->
disconnected
)
mlp
->
ops
->
disconnected
(
idev
);
isdn_net_lp_disconnected
(
idev
);
isdn_slot_all_eaz
(
idev
->
isdn_slot
);
printk
(
KERN_INFO
"%s: remote hangup
\n
"
,
idev
->
name
);
printk
(
KERN_INFO
"%s: Chargesum is %d
\n
"
,
idev
->
name
,
idev
->
charge
);
isdn_net_unbind_channel
(
idev
);
return
1
;
case
ISDN_STAT_CINF
:
/* Charge-info from TelCo. Calculate interval between
* charge-infos and set timestamp for last info for
* usage by isdn_net_autohup()
*/
idev
->
charge
++
;
switch
(
idev
->
charge_state
)
{
case
ST_CHARGE_NULL
:
idev
->
charge_state
=
ST_CHARGE_GOT_CINF
;
break
;
case
ST_CHARGE_GOT_CINF
:
idev
->
charge_state
=
ST_CHARGE_HAVE_CINT
;
/* fall through */
case
ST_CHARGE_HAVE_CINT
:
idev
->
chargeint
=
jiffies
-
idev
->
chargetime
-
2
*
HZ
;
break
;
}
idev
->
chargetime
=
jiffies
;
dbg_net_dial
(
"%s: got CINF
\n
"
,
idev
->
name
);
return
1
;
}
break
;
case
ST_OUT_WAIT_DCONN
:
switch
(
pr
)
{
switch
(
pr
)
{
case
EV_NET_TIMER_OUT_DCONN
:
case
EV_NET_TIMER_OUT_DCONN
:
/* try again */
/* try again */
...
@@ -483,8 +432,13 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
...
@@ -483,8 +432,13 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
isdn_net_unbind_channel
(
idev
);
isdn_net_unbind_channel
(
idev
);
return
1
;
return
1
;
}
}
break
;
isdn_BUG
();
case
ST_OUT_WAIT_BCONN
:
return
0
;
}
static
int
isdn_net_event_out_wait_bconn
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
{
switch
(
pr
)
{
switch
(
pr
)
{
case
EV_NET_TIMER_OUT_BCONN
:
case
EV_NET_TIMER_OUT_BCONN
:
/* try again */
/* try again */
...
@@ -502,8 +456,15 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
...
@@ -502,8 +456,15 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
isdn_net_unbind_channel
(
idev
);
isdn_net_unbind_channel
(
idev
);
return
1
;
return
1
;
}
}
break
;
isdn_BUG
();
case
ST_IN_WAIT_DCONN
:
return
0
;
}
static
int
isdn_net_event_in_wait_dconn
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
{
isdn_ctrl
cmd
;
switch
(
pr
)
{
switch
(
pr
)
{
case
EV_NET_TIMER_IN_DCONN
:
case
EV_NET_TIMER_IN_DCONN
:
isdn_net_hangup
(
idev
);
isdn_net_hangup
(
idev
);
...
@@ -523,8 +484,13 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
...
@@ -523,8 +484,13 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
isdn_net_unbind_channel
(
idev
);
isdn_net_unbind_channel
(
idev
);
return
1
;
return
1
;
}
}
break
;
isdn_BUG
();
case
ST_IN_WAIT_BCONN
:
return
0
;
}
static
int
isdn_net_event_in_wait_bconn
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
{
switch
(
pr
)
{
switch
(
pr
)
{
case
EV_NET_TIMER_IN_BCONN
:
case
EV_NET_TIMER_IN_BCONN
:
isdn_net_hangup
(
idev
);
isdn_net_hangup
(
idev
);
...
@@ -541,23 +507,100 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
...
@@ -541,23 +507,100 @@ isdn_net_handle_event(isdn_net_dev *idev, int pr, void *arg)
isdn_net_unbind_channel
(
idev
);
isdn_net_unbind_channel
(
idev
);
return
1
;
return
1
;
}
}
break
;
isdn_BUG
();
case
ST_WAIT_BEFORE_CB
:
return
0
;
}
static
int
isdn_net_event_wait_before_cb
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
{
switch
(
pr
)
{
switch
(
pr
)
{
case
EV_NET_TIMER_CB
:
case
EV_NET_TIMER_CB
:
/* Callback Delay */
/* Callback Delay */
init_dialout
(
idev
);
init_dialout
(
idev
);
return
1
;
return
1
;
}
}
break
;
default:
isdn_BUG
();
isdn_BUG
();
return
0
;
}
static
int
isdn_net_event_active
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
{
isdn_net_local
*
mlp
=
idev
->
mlp
;
isdn_ctrl
*
c
=
arg
;
switch
(
pr
)
{
case
ISDN_STAT_BSENT
:
/* A packet has successfully been sent out */
isdn_net_dec_frame_cnt
(
idev
);
mlp
->
stats
.
tx_packets
++
;
mlp
->
stats
.
tx_bytes
+=
c
->
parm
.
length
;
return
1
;
case
ISDN_STAT_DHUP
:
if
(
mlp
->
ops
->
disconnected
)
mlp
->
ops
->
disconnected
(
idev
);
isdn_net_lp_disconnected
(
idev
);
isdn_slot_all_eaz
(
idev
->
isdn_slot
);
printk
(
KERN_INFO
"%s: remote hangup
\n
"
,
idev
->
name
);
printk
(
KERN_INFO
"%s: Chargesum is %d
\n
"
,
idev
->
name
,
idev
->
charge
);
isdn_net_unbind_channel
(
idev
);
return
1
;
case
ISDN_STAT_CINF
:
/* Charge-info from TelCo. Calculate interval between
* charge-infos and set timestamp for last info for
* usage by isdn_net_autohup()
*/
idev
->
charge
++
;
switch
(
idev
->
charge_state
)
{
case
ST_CHARGE_NULL
:
idev
->
charge_state
=
ST_CHARGE_GOT_CINF
;
break
;
case
ST_CHARGE_GOT_CINF
:
idev
->
charge_state
=
ST_CHARGE_HAVE_CINT
;
/* fall through */
case
ST_CHARGE_HAVE_CINT
:
idev
->
chargeint
=
jiffies
-
idev
->
chargetime
-
2
*
HZ
;
break
;
break
;
}
}
idev
->
chargetime
=
jiffies
;
dbg_net_dial
(
"%s: got CINF
\n
"
,
idev
->
name
);
return
1
;
}
isdn_BUG
();
isdn_BUG
();
return
0
;
return
0
;
}
}
/* For EV_NET_DIAL, returns 1 if timer callback is needed
* For ISDN_STAT_*, returns 1 if event was for us
*/
int
isdn_net_handle_event
(
isdn_net_dev
*
idev
,
int
pr
,
void
*
arg
)
{
dbg_net_dial
(
"%s: dialstate=%d pr=%#x
\n
"
,
idev
->
name
,
idev
->
dialstate
,
pr
);
switch
(
idev
->
dialstate
)
{
case
ST_ACTIVE
:
return
isdn_net_event_active
(
idev
,
pr
,
arg
);
case
ST_OUT_WAIT_DCONN
:
return
isdn_net_event_out_wait_dconn
(
idev
,
pr
,
arg
);
case
ST_OUT_WAIT_BCONN
:
return
isdn_net_event_out_wait_bconn
(
idev
,
pr
,
arg
);
case
ST_IN_WAIT_DCONN
:
return
isdn_net_event_in_wait_dconn
(
idev
,
pr
,
arg
);
case
ST_IN_WAIT_BCONN
:
return
isdn_net_event_in_wait_bconn
(
idev
,
pr
,
arg
);
case
ST_WAIT_BEFORE_CB
:
return
isdn_net_event_wait_before_cb
(
idev
,
pr
,
arg
);
default:
isdn_BUG
();
return
0
;
}
}
/*
/*
* Perform hangup for a net-interface.
* Perform hangup for a net-interface.
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment