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
07684b51
Commit
07684b51
authored
May 06, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4]: Use time_{before,after}() and proper jiffies types in route.c
parent
4b05d7c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
net/ipv4/route.c
net/ipv4/route.c
+14
-12
No files found.
net/ipv4/route.c
View file @
07684b51
...
...
@@ -431,16 +431,17 @@ static __inline__ int rt_valuable(struct rtable *rth)
rth
->
u
.
dst
.
expires
;
}
static
int
rt_may_expire
(
struct
rtable
*
rth
,
int
tmo1
,
int
tmo2
)
static
int
rt_may_expire
(
struct
rtable
*
rth
,
unsigned
long
tmo1
,
unsigned
long
tmo2
)
{
int
age
;
unsigned
long
age
;
int
ret
=
0
;
if
(
atomic_read
(
&
rth
->
u
.
dst
.
__refcnt
))
goto
out
;
ret
=
1
;
if
(
rth
->
u
.
dst
.
expires
&&
(
long
)(
rth
->
u
.
dst
.
expires
-
jiffies
)
<=
0
)
if
(
rth
->
u
.
dst
.
expires
&&
time_after
(
jiffies
,
rth
->
u
.
dst
.
expires
))
goto
out
;
age
=
jiffies
-
rth
->
u
.
dst
.
lastuse
;
...
...
@@ -462,7 +463,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy)
for
(
t
=
ip_rt_gc_interval
<<
rt_hash_log
;
t
>=
0
;
t
-=
ip_rt_gc_timeout
)
{
unsigned
tmo
=
ip_rt_gc_timeout
;
unsigned
long
tmo
=
ip_rt_gc_timeout
;
i
=
(
i
+
1
)
&
rt_hash_mask
;
rthp
=
&
rt_hash_table
[
i
].
chain
;
...
...
@@ -471,7 +472,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy)
while
((
rth
=
*
rthp
)
!=
NULL
)
{
if
(
rth
->
u
.
dst
.
expires
)
{
/* Entry is expired even if it is in use */
if
(
(
long
)(
now
-
rth
->
u
.
dst
.
expires
)
<=
0
)
{
if
(
time_after
(
now
,
rth
->
u
.
dst
.
expires
)
)
{
tmo
>>=
1
;
rthp
=
&
rth
->
u
.
rt_next
;
continue
;
...
...
@@ -489,7 +490,7 @@ static void SMP_TIMER_NAME(rt_check_expire)(unsigned long dummy)
spin_unlock
(
&
rt_hash_table
[
i
].
lock
);
/* Fallback loop breaker. */
if
(
(
jiffies
-
now
)
>
0
)
if
(
time_after
(
jiffies
,
now
)
)
break
;
}
rover
=
i
;
...
...
@@ -591,7 +592,7 @@ static void rt_secret_rebuild(unsigned long dummy)
static
int
rt_garbage_collect
(
void
)
{
static
unsigned
expire
=
RT_GC_TIMEOUT
;
static
unsigned
long
expire
=
RT_GC_TIMEOUT
;
static
unsigned
long
last_gc
;
static
int
rover
;
static
int
equilibrium
;
...
...
@@ -643,7 +644,7 @@ static int rt_garbage_collect(void)
int
i
,
k
;
for
(
i
=
rt_hash_mask
,
k
=
rover
;
i
>=
0
;
i
--
)
{
unsigned
tmo
=
expire
;
unsigned
long
tmo
=
expire
;
k
=
(
k
+
1
)
&
rt_hash_mask
;
rthp
=
&
rt_hash_table
[
k
].
chain
;
...
...
@@ -689,7 +690,7 @@ static int rt_garbage_collect(void)
if
(
atomic_read
(
&
ipv4_dst_ops
.
entries
)
<
ip_rt_max_size
)
goto
out
;
}
while
(
!
in_softirq
()
&&
jiffies
-
now
<
1
);
}
while
(
!
in_softirq
()
&&
time_before_eq
(
jiffies
,
now
)
);
if
(
atomic_read
(
&
ipv4_dst_ops
.
entries
)
<
ip_rt_max_size
)
goto
out
;
...
...
@@ -1067,7 +1068,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
/* No redirected packets during ip_rt_redirect_silence;
* reset the algorithm.
*/
if
(
jiffies
-
rt
->
u
.
dst
.
rate_last
>
ip_rt_redirect_silence
)
if
(
time_after
(
jiffies
,
rt
->
u
.
dst
.
rate_last
+
ip_rt_redirect_silence
)
)
rt
->
u
.
dst
.
rate_tokens
=
0
;
/* Too many ignored redirects; do not send anything
...
...
@@ -1081,8 +1082,9 @@ void ip_rt_send_redirect(struct sk_buff *skb)
/* Check for load limit; set rate_last to the latest sent
* redirect.
*/
if
(
jiffies
-
rt
->
u
.
dst
.
rate_last
>
(
ip_rt_redirect_load
<<
rt
->
u
.
dst
.
rate_tokens
))
{
if
(
time_after
(
jiffies
,
(
rt
->
u
.
dst
.
rate_last
+
(
ip_rt_redirect_load
<<
rt
->
u
.
dst
.
rate_tokens
))))
{
icmp_send
(
skb
,
ICMP_REDIRECT
,
ICMP_REDIR_HOST
,
rt
->
rt_gateway
);
rt
->
u
.
dst
.
rate_last
=
jiffies
;
++
rt
->
u
.
dst
.
rate_tokens
;
...
...
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