diff options
author | Patrick McHardy <kaber@trash.net> | 2010-06-15 11:31:06 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-06-15 11:31:06 -0400 |
commit | f9181f4ffc71d7b7dd1906c9a11d51d6659220ae (patch) | |
tree | 194f22e8216a1b9ee2c0dd019142202d73a7dc87 /include/linux/netdevice.h | |
parent | 0902b469bd25065aa0688c3cee6f11744c817e7c (diff) | |
parent | 1ab6c163dee279559e3a62d774af7e4c4c9b4c67 (diff) |
Merge branch 'master' of /repos/git/net-next-2.6
Conflicts:
include/net/netfilter/xt_rateest.h
net/bridge/br_netfilter.c
net/netfilter/nf_conntrack_core.c
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 108 |
1 files changed, 64 insertions, 44 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a24916156f4e..4fbccc5f609a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -159,45 +159,49 @@ static inline bool dev_xmit_complete(int rc) | |||
159 | #define MAX_HEADER (LL_MAX_HEADER + 48) | 159 | #define MAX_HEADER (LL_MAX_HEADER + 48) |
160 | #endif | 160 | #endif |
161 | 161 | ||
162 | #endif /* __KERNEL__ */ | ||
163 | |||
164 | /* | 162 | /* |
165 | * Network device statistics. Akin to the 2.0 ether stats but | 163 | * Old network device statistics. Fields are native words |
166 | * with byte counters. | 164 | * (unsigned long) so they can be read and written atomically. |
165 | * Each field is padded to 64 bits for compatibility with | ||
166 | * rtnl_link_stats64. | ||
167 | */ | 167 | */ |
168 | 168 | ||
169 | #if BITS_PER_LONG == 64 | ||
170 | #define NET_DEVICE_STATS_DEFINE(name) unsigned long name | ||
171 | #elif defined(__LITTLE_ENDIAN) | ||
172 | #define NET_DEVICE_STATS_DEFINE(name) unsigned long name, pad_ ## name | ||
173 | #else | ||
174 | #define NET_DEVICE_STATS_DEFINE(name) unsigned long pad_ ## name, name | ||
175 | #endif | ||
176 | |||
169 | struct net_device_stats { | 177 | struct net_device_stats { |
170 | unsigned long rx_packets; /* total packets received */ | 178 | NET_DEVICE_STATS_DEFINE(rx_packets); |
171 | unsigned long tx_packets; /* total packets transmitted */ | 179 | NET_DEVICE_STATS_DEFINE(tx_packets); |
172 | unsigned long rx_bytes; /* total bytes received */ | 180 | NET_DEVICE_STATS_DEFINE(rx_bytes); |
173 | unsigned long tx_bytes; /* total bytes transmitted */ | 181 | NET_DEVICE_STATS_DEFINE(tx_bytes); |
174 | unsigned long rx_errors; /* bad packets received */ | 182 | NET_DEVICE_STATS_DEFINE(rx_errors); |
175 | unsigned long tx_errors; /* packet transmit problems */ | 183 | NET_DEVICE_STATS_DEFINE(tx_errors); |
176 | unsigned long rx_dropped; /* no space in linux buffers */ | 184 | NET_DEVICE_STATS_DEFINE(rx_dropped); |
177 | unsigned long tx_dropped; /* no space available in linux */ | 185 | NET_DEVICE_STATS_DEFINE(tx_dropped); |
178 | unsigned long multicast; /* multicast packets received */ | 186 | NET_DEVICE_STATS_DEFINE(multicast); |
179 | unsigned long collisions; | 187 | NET_DEVICE_STATS_DEFINE(collisions); |
180 | 188 | NET_DEVICE_STATS_DEFINE(rx_length_errors); | |
181 | /* detailed rx_errors: */ | 189 | NET_DEVICE_STATS_DEFINE(rx_over_errors); |
182 | unsigned long rx_length_errors; | 190 | NET_DEVICE_STATS_DEFINE(rx_crc_errors); |
183 | unsigned long rx_over_errors; /* receiver ring buff overflow */ | 191 | NET_DEVICE_STATS_DEFINE(rx_frame_errors); |
184 | unsigned long rx_crc_errors; /* recved pkt with crc error */ | 192 | NET_DEVICE_STATS_DEFINE(rx_fifo_errors); |
185 | unsigned long rx_frame_errors; /* recv'd frame alignment error */ | 193 | NET_DEVICE_STATS_DEFINE(rx_missed_errors); |
186 | unsigned long rx_fifo_errors; /* recv'r fifo overrun */ | 194 | NET_DEVICE_STATS_DEFINE(tx_aborted_errors); |
187 | unsigned long rx_missed_errors; /* receiver missed packet */ | 195 | NET_DEVICE_STATS_DEFINE(tx_carrier_errors); |
188 | 196 | NET_DEVICE_STATS_DEFINE(tx_fifo_errors); | |
189 | /* detailed tx_errors */ | 197 | NET_DEVICE_STATS_DEFINE(tx_heartbeat_errors); |
190 | unsigned long tx_aborted_errors; | 198 | NET_DEVICE_STATS_DEFINE(tx_window_errors); |
191 | unsigned long tx_carrier_errors; | 199 | NET_DEVICE_STATS_DEFINE(rx_compressed); |
192 | unsigned long tx_fifo_errors; | 200 | NET_DEVICE_STATS_DEFINE(tx_compressed); |
193 | unsigned long tx_heartbeat_errors; | ||
194 | unsigned long tx_window_errors; | ||
195 | |||
196 | /* for cslip etc */ | ||
197 | unsigned long rx_compressed; | ||
198 | unsigned long tx_compressed; | ||
199 | }; | 201 | }; |
200 | 202 | ||
203 | #endif /* __KERNEL__ */ | ||
204 | |||
201 | 205 | ||
202 | /* Media selection options. */ | 206 | /* Media selection options. */ |
203 | enum { | 207 | enum { |
@@ -381,6 +385,8 @@ enum gro_result { | |||
381 | }; | 385 | }; |
382 | typedef enum gro_result gro_result_t; | 386 | typedef enum gro_result gro_result_t; |
383 | 387 | ||
388 | typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb); | ||
389 | |||
384 | extern void __napi_schedule(struct napi_struct *n); | 390 | extern void __napi_schedule(struct napi_struct *n); |
385 | 391 | ||
386 | static inline int napi_disable_pending(struct napi_struct *n) | 392 | static inline int napi_disable_pending(struct napi_struct *n) |
@@ -660,10 +666,19 @@ struct netdev_rx_queue { | |||
660 | * Callback uses when the transmitter has not made any progress | 666 | * Callback uses when the transmitter has not made any progress |
661 | * for dev->watchdog ticks. | 667 | * for dev->watchdog ticks. |
662 | * | 668 | * |
669 | * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev); | ||
663 | * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 670 | * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
664 | * Called when a user wants to get the network device usage | 671 | * Called when a user wants to get the network device usage |
665 | * statistics. If not defined, the counters in dev->stats will | 672 | * statistics. Drivers must do one of the following: |
666 | * be used. | 673 | * 1. Define @ndo_get_stats64 to update a rtnl_link_stats64 structure |
674 | * (which should normally be dev->stats64) and return a ponter to | ||
675 | * it. The structure must not be changed asynchronously. | ||
676 | * 2. Define @ndo_get_stats to update a net_device_stats64 structure | ||
677 | * (which should normally be dev->stats) and return a pointer to | ||
678 | * it. The structure may be changed asynchronously only if each | ||
679 | * field is written atomically. | ||
680 | * 3. Update dev->stats asynchronously and atomically, and define | ||
681 | * neither operation. | ||
667 | * | 682 | * |
668 | * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp); | 683 | * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp); |
669 | * If device support VLAN receive accleration | 684 | * If device support VLAN receive accleration |
@@ -718,6 +733,7 @@ struct net_device_ops { | |||
718 | struct neigh_parms *); | 733 | struct neigh_parms *); |
719 | void (*ndo_tx_timeout) (struct net_device *dev); | 734 | void (*ndo_tx_timeout) (struct net_device *dev); |
720 | 735 | ||
736 | struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev); | ||
721 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 737 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
722 | 738 | ||
723 | void (*ndo_vlan_rx_register)(struct net_device *dev, | 739 | void (*ndo_vlan_rx_register)(struct net_device *dev, |
@@ -867,7 +883,10 @@ struct net_device { | |||
867 | int ifindex; | 883 | int ifindex; |
868 | int iflink; | 884 | int iflink; |
869 | 885 | ||
870 | struct net_device_stats stats; | 886 | union { |
887 | struct rtnl_link_stats64 stats64; | ||
888 | struct net_device_stats stats; | ||
889 | }; | ||
871 | 890 | ||
872 | #ifdef CONFIG_WIRELESS_EXT | 891 | #ifdef CONFIG_WIRELESS_EXT |
873 | /* List of functions to handle Wireless Extensions (instead of ioctl). | 892 | /* List of functions to handle Wireless Extensions (instead of ioctl). |
@@ -957,6 +976,7 @@ struct net_device { | |||
957 | #endif | 976 | #endif |
958 | 977 | ||
959 | struct netdev_queue rx_queue; | 978 | struct netdev_queue rx_queue; |
979 | rx_handler_func_t *rx_handler; | ||
960 | 980 | ||
961 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; | 981 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; |
962 | 982 | ||
@@ -1087,11 +1107,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, | |||
1087 | static inline | 1107 | static inline |
1088 | struct net *dev_net(const struct net_device *dev) | 1108 | struct net *dev_net(const struct net_device *dev) |
1089 | { | 1109 | { |
1090 | #ifdef CONFIG_NET_NS | 1110 | return read_pnet(&dev->nd_net); |
1091 | return dev->nd_net; | ||
1092 | #else | ||
1093 | return &init_net; | ||
1094 | #endif | ||
1095 | } | 1111 | } |
1096 | 1112 | ||
1097 | static inline | 1113 | static inline |
@@ -1272,8 +1288,8 @@ extern void dev_add_pack(struct packet_type *pt); | |||
1272 | extern void dev_remove_pack(struct packet_type *pt); | 1288 | extern void dev_remove_pack(struct packet_type *pt); |
1273 | extern void __dev_remove_pack(struct packet_type *pt); | 1289 | extern void __dev_remove_pack(struct packet_type *pt); |
1274 | 1290 | ||
1275 | extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, | 1291 | extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, |
1276 | unsigned short mask); | 1292 | unsigned short mask); |
1277 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); | 1293 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); |
1278 | extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); | 1294 | extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); |
1279 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); | 1295 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); |
@@ -1693,6 +1709,10 @@ static inline void napi_free_frags(struct napi_struct *napi) | |||
1693 | napi->skb = NULL; | 1709 | napi->skb = NULL; |
1694 | } | 1710 | } |
1695 | 1711 | ||
1712 | extern int netdev_rx_handler_register(struct net_device *dev, | ||
1713 | rx_handler_func_t *rx_handler); | ||
1714 | extern void netdev_rx_handler_unregister(struct net_device *dev); | ||
1715 | |||
1696 | extern void netif_nit_deliver(struct sk_buff *skb); | 1716 | extern void netif_nit_deliver(struct sk_buff *skb); |
1697 | extern int dev_valid_name(const char *name); | 1717 | extern int dev_valid_name(const char *name); |
1698 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 1718 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
@@ -2118,7 +2138,7 @@ extern void netdev_features_change(struct net_device *dev); | |||
2118 | /* Load a device via the kmod */ | 2138 | /* Load a device via the kmod */ |
2119 | extern void dev_load(struct net *net, const char *name); | 2139 | extern void dev_load(struct net *net, const char *name); |
2120 | extern void dev_mcast_init(void); | 2140 | extern void dev_mcast_init(void); |
2121 | extern const struct net_device_stats *dev_get_stats(struct net_device *dev); | 2141 | extern const struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev); |
2122 | extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); | 2142 | extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); |
2123 | 2143 | ||
2124 | extern int netdev_max_backlog; | 2144 | extern int netdev_max_backlog; |