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
3335c2ba
Commit
3335c2ba
authored
Jul 25, 2003
by
Alexey Kuznetsov
Committed by
David S. Miller
Jul 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Make IFLA_STATS arch independent.
parent
458ad9d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
3 deletions
+62
-3
include/linux/rtnetlink.h
include/linux/rtnetlink.h
+50
-0
net/core/rtnetlink.c
net/core/rtnetlink.c
+12
-3
No files found.
include/linux/rtnetlink.h
View file @
3335c2ba
...
...
@@ -459,6 +459,40 @@ struct ifinfomsg
unsigned
ifi_change
;
/* IFF_* change mask */
};
/* The struct should be in sync with struct net_device_stats */
struct
rtnl_link_stats
{
__u32
rx_packets
;
/* total packets received */
__u32
tx_packets
;
/* total packets transmitted */
__u32
rx_bytes
;
/* total bytes received */
__u32
tx_bytes
;
/* total bytes transmitted */
__u32
rx_errors
;
/* bad packets received */
__u32
tx_errors
;
/* packet transmit problems */
__u32
rx_dropped
;
/* no space in linux buffers */
__u32
tx_dropped
;
/* no space available in linux */
__u32
multicast
;
/* multicast packets received */
__u32
collisions
;
/* detailed rx_errors: */
__u32
rx_length_errors
;
__u32
rx_over_errors
;
/* receiver ring buff overflow */
__u32
rx_crc_errors
;
/* recved pkt with crc error */
__u32
rx_frame_errors
;
/* recv'd frame alignment error */
__u32
rx_fifo_errors
;
/* recv'r fifo overrun */
__u32
rx_missed_errors
;
/* receiver missed packet */
/* detailed tx_errors */
__u32
tx_aborted_errors
;
__u32
tx_carrier_errors
;
__u32
tx_fifo_errors
;
__u32
tx_heartbeat_errors
;
__u32
tx_window_errors
;
/* for cslip etc */
__u32
rx_compressed
;
__u32
tx_compressed
;
};
enum
{
IFLA_UNSPEC
,
...
...
@@ -600,6 +634,22 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
({ if (skb_tailroom(skb) < (int)RTA_SPACE(attrlen)) goto rtattr_failure; \
__rta_fill(skb, attrtype, attrlen, data); })
static
inline
struct
rtattr
*
__rta_reserve
(
struct
sk_buff
*
skb
,
int
attrtype
,
int
attrlen
)
{
struct
rtattr
*
rta
;
int
size
=
RTA_LENGTH
(
attrlen
);
rta
=
(
struct
rtattr
*
)
skb_put
(
skb
,
RTA_ALIGN
(
size
));
rta
->
rta_type
=
attrtype
;
rta
->
rta_len
=
size
;
return
rta
;
}
#define __RTA_PUT(skb, attrtype, attrlen) \
({ if (skb_tailroom(skb) < (int)RTA_SPACE(attrlen)) goto rtattr_failure; \
__rta_reserve(skb, attrtype, attrlen); })
extern
void
rtmsg_ifinfo
(
int
type
,
struct
net_device
*
dev
,
unsigned
change
);
extern
struct
semaphore
rtnl_sem
;
...
...
net/core/rtnetlink.c
View file @
3335c2ba
...
...
@@ -191,9 +191,18 @@ static int rtnetlink_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
if
(
dev
->
master
)
RTA_PUT
(
skb
,
IFLA_MASTER
,
sizeof
(
int
),
&
dev
->
master
->
ifindex
);
if
(
dev
->
get_stats
)
{
struct
net_device_stats
*
stats
=
dev
->
get_stats
(
dev
);
if
(
stats
)
RTA_PUT
(
skb
,
IFLA_STATS
,
sizeof
(
*
stats
),
stats
);
unsigned
long
*
stats
=
(
unsigned
long
*
)
dev
->
get_stats
(
dev
);
if
(
stats
)
{
struct
rtattr
*
a
;
__u32
*
s
;
int
i
;
int
n
=
sizeof
(
struct
rtnl_link_stats
)
/
4
;
a
=
__RTA_PUT
(
skb
,
IFLA_STATS
,
n
*
4
);
s
=
RTA_DATA
(
a
);
for
(
i
=
0
;
i
<
n
;
i
++
)
s
[
i
]
=
stats
[
i
];
}
}
nlh
->
nlmsg_len
=
skb
->
tail
-
b
;
return
skb
->
len
;
...
...
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