]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/bonding/bond_main.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / drivers / net / bonding / bond_main.c
index e4724d874e7c5cb5ee90acd72b6ebca2000bcbc3..cb9cb3013f4250d7fbf302b4495fa069abd47efa 100644 (file)
@@ -187,7 +187,7 @@ static void bond_send_gratuitous_arp(struct bonding *bond);
 
 /*---------------------------- General routines -----------------------------*/
 
-const char *bond_mode_name(int mode)
+static const char *bond_mode_name(int mode)
 {
        switch (mode) {
        case BOND_MODE_ROUNDROBIN :
@@ -1224,7 +1224,8 @@ static void bond_detach_slave(struct bonding *bond, struct slave *slave)
 
 /*---------------------------------- IOCTL ----------------------------------*/
 
-int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev)
+static int bond_sethwaddr(struct net_device *bond_dev,
+                         struct net_device *slave_dev)
 {
        dprintk("bond_dev=%p\n", bond_dev);
        dprintk("slave_dev=%p\n", slave_dev);
@@ -1360,13 +1361,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
                goto err_undo_flags;
        }
 
-       if (slave_dev->get_stats == NULL) {
-               printk(KERN_NOTICE DRV_NAME
-                       ": %s: the driver for slave device %s does not provide "
-                       "get_stats function, network statistics will be "
-                       "inaccurate.\n", bond_dev->name, slave_dev->name);
-       }
-
        new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
        if (!new_slave) {
                res = -ENOMEM;
@@ -1397,6 +1391,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
                goto err_free;
        }
 
+       res = netdev_set_master(slave_dev, bond_dev);
+       if (res) {
+               dprintk("Error %d calling netdev_set_master\n", res);
+               goto err_close;
+       }
        /* open the slave since the application closed it */
        res = dev_open(slave_dev);
        if (res) {
@@ -1404,12 +1403,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
                goto err_restore_mac;
        }
 
-       res = netdev_set_master(slave_dev, bond_dev);
-       if (res) {
-               dprintk("Error %d calling netdev_set_master\n", res);
-               goto err_close;
-       }
-
        new_slave->dev = slave_dev;
        slave_dev->priv_flags |= IFF_BONDING;
 
@@ -2524,7 +2517,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
                                 (2 * sizeof(u32)))))
                goto out_unlock;
 
-       arp = skb->nh.arph;
+       arp = arp_hdr(skb);
        if (arp->ar_hln != dev->addr_len ||
            skb->pkt_type == PACKET_OTHERHOST ||
            skb->pkt_type == PACKET_LOOPBACK ||
@@ -3468,7 +3461,7 @@ void bond_unregister_arp(struct bonding *bond)
 /*---------------------------- Hashing Policies -----------------------------*/
 
 /*
- * Hash for the the output device based upon layer 3 and layer 4 data. If
+ * Hash for the output device based upon layer 3 and layer 4 data. If
  * the packet is a frag or not TCP or UDP, just use layer 3 data.  If it is
  * altogether not IP, mimic bond_xmit_hash_policy_l2()
  */
@@ -3476,7 +3469,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
                                    struct net_device *bond_dev, int count)
 {
        struct ethhdr *data = (struct ethhdr *)skb->data;
-       struct iphdr *iph = skb->nh.iph;
+       struct iphdr *iph = ip_hdr(skb);
        u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl);
        int layer4_xor = 0;
 
@@ -3640,35 +3633,32 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
        read_lock_bh(&bond->lock);
 
        bond_for_each_slave(bond, slave, i) {
-               if (slave->dev->get_stats) {
-                       sstats = slave->dev->get_stats(slave->dev);
-
-                       stats->rx_packets += sstats->rx_packets;
-                       stats->rx_bytes += sstats->rx_bytes;
-                       stats->rx_errors += sstats->rx_errors;
-                       stats->rx_dropped += sstats->rx_dropped;
-
-                       stats->tx_packets += sstats->tx_packets;
-                       stats->tx_bytes += sstats->tx_bytes;
-                       stats->tx_errors += sstats->tx_errors;
-                       stats->tx_dropped += sstats->tx_dropped;
-
-                       stats->multicast += sstats->multicast;
-                       stats->collisions += sstats->collisions;
-
-                       stats->rx_length_errors += sstats->rx_length_errors;
-                       stats->rx_over_errors += sstats->rx_over_errors;
-                       stats->rx_crc_errors += sstats->rx_crc_errors;
-                       stats->rx_frame_errors += sstats->rx_frame_errors;
-                       stats->rx_fifo_errors += sstats->rx_fifo_errors;
-                       stats->rx_missed_errors += sstats->rx_missed_errors;
-
-                       stats->tx_aborted_errors += sstats->tx_aborted_errors;
-                       stats->tx_carrier_errors += sstats->tx_carrier_errors;
-                       stats->tx_fifo_errors += sstats->tx_fifo_errors;
-                       stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors;
-                       stats->tx_window_errors += sstats->tx_window_errors;
-               }
+               sstats = slave->dev->get_stats(slave->dev);
+               stats->rx_packets += sstats->rx_packets;
+               stats->rx_bytes += sstats->rx_bytes;
+               stats->rx_errors += sstats->rx_errors;
+               stats->rx_dropped += sstats->rx_dropped;
+
+               stats->tx_packets += sstats->tx_packets;
+               stats->tx_bytes += sstats->tx_bytes;
+               stats->tx_errors += sstats->tx_errors;
+               stats->tx_dropped += sstats->tx_dropped;
+
+               stats->multicast += sstats->multicast;
+               stats->collisions += sstats->collisions;
+
+               stats->rx_length_errors += sstats->rx_length_errors;
+               stats->rx_over_errors += sstats->rx_over_errors;
+               stats->rx_crc_errors += sstats->rx_crc_errors;
+               stats->rx_frame_errors += sstats->rx_frame_errors;
+               stats->rx_fifo_errors += sstats->rx_fifo_errors;
+               stats->rx_missed_errors += sstats->rx_missed_errors;
+
+               stats->tx_aborted_errors += sstats->tx_aborted_errors;
+               stats->tx_carrier_errors += sstats->tx_carrier_errors;
+               stats->tx_fifo_errors += sstats->tx_fifo_errors;
+               stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors;
+               stats->tx_window_errors += sstats->tx_window_errors;
        }
 
        read_unlock_bh(&bond->lock);
@@ -4355,8 +4345,8 @@ static void bond_free_all(void)
                bond_mc_list_destroy(bond);
                /* Release the bonded slaves */
                bond_release_all(bond_dev);
-               unregister_netdevice(bond_dev);
                bond_deinit(bond_dev);
+               unregister_netdevice(bond_dev);
        }
 
 #ifdef CONFIG_PROC_FS