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
nexedi
linux
Commits
7a675c1b
Commit
7a675c1b
authored
Sep 21, 2003
by
Vinay K. Nallamothu
Committed by
David S. Miller
Sep 21, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NETROM]: Timer code cleanup.
parent
a0aaef1c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
71 deletions
+40
-71
net/netrom/af_netrom.c
net/netrom/af_netrom.c
+4
-14
net/netrom/nr_loopback.c
net/netrom/nr_loopback.c
+8
-23
net/netrom/nr_timer.c
net/netrom/nr_timer.c
+28
-34
No files found.
net/netrom/af_netrom.c
View file @
7a675c1b
...
@@ -62,6 +62,7 @@ static HLIST_HEAD(nr_list);
...
@@ -62,6 +62,7 @@ static HLIST_HEAD(nr_list);
static
spinlock_t
nr_list_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
nr_list_lock
=
SPIN_LOCK_UNLOCKED
;
static
struct
proto_ops
nr_proto_ops
;
static
struct
proto_ops
nr_proto_ops
;
void
nr_init_timers
(
struct
sock
*
sk
);
static
struct
sock
*
nr_alloc_sock
(
void
)
static
struct
sock
*
nr_alloc_sock
(
void
)
{
{
...
@@ -279,17 +280,12 @@ void nr_destroy_socket(struct sock *sk)
...
@@ -279,17 +280,12 @@ void nr_destroy_socket(struct sock *sk)
kfree_skb
(
skb
);
kfree_skb
(
skb
);
}
}
while
((
skb
=
skb_dequeue
(
&
sk
->
sk_write_queue
))
!=
NULL
)
{
kfree_skb
(
skb
);
}
if
(
atomic_read
(
&
sk
->
sk_wmem_alloc
)
||
if
(
atomic_read
(
&
sk
->
sk_wmem_alloc
)
||
atomic_read
(
&
sk
->
sk_rmem_alloc
))
{
atomic_read
(
&
sk
->
sk_rmem_alloc
))
{
/* Defer: outstanding buffers */
/* Defer: outstanding buffers */
init_timer
(
&
sk
->
sk_timer
);
sk
->
sk_timer
.
expires
=
jiffies
+
2
*
HZ
;
sk
->
sk_timer
.
function
=
nr_destroy_timer
;
sk
->
sk_timer
.
function
=
nr_destroy_timer
;
sk
->
sk_timer
.
data
=
(
unsigned
long
)
sk
;
sk
->
sk_timer
.
expires
=
jiffies
+
2
*
HZ
;
add_timer
(
&
sk
->
sk_timer
);
add_timer
(
&
sk
->
sk_timer
);
}
else
}
else
sock_put
(
sk
);
sock_put
(
sk
);
...
@@ -442,10 +438,7 @@ static int nr_create(struct socket *sock, int protocol)
...
@@ -442,10 +438,7 @@ static int nr_create(struct socket *sock, int protocol)
skb_queue_head_init
(
&
nr
->
reseq_queue
);
skb_queue_head_init
(
&
nr
->
reseq_queue
);
skb_queue_head_init
(
&
nr
->
frag_queue
);
skb_queue_head_init
(
&
nr
->
frag_queue
);
init_timer
(
&
nr
->
t1timer
);
nr_init_timers
(
sk
);
init_timer
(
&
nr
->
t2timer
);
init_timer
(
&
nr
->
t4timer
);
init_timer
(
&
nr
->
idletimer
);
nr
->
t1
=
sysctl_netrom_transport_timeout
;
nr
->
t1
=
sysctl_netrom_transport_timeout
;
nr
->
t2
=
sysctl_netrom_transport_acknowledge_delay
;
nr
->
t2
=
sysctl_netrom_transport_acknowledge_delay
;
...
@@ -491,10 +484,7 @@ static struct sock *nr_make_new(struct sock *osk)
...
@@ -491,10 +484,7 @@ static struct sock *nr_make_new(struct sock *osk)
skb_queue_head_init
(
&
nr
->
reseq_queue
);
skb_queue_head_init
(
&
nr
->
reseq_queue
);
skb_queue_head_init
(
&
nr
->
frag_queue
);
skb_queue_head_init
(
&
nr
->
frag_queue
);
init_timer
(
&
nr
->
t1timer
);
nr_init_timers
(
sk
);
init_timer
(
&
nr
->
t2timer
);
init_timer
(
&
nr
->
t4timer
);
init_timer
(
&
nr
->
idletimer
);
onr
=
nr_sk
(
osk
);
onr
=
nr_sk
(
osk
);
...
...
net/netrom/nr_loopback.c
View file @
7a675c1b
...
@@ -14,19 +14,17 @@
...
@@ -14,19 +14,17 @@
#include <net/netrom.h>
#include <net/netrom.h>
#include <linux/init.h>
#include <linux/init.h>
static
struct
sk_buff_head
loopback_queue
;
static
void
nr_loopback_timer
(
unsigned
long
);
static
struct
timer_list
loopback_timer
;
static
void
nr_set_loopback_timer
(
void
);
static
struct
sk_buff_head
loopback_queue
;
static
struct
timer_list
loopback_timer
=
TIMER_INITIALIZER
(
nr_loopback_timer
,
0
,
0
);
void
nr_loopback_init
(
void
)
void
__init
nr_loopback_init
(
void
)
{
{
skb_queue_head_init
(
&
loopback_queue
);
skb_queue_head_init
(
&
loopback_queue
);
init_timer
(
&
loopback_timer
);
}
}
static
int
nr_loopback_running
(
void
)
static
in
line
in
t
nr_loopback_running
(
void
)
{
{
return
timer_pending
(
&
loopback_timer
);
return
timer_pending
(
&
loopback_timer
);
}
}
...
@@ -42,26 +40,13 @@ int nr_loopback_queue(struct sk_buff *skb)
...
@@ -42,26 +40,13 @@ int nr_loopback_queue(struct sk_buff *skb)
skb_queue_tail
(
&
loopback_queue
,
skbn
);
skb_queue_tail
(
&
loopback_queue
,
skbn
);
if
(
!
nr_loopback_running
())
if
(
!
nr_loopback_running
())
nr_set_loopback_timer
(
);
mod_timer
(
&
loopback_timer
,
jiffies
+
10
);
}
}
kfree_skb
(
skb
);
kfree_skb
(
skb
);
return
1
;
return
1
;
}
}
static
void
nr_loopback_timer
(
unsigned
long
);
static
void
nr_set_loopback_timer
(
void
)
{
del_timer
(
&
loopback_timer
);
loopback_timer
.
data
=
0
;
loopback_timer
.
function
=
&
nr_loopback_timer
;
loopback_timer
.
expires
=
jiffies
+
10
;
add_timer
(
&
loopback_timer
);
}
static
void
nr_loopback_timer
(
unsigned
long
param
)
static
void
nr_loopback_timer
(
unsigned
long
param
)
{
{
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
...
@@ -80,12 +65,12 @@ static void nr_loopback_timer(unsigned long param)
...
@@ -80,12 +65,12 @@ static void nr_loopback_timer(unsigned long param)
dev_put
(
dev
);
dev_put
(
dev
);
if
(
!
skb_queue_empty
(
&
loopback_queue
)
&&
!
nr_loopback_running
())
if
(
!
skb_queue_empty
(
&
loopback_queue
)
&&
!
nr_loopback_running
())
nr_set_loopback_timer
(
);
mod_timer
(
&
loopback_timer
,
jiffies
+
10
);
}
}
}
}
void
__exit
nr_loopback_clear
(
void
)
void
__exit
nr_loopback_clear
(
void
)
{
{
del_timer
(
&
loopback_timer
);
del_timer
_sync
(
&
loopback_timer
);
skb_queue_purge
(
&
loopback_queue
);
skb_queue_purge
(
&
loopback_queue
);
}
}
net/netrom/nr_timer.c
View file @
7a675c1b
...
@@ -36,69 +36,63 @@ static void nr_t2timer_expiry(unsigned long);
...
@@ -36,69 +36,63 @@ static void nr_t2timer_expiry(unsigned long);
static
void
nr_t4timer_expiry
(
unsigned
long
);
static
void
nr_t4timer_expiry
(
unsigned
long
);
static
void
nr_idletimer_expiry
(
unsigned
long
);
static
void
nr_idletimer_expiry
(
unsigned
long
);
void
nr_
start_t1timer
(
struct
sock
*
sk
)
void
nr_
init_timers
(
struct
sock
*
sk
)
{
{
nr_cb
*
nr
=
nr_sk
(
sk
);
nr_cb
*
nr
=
nr_sk
(
sk
);
del_timer
(
&
nr
->
t1timer
);
init_timer
(
&
nr
->
t1timer
);
nr
->
t1timer
.
data
=
(
unsigned
long
)
sk
;
nr
->
t1timer
.
data
=
(
unsigned
long
)
sk
;
nr
->
t1timer
.
function
=
&
nr_t1timer_expiry
;
nr
->
t1timer
.
function
=
&
nr_t1timer_expiry
;
nr
->
t1timer
.
expires
=
jiffies
+
nr
->
t1
;
init_timer
(
&
nr
->
t2timer
);
nr
->
t2timer
.
data
=
(
unsigned
long
)
sk
;
nr
->
t2timer
.
function
=
&
nr_t2timer_expiry
;
init_timer
(
&
nr
->
t4timer
);
nr
->
t4timer
.
data
=
(
unsigned
long
)
sk
;
nr
->
t4timer
.
function
=
&
nr_t4timer_expiry
;
init_timer
(
&
nr
->
idletimer
);
nr
->
idletimer
.
data
=
(
unsigned
long
)
sk
;
nr
->
idletimer
.
function
=
&
nr_idletimer_expiry
;
add_timer
(
&
nr
->
t1timer
);
/* initialized by sock_init_data */
sk
->
sk_timer
.
data
=
(
unsigned
long
)
sk
;
sk
->
sk_timer
.
function
=
&
nr_heartbeat_expiry
;
}
}
void
nr_start_t
2
timer
(
struct
sock
*
sk
)
void
nr_start_t
1
timer
(
struct
sock
*
sk
)
{
{
nr_cb
*
nr
=
nr_sk
(
sk
);
nr_cb
*
nr
=
nr_sk
(
sk
);
del_timer
(
&
nr
->
t2timer
);
mod_timer
(
&
nr
->
t1timer
,
jiffies
+
nr
->
t1
);
}
nr
->
t2timer
.
data
=
(
unsigned
long
)
sk
;
void
nr_start_t2timer
(
struct
sock
*
sk
)
nr
->
t2timer
.
function
=
&
nr_t2timer_expiry
;
{
nr
->
t2timer
.
expires
=
jiffies
+
nr
->
t2
;
nr
_cb
*
nr
=
nr_sk
(
sk
)
;
add_timer
(
&
nr
->
t2timer
);
mod_timer
(
&
nr
->
t2timer
,
jiffies
+
nr
->
t2
);
}
}
void
nr_start_t4timer
(
struct
sock
*
sk
)
void
nr_start_t4timer
(
struct
sock
*
sk
)
{
{
nr_cb
*
nr
=
nr_sk
(
sk
);
nr_cb
*
nr
=
nr_sk
(
sk
);
del_timer
(
&
nr
->
t4timer
);
mod_timer
(
&
nr
->
t4timer
,
jiffies
+
nr
->
t4
);
nr
->
t4timer
.
data
=
(
unsigned
long
)
sk
;
nr
->
t4timer
.
function
=
&
nr_t4timer_expiry
;
nr
->
t4timer
.
expires
=
jiffies
+
nr
->
t4
;
add_timer
(
&
nr
->
t4timer
);
}
}
void
nr_start_idletimer
(
struct
sock
*
sk
)
void
nr_start_idletimer
(
struct
sock
*
sk
)
{
{
nr_cb
*
nr
=
nr_sk
(
sk
);
nr_cb
*
nr
=
nr_sk
(
sk
);
del_timer
(
&
nr
->
idletimer
);
if
(
nr
->
idle
>
0
)
mod_timer
(
&
nr
->
idletimer
,
jiffies
+
nr
->
idle
);
if
(
nr
->
idle
>
0
)
{
nr
->
idletimer
.
data
=
(
unsigned
long
)
sk
;
nr
->
idletimer
.
function
=
&
nr_idletimer_expiry
;
nr
->
idletimer
.
expires
=
jiffies
+
nr
->
idle
;
add_timer
(
&
nr
->
idletimer
);
}
}
}
void
nr_start_heartbeat
(
struct
sock
*
sk
)
void
nr_start_heartbeat
(
struct
sock
*
sk
)
{
{
del_timer
(
&
sk
->
sk_timer
);
mod_timer
(
&
sk
->
sk_timer
,
jiffies
+
5
*
HZ
);
sk
->
sk_timer
.
data
=
(
unsigned
long
)
sk
;
sk
->
sk_timer
.
function
=
&
nr_heartbeat_expiry
;
sk
->
sk_timer
.
expires
=
jiffies
+
5
*
HZ
;
add_timer
(
&
sk
->
sk_timer
);
}
}
void
nr_stop_t1timer
(
struct
sock
*
sk
)
void
nr_stop_t1timer
(
struct
sock
*
sk
)
...
...
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