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
b9997c07
Commit
b9997c07
authored
Nov 24, 2002
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o net/core/dev.c: convert /proc/net/softnet_stat to seq_file
parent
1f01cc36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
42 deletions
+63
-42
net/core/dev.c
net/core/dev.c
+63
-37
net/core/wireless.c
net/core/wireless.c
+0
-5
No files found.
net/core/dev.c
View file @
b9997c07
...
...
@@ -1796,45 +1796,49 @@ static int dev_seq_show(struct seq_file *seq, void *v)
return
0
;
}
static
int
dev_proc_stats
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
int
*
eof
,
void
*
data
)
static
struct
netif_rx_stats
*
softnet_get_online
(
loff_t
*
pos
)
{
int
i
;
int
len
=
0
;
struct
netif_rx_stats
*
rc
=
NULL
;
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
{
if
(
!
cpu_online
(
i
))
continue
;
len
+=
sprintf
(
buffer
+
len
,
"%08x %08x %08x %08x %08x %08x "
"%08x %08x %08x
\n
"
,
netdev_rx_stat
[
i
].
total
,
netdev_rx_stat
[
i
].
dropped
,
netdev_rx_stat
[
i
].
time_squeeze
,
netdev_rx_stat
[
i
].
throttled
,
netdev_rx_stat
[
i
].
fastroute_hit
,
netdev_rx_stat
[
i
].
fastroute_success
,
netdev_rx_stat
[
i
].
fastroute_defer
,
netdev_rx_stat
[
i
].
fastroute_deferred_out
,
#if 0
netdev_rx_stat[i].fastroute_latency_reduction
#else
netdev_rx_stat
[
i
].
cpu_collision
#endif
);
}
while
(
*
pos
<
NR_CPUS
)
if
(
cpu_online
(
*
pos
))
{
rc
=
&
netdev_rx_stat
[
*
pos
];
break
;
}
else
++*
pos
;
return
rc
;
}
len
-=
offset
;
static
void
*
softnet_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
return
softnet_get_online
(
pos
);
}
if
(
len
>
length
)
len
=
length
;
if
(
len
<
0
)
len
=
0
;
static
void
*
softnet_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
++*
pos
;
return
softnet_get_online
(
pos
);
}
*
start
=
buffer
+
offset
;
*
eof
=
1
;
static
void
softnet_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
{
}
static
int
softnet_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
struct
netif_rx_stats
*
s
=
v
;
return
len
;
seq_printf
(
seq
,
"%08x %08x %08x %08x %08x %08x %08x %08x %08x
\n
"
,
s
->
total
,
s
->
dropped
,
s
->
time_squeeze
,
s
->
throttled
,
s
->
fastroute_hit
,
s
->
fastroute_success
,
s
->
fastroute_defer
,
s
->
fastroute_deferred_out
,
#if 0
s->fastroute_latency_reduction
#else
s
->
cpu_collision
#endif
);
return
0
;
}
static
struct
seq_operations
dev_seq_ops
=
{
...
...
@@ -1856,12 +1860,29 @@ static struct file_operations dev_seq_fops = {
.
release
=
seq_release
,
};
static
struct
seq_operations
softnet_seq_ops
=
{
.
start
=
softnet_seq_start
,
.
next
=
softnet_seq_next
,
.
stop
=
softnet_seq_stop
,
.
show
=
softnet_seq_show
,
};
static
int
softnet_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
softnet_seq_ops
);
}
static
struct
file_operations
softnet_seq_fops
=
{
.
open
=
softnet_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
#ifdef WIRELESS_EXT
extern
int
wireless_proc_init
(
void
);
extern
int
wireless_proc_exit
(
void
);
#else
#define wireless_proc_init() 0
#define wireless_proc_exit()
#endif
static
int
__init
dev_proc_init
(
void
)
...
...
@@ -1873,12 +1894,17 @@ static int __init dev_proc_init(void)
if
(
!
p
)
goto
out
;
p
->
proc_fops
=
&
dev_seq_fops
;
if
(
wireless_proc_init
())
p
=
create_proc_entry
(
"softnet_stat"
,
S_IRUGO
,
proc_net
);
if
(
!
p
)
goto
out_dev
;
create_proc_read_entry
(
"net/softnet_stat"
,
0
,
0
,
dev_proc_stats
,
NULL
);
p
->
proc_fops
=
&
softnet_seq_fops
;
if
(
wireless_proc_init
())
goto
out_softnet
;
rc
=
0
;
out:
return
rc
;
out_softnet:
remove_proc_entry
(
"softnet_stat"
,
proc_net
);
out_dev:
remove_proc_entry
(
"dev"
,
proc_net
);
goto
out
;
...
...
net/core/wireless.c
View file @
b9997c07
...
...
@@ -406,11 +406,6 @@ int __init wireless_proc_init(void)
rc
=
-
ENOMEM
;
return
rc
;
}
void
__init
wireless_proc_exit
(
void
)
{
remove_proc_entry
(
"wireless"
,
proc_net
);
}
#endif
/* CONFIG_PROC_FS */
/************************** IOCTL SUPPORT **************************/
...
...
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