net: convert multicast list to list_head
[safe/jmp/linux-2.6] / drivers / net / bonding / bonding.h
index fb730ec..2aa3367 100644 (file)
 #include <linux/proc_fs.h>
 #include <linux/if_bonding.h>
 #include <linux/kobject.h>
+#include <linux/in6.h>
 #include "bond_3ad.h"
 #include "bond_alb.h"
 
-#define DRV_VERSION    "3.3.0"
-#define DRV_RELDATE    "June 10, 2008"
+#define DRV_VERSION    "3.6.0"
+#define DRV_RELDATE    "September 26, 2009"
 #define DRV_NAME       "bonding"
 #define DRV_DESCRIPTION        "Ethernet Channel Bonding Driver"
 
 #define BOND_MAX_ARP_TARGETS   16
 
-#ifdef BONDING_DEBUG
-#define dprintk(fmt, args...) \
-       printk(KERN_DEBUG     \
-              DRV_NAME ": %s() %d: " fmt, __FUNCTION__, __LINE__ , ## args )
-#else
-#define dprintk(fmt, args...)
-#endif /* BONDING_DEBUG */
-
 #define IS_UP(dev)                                        \
              ((((dev)->flags & IFF_UP) == IFF_UP)      && \
               netif_running(dev)                       && \
@@ -126,6 +119,7 @@ struct bond_params {
        int xmit_policy;
        int miimon;
        int num_grat_arp;
+       int num_unsol_na;
        int arp_interval;
        int arp_validate;
        int use_carrier;
@@ -133,7 +127,9 @@ struct bond_params {
        int updelay;
        int downdelay;
        int lacp_fast;
+       int ad_select;
        char primary[IFNAMSIZ];
+       int primary_reselect;
        __be32 arp_targets[BOND_MAX_ARP_TARGETS];
 };
 
@@ -148,6 +144,9 @@ struct vlan_entry {
        struct list_head vlan_list;
        __be32 vlan_ip;
        unsigned short vlan_id;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+       struct in6_addr vlan_ipv6;
+#endif
 };
 
 struct slave {
@@ -163,9 +162,9 @@ struct slave {
        u32    original_flags;
        u32    original_mtu;
        u32    link_failure_count;
+       u8     perm_hwaddr[ETH_ALEN];
        u16    speed;
        u8     duplex;
-       u8     perm_hwaddr[ETH_ALEN];
        struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
        struct tlb_slave_info tlb_info;
 };
@@ -190,20 +189,21 @@ struct bonding {
        struct   slave *curr_active_slave;
        struct   slave *current_arp_slave;
        struct   slave *primary_slave;
+       bool     force_primary;
        s32      slave_cnt; /* never change this value outside the attach/detach wrappers */
        rwlock_t lock;
        rwlock_t curr_slave_lock;
        s8       kill_timers;
        s8       send_grat_arp;
+       s8       send_unsol_na;
        s8       setup_by_slave;
-       struct   net_device_stats stats;
 #ifdef CONFIG_PROC_FS
        struct   proc_dir_entry *proc_entry;
        char     proc_file_name[IFNAMSIZ];
 #endif /* CONFIG_PROC_FS */
        struct   list_head bond_list;
-       struct   dev_mc_list *mc_list;
-       int      (*xmit_hash_policy)(struct sk_buff *, struct net_device *, int);
+       struct   netdev_hw_addr_list mc_list;
+       int      (*xmit_hash_policy)(struct sk_buff *, int);
        __be32   master_ip;
        u16      flags;
        u16      rr_tx_counter;
@@ -218,6 +218,9 @@ struct bonding {
        struct   delayed_work arp_work;
        struct   delayed_work alb_work;
        struct   delayed_work ad_work;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+       struct   in6_addr master_ipv6;
+#endif
 };
 
 /**
@@ -245,9 +248,19 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
                return NULL;
        }
 
-       return (struct bonding *)slave->dev->master->priv;
+       return (struct bonding *)netdev_priv(slave->dev->master);
+}
+
+static inline bool bond_is_lb(const struct bonding *bond)
+{
+       return (bond->params.mode == BOND_MODE_TLB ||
+               bond->params.mode == BOND_MODE_ALB);
 }
 
+#define BOND_PRI_RESELECT_ALWAYS       0
+#define BOND_PRI_RESELECT_BETTER       1
+#define BOND_PRI_RESELECT_FAILURE      2
+
 #define BOND_FOM_NONE                  0
 #define BOND_FOM_ACTIVE                        1
 #define BOND_FOM_FOLLOW                        2
@@ -275,9 +288,8 @@ static inline unsigned long slave_last_rx(struct bonding *bond,
 
 static inline void bond_set_slave_inactive_flags(struct slave *slave)
 {
-       struct bonding *bond = slave->dev->master->priv;
-       if (bond->params.mode != BOND_MODE_TLB &&
-           bond->params.mode != BOND_MODE_ALB)
+       struct bonding *bond = netdev_priv(slave->dev->master);
+       if (!bond_is_lb(bond))
                slave->state = BOND_STATE_BACKUP;
        slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
        if (slave_do_arp_validate(bond, slave))
@@ -312,13 +324,11 @@ static inline void bond_unset_master_alb_flags(struct bonding *bond)
 
 struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr);
 int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
-int bond_create(char *name, struct bond_params *params);
-void bond_destroy(struct bonding *bond);
+int bond_create(struct net *net, const char *name);
 int  bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev);
 int bond_create_sysfs(void);
 void bond_destroy_sysfs(void);
-void bond_destroy_sysfs_entry(struct bonding *bond);
-int bond_create_sysfs_entry(struct bonding *bond);
+void bond_prepare_sysfs_group(struct bonding *bond);
 int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave);
 void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave);
 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
@@ -327,11 +337,47 @@ void bond_mii_monitor(struct work_struct *);
 void bond_loadbalance_arp_mon(struct work_struct *);
 void bond_activebackup_arp_mon(struct work_struct *);
 void bond_set_mode_ops(struct bonding *bond, int mode);
-int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl);
+int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl);
 void bond_select_active_slave(struct bonding *bond);
 void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
 void bond_register_arp(struct bonding *);
 void bond_unregister_arp(struct bonding *);
 
-#endif /* _LINUX_BONDING_H */
+struct bond_net {
+       struct net *            net;    /* Associated network namespace */
+       struct list_head        dev_list;
+#ifdef CONFIG_PROC_FS
+       struct proc_dir_entry * proc_dir;
+#endif
+};
+
+/* exported from bond_main.c */
+extern int bond_net_id;
+extern const struct bond_parm_tbl bond_lacp_tbl[];
+extern const struct bond_parm_tbl bond_mode_tbl[];
+extern const struct bond_parm_tbl xmit_hashtype_tbl[];
+extern const struct bond_parm_tbl arp_validate_tbl[];
+extern const struct bond_parm_tbl fail_over_mac_tbl[];
+extern const struct bond_parm_tbl pri_reselect_tbl[];
+extern struct bond_parm_tbl ad_select_tbl[];
+
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+void bond_send_unsolicited_na(struct bonding *bond);
+void bond_register_ipv6_notifier(void);
+void bond_unregister_ipv6_notifier(void);
+#else
+static inline void bond_send_unsolicited_na(struct bonding *bond)
+{
+       return;
+}
+static inline void bond_register_ipv6_notifier(void)
+{
+       return;
+}
+static inline void bond_unregister_ipv6_notifier(void)
+{
+       return;
+}
+#endif
 
+#endif /* _LINUX_BONDING_H */