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
6d089f76
Commit
6d089f76
authored
Jun 12, 2002
by
Rusty Russell
Committed by
David S. Miller
Jun 12, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipv4/route.c: Cleanup ip_rt_acct_read
parent
02262b73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
27 deletions
+15
-27
net/ipv4/route.c
net/ipv4/route.c
+15
-27
No files found.
net/ipv4/route.c
View file @
6d089f76
...
...
@@ -2418,10 +2418,15 @@ ctl_table ipv4_route_table[] = {
#ifdef CONFIG_NET_CLS_ROUTE
struct
ip_rt_acct
*
ip_rt_acct
;
/* This code sucks. But you should have seen it before! --RR */
/* IP route accounting ptr for this logical cpu number. */
#define IP_RT_ACCT_CPU(i) (ip_rt_acct + cpu_logical_map(i) * 256)
static
int
ip_rt_acct_read
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
int
*
eof
,
void
*
data
)
{
*
start
=
buffer
;
unsigned
int
i
;
if
((
offset
&
3
)
||
(
length
&
3
))
return
-
EIO
;
...
...
@@ -2430,35 +2435,18 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset,
length
=
sizeof
(
struct
ip_rt_acct
)
*
256
-
offset
;
*
eof
=
1
;
}
if
(
length
>
0
)
{
u32
*
dst
=
(
u32
*
)
buffer
;
u32
*
src
=
(
u32
*
)(((
u8
*
)
ip_rt_acct
)
+
offset
);
memcpy
(
dst
,
src
,
length
);
#ifdef CONFIG_SMP
if
(
smp_num_cpus
>
1
||
cpu_logical_map
(
0
)
!=
0
)
{
int
i
;
int
cnt
=
length
/
4
;
for
(
i
=
0
;
i
<
smp_num_cpus
;
i
++
)
{
int
cpu
=
cpu_logical_map
(
i
);
int
k
;
if
(
cpu
==
0
)
continue
;
src
=
(
u32
*
)(((
u8
*
)
ip_rt_acct
)
+
offset
+
cpu
*
256
*
sizeof
(
struct
ip_rt_acct
));
/* Copy first cpu. */
*
start
=
buffer
;
memcpy
(
buffer
,
IP_RT_ACCT_CPU
(
0
),
length
);
for
(
k
=
0
;
k
<
cnt
;
k
++
)
dst
[
k
]
+=
src
[
k
];
}
}
#endif
return
length
;
/* Add the other cpus in, one int at a time */
for
(
i
=
1
;
i
<
smp_num_cpus
;
i
++
)
{
unsigned
int
j
;
for
(
j
=
0
;
j
<
length
/
4
;
j
++
)
((
u32
*
)
buffer
)[
j
]
+=
((
u32
*
)
IP_RT_ACCT_CPU
(
i
))[
j
];
}
return
0
;
return
length
;
}
#endif
...
...
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