]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/bonding/bond_main.c
net: rename notifier defines for netdev type change
[net-next-2.6.git] / drivers / net / bonding / bond_main.c
index efa0e41bf3ec2e141dbf36f72187db8aa41975b9..7eeb18751d67592eef914e92bbff7f35b2819f65 100644 (file)
@@ -1480,14 +1480,16 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
                                 bond_dev->name,
                                 bond_dev->type, slave_dev->type);
 
-                       netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE);
+                       netdev_bonding_change(bond_dev,
+                                             NETDEV_PRE_TYPE_CHANGE);
 
                        if (slave_dev->type != ARPHRD_ETHER)
                                bond_setup_by_slave(bond_dev, slave_dev);
                        else
                                ether_setup(bond_dev);
 
-                       netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE);
+                       netdev_bonding_change(bond_dev,
+                                             NETDEV_POST_TYPE_CHANGE);
                }
        } else if (bond_dev->type != slave_dev->type) {
                pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it.\n",
@@ -2615,6 +2617,17 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
        unsigned char *arp_ptr;
        __be32 sip, tip;
 
+       if (dev->priv_flags & IFF_802_1Q_VLAN) {
+               /*
+                * When using VLANS and bonding, dev and oriv_dev may be
+                * incorrect if the physical interface supports VLAN
+                * acceleration.  With this change ARP validation now
+                * works for hosts only reachable on the VLAN interface.
+                */
+               dev = vlan_dev_real_dev(dev);
+               orig_dev = dev_get_by_index_rcu(dev_net(skb->dev),skb->skb_iif);
+       }
+
        if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
                goto out;
 
@@ -3296,7 +3309,7 @@ static void bond_remove_proc_entry(struct bonding *bond)
 /* Create the bonding directory under /proc/net, if doesn't exist yet.
  * Caller must hold rtnl_lock.
  */
-static void bond_create_proc_dir(struct bond_net *bn)
+static void __net_init bond_create_proc_dir(struct bond_net *bn)
 {
        if (!bn->proc_dir) {
                bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net);
@@ -3309,7 +3322,7 @@ static void bond_create_proc_dir(struct bond_net *bn)
 /* Destroy the bonding directory under /proc/net, if empty.
  * Caller must hold rtnl_lock.
  */
-static void bond_destroy_proc_dir(struct bond_net *bn)
+static void __net_exit bond_destroy_proc_dir(struct bond_net *bn)
 {
        if (bn->proc_dir) {
                remove_proc_entry(DRV_NAME, bn->net->proc_net);
@@ -3327,11 +3340,11 @@ static void bond_remove_proc_entry(struct bonding *bond)
 {
 }
 
-static void bond_create_proc_dir(struct bond_net *bn)
+static inline void bond_create_proc_dir(struct bond_net *bn)
 {
 }
 
-static void bond_destroy_proc_dir(struct bond_net *bn)
+static inline void bond_destroy_proc_dir(struct bond_net *bn)
 {
 }
 
@@ -3731,7 +3744,7 @@ static int bond_close(struct net_device *bond_dev)
 static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
 {
        struct bonding *bond = netdev_priv(bond_dev);
-       struct net_device_stats *stats = &bond->stats;
+       struct net_device_stats *stats = &bond_dev->stats;
        struct net_device_stats local_stats;
        struct slave *slave;
        int i;
@@ -4935,6 +4948,8 @@ int bond_create(struct net *net, const char *name)
        }
 
        res = register_netdevice(bond_dev);
+       if (res < 0)
+               goto out_netdev;
 
 out:
        rtnl_unlock();
@@ -4944,7 +4959,7 @@ out_netdev:
        goto out;
 }
 
-static int bond_net_init(struct net *net)
+static int __net_init bond_net_init(struct net *net)
 {
        struct bond_net *bn = net_generic(net, bond_net_id);
 
@@ -4956,7 +4971,7 @@ static int bond_net_init(struct net *net)
        return 0;
 }
 
-static void bond_net_exit(struct net *net)
+static void __net_exit bond_net_exit(struct net *net)
 {
        struct bond_net *bn = net_generic(net, bond_net_id);