Comments
Patch
@@ -49,6 +49,13 @@ struct ipv4_devconf {
DECLARE_BITMAP(state, IPV4_DEVCONF_MAX);
};
+struct ipv4_devstat {
+ struct proc_dir_entry *proc_dir_entry;
+ DEFINE_SNMP_STAT(struct ipstats_mib, ip);
+ DEFINE_SNMP_STAT_ATOMIC(struct icmp_mib_dev, icmpdev);
+ DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib_dev, icmpmsgdev);
+};
+
struct in_device {
struct net_device *dev;
atomic_t refcnt;
@@ -69,6 +76,7 @@ struct in_device {
struct neigh_parms *arp_parms;
struct ipv4_devconf cnf;
+ struct ipv4_devstat stats;
struct rcu_head rcu_head;
};
@@ -209,6 +217,14 @@ static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
return rcu_dereference(dev->ip_ptr);
}
+static inline struct in_device *__in_dev_get_rcu_safely(const struct net_device *dev)
+{
+ if (likely(dev))
+ return rcu_dereference(dev->ip_ptr);
+ else
+ return NULL;
+}
+
static inline struct in_device *in_dev_get(const struct net_device *dev)
{
struct in_device *in_dev;