Massive net driver const-ification.
[sfrench/cifs-2.6.git] / drivers / net / bonding / bond_alb.c
index 96dfb90c52529d01e6cf83a35aa7bb4e7bf85079..e83bc825f6afc4d5346cbb3d70f999e4b5d44e75 100644 (file)
  * The full GNU General Public License is included in this distribution in the
  * file called LICENSE.
  *
- *
- * Changes:
- *
- * 2003/06/25 - Shmulik Hen <shmulik.hen at intel dot com>
- *     - Fixed signed/unsigned calculation errors that caused load sharing
- *       to collapse to one slave under very heavy UDP Tx stress.
- *
- * 2003/08/06 - Amir Noam <amir.noam at intel dot com>
- *     - Add support for setting bond's MAC address with special
- *       handling required for ALB/TLB.
- *
- * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
- *     - Code cleanup and style changes
- *
- * 2003/12/30 - Amir Noam <amir.noam at intel dot com>
- *     - Fixed: Cannot remove and re-enslave the original active slave.
- *
- * 2004/01/14 - Shmulik Hen <shmulik.hen at intel dot com>
- *     - Add capability to tag self generated packets in ALB/TLB modes.
  */
 
 //#define BONDING_DEBUG 1
@@ -188,9 +169,9 @@ static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_
                index = next_index;
        }
 
-       _unlock_tx_hashtbl(bond);
-
        tlb_init_slave(slave);
+
+       _unlock_tx_hashtbl(bond);
 }
 
 /* Must be called before starting the monitor timer */
@@ -198,20 +179,21 @@ static int tlb_initialize(struct bonding *bond)
 {
        struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
        int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info);
+       struct tlb_client_info *new_hashtbl;
        int i;
 
        spin_lock_init(&(bond_info->tx_hashtbl_lock));
 
-       _lock_tx_hashtbl(bond);
-
-       bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL);
-       if (!bond_info->tx_hashtbl) {
+       new_hashtbl = kmalloc(size, GFP_KERNEL);
+       if (!new_hashtbl) {
                printk(KERN_ERR DRV_NAME
                       ": %s: Error: Failed to allocate TLB hash table\n",
                       bond->dev->name);
-               _unlock_tx_hashtbl(bond);
                return -1;
        }
+       _lock_tx_hashtbl(bond);
+
+       bond_info->tx_hashtbl = new_hashtbl;
 
        memset(bond_info->tx_hashtbl, 0, size);
 
@@ -800,21 +782,22 @@ static int rlb_initialize(struct bonding *bond)
 {
        struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
        struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type);
+       struct rlb_client_info  *new_hashtbl;
        int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info);
        int i;
 
        spin_lock_init(&(bond_info->rx_hashtbl_lock));
 
-       _lock_rx_hashtbl(bond);
-
-       bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL);
-       if (!bond_info->rx_hashtbl) {
+       new_hashtbl = kmalloc(size, GFP_KERNEL);
+       if (!new_hashtbl) {
                printk(KERN_ERR DRV_NAME
                       ": %s: Error: Failed to allocate RLB hash table\n",
                       bond->dev->name);
-               _unlock_rx_hashtbl(bond);
                return -1;
        }
+       _lock_rx_hashtbl(bond);
+
+       bond_info->rx_hashtbl = new_hashtbl;
 
        bond_info->rx_hashtbl_head = RLB_NULL_INDEX;
 
@@ -1254,6 +1237,8 @@ int bond_alb_initialize(struct bonding *bond, int rlb_enabled)
                        tlb_deinitialize(bond);
                        return res;
                }
+       } else {
+               bond->alb_info.rlb_enabled = 0;
        }
 
        return 0;
@@ -1276,7 +1261,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
        struct ethhdr *eth_data;
        struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
        struct slave *tx_slave = NULL;
-       static u32 ip_bcast = 0xffffffff;
+       static const u32 ip_bcast = 0xffffffff;
        int hash_size = 0;
        int do_tx_balance = 1;
        u32 hash_index = 0;
@@ -1413,7 +1398,7 @@ void bond_alb_monitor(struct bonding *bond)
                read_lock(&bond->curr_slave_lock);
 
                bond_for_each_slave(bond, slave, i) {
-                       alb_send_learning_packets(slave,slave->dev->dev_addr);
+                       alb_send_learning_packets(slave, slave->dev->dev_addr);
                }
 
                read_unlock(&bond->curr_slave_lock);