drm: remove address mask param for drm_pci_alloc()
[safe/jmp/linux-2.6] / include / linux / inetdevice.h
index 1ef174d..ad27c7d 100644 (file)
@@ -3,19 +3,20 @@
 
 #ifdef __KERNEL__
 
+#include <linux/bitmap.h>
 #include <linux/if.h>
 #include <linux/netdevice.h>
 #include <linux/rcupdate.h>
 #include <linux/timer.h>
+#include <linux/sysctl.h>
 
 struct ipv4_devconf
 {
        void    *sysctl;
        int     data[__NET_IPV4_CONF_MAX - 1];
+       DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1);
 };
 
-extern struct ipv4_devconf ipv4_devconf;
-
 struct in_device
 {
        struct net_device       *dev;
@@ -24,6 +25,7 @@ struct in_device
        struct in_ifaddr        *ifa_list;      /* IP ifaddr chain              */
        rwlock_t                mc_list_lock;
        struct ip_mc_list       *mc_list;       /* IP multicast filter chain    */
+       int                     mc_count;                 /* Number of installed mcasts */
        spinlock_t              mc_tomb_lock;
        struct ip_mc_list       *mc_tomb;
        unsigned long           mr_v1_seen;
@@ -41,7 +43,8 @@ struct in_device
 };
 
 #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1])
-#define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr)
+#define IPV4_DEVCONF_ALL(net, attr) \
+       IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr)
 
 static inline int ipv4_devconf_get(struct in_device *in_dev, int index)
 {
@@ -53,26 +56,33 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index,
                                    int val)
 {
        index--;
+       set_bit(index, in_dev->cnf.state);
        in_dev->cnf.data[index] = val;
 }
 
+static inline void ipv4_devconf_setall(struct in_device *in_dev)
+{
+       bitmap_fill(in_dev->cnf.state, __NET_IPV4_CONF_MAX - 1);
+}
+
 #define IN_DEV_CONF_GET(in_dev, attr) \
        ipv4_devconf_get((in_dev), NET_IPV4_CONF_ ## attr)
 #define IN_DEV_CONF_SET(in_dev, attr, val) \
        ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
 
 #define IN_DEV_ANDCONF(in_dev, attr) \
-       (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr))
+       (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
+        IN_DEV_CONF_GET((in_dev), attr))
 #define IN_DEV_ORCONF(in_dev, attr) \
-       (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr))
+       (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \
+        IN_DEV_CONF_GET((in_dev), attr))
 #define IN_DEV_MAXCONF(in_dev, attr) \
-       (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr)))
+       (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
+            IN_DEV_CONF_GET((in_dev), attr)))
 
 #define IN_DEV_FORWARD(in_dev)         IN_DEV_CONF_GET((in_dev), FORWARDING)
-#define IN_DEV_MFORWARD(in_dev)                (IPV4_DEVCONF_ALL(MC_FORWARDING) && \
-                                        IPV4_DEVCONF((in_dev)->cnf, \
-                                                     MC_FORWARDING))
-#define IN_DEV_RPFILTER(in_dev)                IN_DEV_ANDCONF((in_dev), RP_FILTER)
+#define IN_DEV_MFORWARD(in_dev)                IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
+#define IN_DEV_RPFILTER(in_dev)                IN_DEV_MAXCONF((in_dev), RP_FILTER)
 #define IN_DEV_SOURCE_ROUTE(in_dev)    IN_DEV_ANDCONF((in_dev), \
                                                       ACCEPT_SOURCE_ROUTE)
 #define IN_DEV_BOOTP_RELAY(in_dev)     IN_DEV_ANDCONF((in_dev), BOOTP_RELAY)
@@ -98,6 +108,7 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index,
 #define IN_DEV_ARPFILTER(in_dev)       IN_DEV_ORCONF((in_dev), ARPFILTER)
 #define IN_DEV_ARP_ANNOUNCE(in_dev)    IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
 #define IN_DEV_ARP_IGNORE(in_dev)      IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
+#define IN_DEV_ARP_NOTIFY(in_dev)      IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
 
 struct in_ifaddr
 {
@@ -108,7 +119,6 @@ struct in_ifaddr
        __be32                  ifa_address;
        __be32                  ifa_mask;
        __be32                  ifa_broadcast;
-       __be32                  ifa_anycast;
        unsigned char           ifa_scope;
        unsigned char           ifa_flags;
        unsigned char           ifa_prefixlen;
@@ -118,16 +128,14 @@ struct in_ifaddr
 extern int register_inetaddr_notifier(struct notifier_block *nb);
 extern int unregister_inetaddr_notifier(struct notifier_block *nb);
 
-extern struct net_device       *ip_dev_find(__be32 addr);
+extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
 extern int             inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
-extern int             devinet_ioctl(unsigned int cmd, void __user *);
+extern int             devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
 extern void            devinet_init(void);
-extern struct in_device *inetdev_init(struct net_device *dev);
-extern struct in_device        *inetdev_by_index(int);
+extern struct in_device        *inetdev_by_index(struct net *, int);
 extern __be32          inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
-extern __be32          inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
+extern __be32          inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope);
 extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
-extern void            inet_forward_change(void);
 
 static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
 {