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)
...
@@ -1796,45 +1796,49 @@ static int dev_seq_show(struct seq_file *seq, void *v)
return
0
;
return
0
;
}
}
static
int
dev_proc_stats
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
static
struct
netif_rx_stats
*
softnet_get_online
(
loff_t
*
pos
)
int
length
,
int
*
eof
,
void
*
data
)
{
{
int
i
;
struct
netif_rx_stats
*
rc
=
NULL
;
int
len
=
0
;
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
{
while
(
*
pos
<
NR_CPUS
)
if
(
!
cpu_online
(
i
))
if
(
cpu_online
(
*
pos
))
{
continue
;
rc
=
&
netdev_rx_stat
[
*
pos
];
break
;
len
+=
sprintf
(
buffer
+
len
,
"%08x %08x %08x %08x %08x %08x "
}
else
"%08x %08x %08x
\n
"
,
++*
pos
;
netdev_rx_stat
[
i
].
total
,
return
rc
;
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
);
}
len
-=
offset
;
static
void
*
softnet_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
return
softnet_get_online
(
pos
);
}
if
(
len
>
length
)
static
void
*
softnet_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
len
=
length
;
{
if
(
len
<
0
)
++*
pos
;
len
=
0
;
return
softnet_get_online
(
pos
);
}
*
start
=
buffer
+
offset
;
static
void
softnet_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
*
eof
=
1
;
{
}
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
=
{
static
struct
seq_operations
dev_seq_ops
=
{
...
@@ -1856,12 +1860,29 @@ static struct file_operations dev_seq_fops = {
...
@@ -1856,12 +1860,29 @@ static struct file_operations dev_seq_fops = {
.
release
=
seq_release
,
.
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
#ifdef WIRELESS_EXT
extern
int
wireless_proc_init
(
void
);
extern
int
wireless_proc_init
(
void
);
extern
int
wireless_proc_exit
(
void
);
#else
#else
#define wireless_proc_init() 0
#define wireless_proc_init() 0
#define wireless_proc_exit()
#endif
#endif
static
int
__init
dev_proc_init
(
void
)
static
int
__init
dev_proc_init
(
void
)
...
@@ -1873,12 +1894,17 @@ static int __init dev_proc_init(void)
...
@@ -1873,12 +1894,17 @@ static int __init dev_proc_init(void)
if
(
!
p
)
if
(
!
p
)
goto
out
;
goto
out
;
p
->
proc_fops
=
&
dev_seq_fops
;
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
;
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
;
rc
=
0
;
out:
out:
return
rc
;
return
rc
;
out_softnet:
remove_proc_entry
(
"softnet_stat"
,
proc_net
);
out_dev:
out_dev:
remove_proc_entry
(
"dev"
,
proc_net
);
remove_proc_entry
(
"dev"
,
proc_net
);
goto
out
;
goto
out
;
...
...
net/core/wireless.c
View file @
b9997c07
...
@@ -406,11 +406,6 @@ int __init wireless_proc_init(void)
...
@@ -406,11 +406,6 @@ int __init wireless_proc_init(void)
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
return
rc
;
return
rc
;
}
}
void
__init
wireless_proc_exit
(
void
)
{
remove_proc_entry
(
"wireless"
,
proc_net
);
}
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
/************************** IOCTL SUPPORT **************************/
/************************** 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