aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/inetdevice.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/inetdevice.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/linux/inetdevice.h')
-rw-r--r--include/linux/inetdevice.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 2be1a1a2beb9..5f8146695b7f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -9,6 +9,7 @@
9#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
10#include <linux/timer.h> 10#include <linux/timer.h>
11#include <linux/sysctl.h> 11#include <linux/sysctl.h>
12#include <linux/rtnetlink.h>
12 13
13enum 14enum
14{ 15{
@@ -40,10 +41,12 @@ enum
40 __IPV4_DEVCONF_MAX 41 __IPV4_DEVCONF_MAX
41}; 42};
42 43
44#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1)
45
43struct ipv4_devconf { 46struct ipv4_devconf {
44 void *sysctl; 47 void *sysctl;
45 int data[__IPV4_DEVCONF_MAX - 1]; 48 int data[IPV4_DEVCONF_MAX];
46 DECLARE_BITMAP(state, __IPV4_DEVCONF_MAX - 1); 49 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX);
47}; 50};
48 51
49struct in_device { 52struct in_device {
@@ -51,9 +54,8 @@ struct in_device {
51 atomic_t refcnt; 54 atomic_t refcnt;
52 int dead; 55 int dead;
53 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 56 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
54 rwlock_t mc_list_lock; 57 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */
55 struct ip_mc_list *mc_list; /* IP multicast filter chain */ 58 int mc_count; /* Number of installed mcasts */
56 int mc_count; /* Number of installed mcasts */
57 spinlock_t mc_tomb_lock; 59 spinlock_t mc_tomb_lock;
58 struct ip_mc_list *mc_tomb; 60 struct ip_mc_list *mc_tomb;
59 unsigned long mr_v1_seen; 61 unsigned long mr_v1_seen;
@@ -90,7 +92,7 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index,
90 92
91static inline void ipv4_devconf_setall(struct in_device *in_dev) 93static inline void ipv4_devconf_setall(struct in_device *in_dev)
92{ 94{
93 bitmap_fill(in_dev->cnf.state, __IPV4_DEVCONF_MAX - 1); 95 bitmap_fill(in_dev->cnf.state, IPV4_DEVCONF_MAX);
94} 96}
95 97
96#define IN_DEV_CONF_GET(in_dev, attr) \ 98#define IN_DEV_CONF_GET(in_dev, attr) \
@@ -142,6 +144,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
142#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) 144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
143 145
144struct in_ifaddr { 146struct in_ifaddr {
147 struct hlist_node hash;
145 struct in_ifaddr *ifa_next; 148 struct in_ifaddr *ifa_next;
146 struct in_device *ifa_dev; 149 struct in_device *ifa_dev;
147 struct rcu_head rcu_head; 150 struct rcu_head rcu_head;
@@ -158,7 +161,12 @@ struct in_ifaddr {
158extern int register_inetaddr_notifier(struct notifier_block *nb); 161extern int register_inetaddr_notifier(struct notifier_block *nb);
159extern int unregister_inetaddr_notifier(struct notifier_block *nb); 162extern int unregister_inetaddr_notifier(struct notifier_block *nb);
160 163
161extern struct net_device *ip_dev_find(struct net *net, __be32 addr); 164extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
165static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
166{
167 return __ip_dev_find(net, addr, true);
168}
169
162extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 170extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
163extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *); 171extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
164extern void devinet_init(void); 172extern void devinet_init(void);
@@ -198,14 +206,10 @@ static __inline__ int bad_mask(__be32 mask, __be32 addr)
198 206
199static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) 207static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
200{ 208{
201 struct in_device *in_dev = dev->ip_ptr; 209 return rcu_dereference(dev->ip_ptr);
202 if (in_dev)
203 in_dev = rcu_dereference(in_dev);
204 return in_dev;
205} 210}
206 211
207static __inline__ struct in_device * 212static inline struct in_device *in_dev_get(const struct net_device *dev)
208in_dev_get(const struct net_device *dev)
209{ 213{
210 struct in_device *in_dev; 214 struct in_device *in_dev;
211 215
@@ -217,10 +221,9 @@ in_dev_get(const struct net_device *dev)
217 return in_dev; 221 return in_dev;
218} 222}
219 223
220static __inline__ struct in_device * 224static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev)
221__in_dev_get_rtnl(const struct net_device *dev)
222{ 225{
223 return (struct in_device*)dev->ip_ptr; 226 return rtnl_dereference(dev->ip_ptr);
224} 227}
225 228
226extern void in_dev_finish_destroy(struct in_device *idev); 229extern void in_dev_finish_destroy(struct in_device *idev);