Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / drivers / net / bonding / bond_alb.c
index ba71582..2df9276 100644 (file)
@@ -163,8 +163,6 @@ static int tlb_initialize(struct bonding *bond)
        struct tlb_client_info *new_hashtbl;
        int i;
 
-       spin_lock_init(&(bond_info->tx_hashtbl_lock));
-
        new_hashtbl = kzalloc(size, GFP_KERNEL);
        if (!new_hashtbl) {
                pr_err("%s: Error: Failed to allocate TLB hash table\n",
@@ -308,49 +306,33 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
        _unlock_rx_hashtbl(bond);
 }
 
-static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct packet_type *ptype, struct net_device *orig_dev)
+static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond,
+                        struct slave *slave)
 {
-       struct bonding *bond;
-       struct arp_pkt *arp = (struct arp_pkt *)skb->data;
-       int res = NET_RX_DROP;
-
-       while (bond_dev->priv_flags & IFF_802_1Q_VLAN)
-               bond_dev = vlan_dev_real_dev(bond_dev);
+       struct arp_pkt *arp;
 
-       if (!(bond_dev->priv_flags & IFF_BONDING) ||
-           !(bond_dev->flags & IFF_MASTER))
-               goto out;
+       if (skb->protocol != cpu_to_be16(ETH_P_ARP))
+               return;
 
+       arp = (struct arp_pkt *) skb->data;
        if (!arp) {
                pr_debug("Packet has no ARP data\n");
-               goto out;
+               return;
        }
 
-       skb = skb_share_check(skb, GFP_ATOMIC);
-       if (!skb)
-               goto out;
-
-       if (!pskb_may_pull(skb, arp_hdr_len(bond_dev)))
-               goto out;
+       if (!pskb_may_pull(skb, arp_hdr_len(bond->dev)))
+               return;
 
        if (skb->len < sizeof(struct arp_pkt)) {
                pr_debug("Packet is too small to be an ARP\n");
-               goto out;
+               return;
        }
 
        if (arp->op_code == htons(ARPOP_REPLY)) {
                /* update rx hash table for this ARP */
-               bond = netdev_priv(bond_dev);
                rlb_update_entry_from_arp(bond, arp);
                pr_debug("Server received an ARP Reply from client\n");
        }
-
-       res = NET_RX_SUCCESS;
-
-out:
-       dev_kfree_skb(skb);
-
-       return res;
 }
 
 /* Caller must hold bond lock for read */
@@ -759,13 +741,10 @@ static void rlb_init_table_entry(struct rlb_client_info *entry)
 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));
-
        new_hashtbl = kmalloc(size, GFP_KERNEL);
        if (!new_hashtbl) {
                pr_err("%s: Error: Failed to allocate RLB hash table\n",
@@ -784,13 +763,8 @@ static int rlb_initialize(struct bonding *bond)
 
        _unlock_rx_hashtbl(bond);
 
-       /*initialize packet type*/
-       pk_type->type = cpu_to_be16(ETH_P_ARP);
-       pk_type->dev = bond->dev;
-       pk_type->func = rlb_arp_recv;
-
        /* register to receive ARPs */
-       dev_add_pack(pk_type);
+       bond->recv_probe = rlb_arp_recv;
 
        return 0;
 }
@@ -799,8 +773,6 @@ static void rlb_deinitialize(struct bonding *bond)
 {
        struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
 
-       dev_remove_pack(&(bond_info->rlb_pkt_type));
-
        _lock_rx_hashtbl(bond);
 
        kfree(bond_info->rx_hashtbl);
@@ -1249,16 +1221,10 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
        skb_reset_mac_header(skb);
        eth_data = eth_hdr(skb);
 
-       /* make sure that the curr_active_slave and the slaves list do
-        * not change during tx
+       /* make sure that the curr_active_slave do not change during tx
         */
-       read_lock(&bond->lock);
        read_lock(&bond->curr_slave_lock);
 
-       if (!BOND_IS_OK(bond)) {
-               goto out;
-       }
-
        switch (ntohs(skb->protocol)) {
        case ETH_P_IP: {
                const struct iphdr *iph = ip_hdr(skb);
@@ -1358,13 +1324,12 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
                }
        }
 
-out:
        if (res) {
                /* no suitable interface, frame not sent */
                dev_kfree_skb(skb);
        }
        read_unlock(&bond->curr_slave_lock);
-       read_unlock(&bond->lock);
+
        return NETDEV_TX_OK;
 }