diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:31:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:31:56 -0500 |
commit | d779188d2baf436e67fe8816fca2ef53d246900f (patch) | |
tree | 9bac75842a5611172860feec3c4019ff874a2b89 /drivers/net/bonding/bond_alb.c | |
parent | f61ea1b0c825a20a1826bb43a226387091934586 (diff) | |
parent | ac67c6247361b3b8644b34e5301a46d5069c1373 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
Diffstat (limited to 'drivers/net/bonding/bond_alb.c')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 75 |
1 files changed, 32 insertions, 43 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index f8fce3961197..854ddfb90da1 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -18,25 +18,6 @@ | |||
18 | * The full GNU General Public License is included in this distribution in the | 18 | * The full GNU General Public License is included in this distribution in the |
19 | * file called LICENSE. | 19 | * file called LICENSE. |
20 | * | 20 | * |
21 | * | ||
22 | * Changes: | ||
23 | * | ||
24 | * 2003/06/25 - Shmulik Hen <shmulik.hen at intel dot com> | ||
25 | * - Fixed signed/unsigned calculation errors that caused load sharing | ||
26 | * to collapse to one slave under very heavy UDP Tx stress. | ||
27 | * | ||
28 | * 2003/08/06 - Amir Noam <amir.noam at intel dot com> | ||
29 | * - Add support for setting bond's MAC address with special | ||
30 | * handling required for ALB/TLB. | ||
31 | * | ||
32 | * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com> | ||
33 | * - Code cleanup and style changes | ||
34 | * | ||
35 | * 2003/12/30 - Amir Noam <amir.noam at intel dot com> | ||
36 | * - Fixed: Cannot remove and re-enslave the original active slave. | ||
37 | * | ||
38 | * 2004/01/14 - Shmulik Hen <shmulik.hen at intel dot com> | ||
39 | * - Add capability to tag self generated packets in ALB/TLB modes. | ||
40 | */ | 21 | */ |
41 | 22 | ||
42 | //#define BONDING_DEBUG 1 | 23 | //#define BONDING_DEBUG 1 |
@@ -198,20 +179,21 @@ static int tlb_initialize(struct bonding *bond) | |||
198 | { | 179 | { |
199 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 180 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
200 | int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); | 181 | int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); |
182 | struct tlb_client_info *new_hashtbl; | ||
201 | int i; | 183 | int i; |
202 | 184 | ||
203 | spin_lock_init(&(bond_info->tx_hashtbl_lock)); | 185 | spin_lock_init(&(bond_info->tx_hashtbl_lock)); |
204 | 186 | ||
205 | _lock_tx_hashtbl(bond); | 187 | new_hashtbl = kmalloc(size, GFP_KERNEL); |
206 | 188 | if (!new_hashtbl) { | |
207 | bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL); | ||
208 | if (!bond_info->tx_hashtbl) { | ||
209 | printk(KERN_ERR DRV_NAME | 189 | printk(KERN_ERR DRV_NAME |
210 | ": Error: %s: Failed to allocate TLB hash table\n", | 190 | ": %s: Error: Failed to allocate TLB hash table\n", |
211 | bond->dev->name); | 191 | bond->dev->name); |
212 | _unlock_tx_hashtbl(bond); | ||
213 | return -1; | 192 | return -1; |
214 | } | 193 | } |
194 | _lock_tx_hashtbl(bond); | ||
195 | |||
196 | bond_info->tx_hashtbl = new_hashtbl; | ||
215 | 197 | ||
216 | memset(bond_info->tx_hashtbl, 0, size); | 198 | memset(bond_info->tx_hashtbl, 0, size); |
217 | 199 | ||
@@ -513,7 +495,8 @@ static void rlb_update_client(struct rlb_client_info *client_info) | |||
513 | client_info->mac_dst); | 495 | client_info->mac_dst); |
514 | if (!skb) { | 496 | if (!skb) { |
515 | printk(KERN_ERR DRV_NAME | 497 | printk(KERN_ERR DRV_NAME |
516 | ": Error: failed to create an ARP packet\n"); | 498 | ": %s: Error: failed to create an ARP packet\n", |
499 | client_info->slave->dev->master->name); | ||
517 | continue; | 500 | continue; |
518 | } | 501 | } |
519 | 502 | ||
@@ -523,7 +506,8 @@ static void rlb_update_client(struct rlb_client_info *client_info) | |||
523 | skb = vlan_put_tag(skb, client_info->vlan_id); | 506 | skb = vlan_put_tag(skb, client_info->vlan_id); |
524 | if (!skb) { | 507 | if (!skb) { |
525 | printk(KERN_ERR DRV_NAME | 508 | printk(KERN_ERR DRV_NAME |
526 | ": Error: failed to insert VLAN tag\n"); | 509 | ": %s: Error: failed to insert VLAN tag\n", |
510 | client_info->slave->dev->master->name); | ||
527 | continue; | 511 | continue; |
528 | } | 512 | } |
529 | } | 513 | } |
@@ -606,8 +590,9 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip) | |||
606 | 590 | ||
607 | if (!client_info->slave) { | 591 | if (!client_info->slave) { |
608 | printk(KERN_ERR DRV_NAME | 592 | printk(KERN_ERR DRV_NAME |
609 | ": Error: found a client with no channel in " | 593 | ": %s: Error: found a client with no channel in " |
610 | "the client's hash table\n"); | 594 | "the client's hash table\n", |
595 | bond->dev->name); | ||
611 | continue; | 596 | continue; |
612 | } | 597 | } |
613 | /*update all clients using this src_ip, that are not assigned | 598 | /*update all clients using this src_ip, that are not assigned |
@@ -797,21 +782,22 @@ static int rlb_initialize(struct bonding *bond) | |||
797 | { | 782 | { |
798 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 783 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
799 | struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type); | 784 | struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type); |
785 | struct rlb_client_info *new_hashtbl; | ||
800 | int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); | 786 | int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); |
801 | int i; | 787 | int i; |
802 | 788 | ||
803 | spin_lock_init(&(bond_info->rx_hashtbl_lock)); | 789 | spin_lock_init(&(bond_info->rx_hashtbl_lock)); |
804 | 790 | ||
805 | _lock_rx_hashtbl(bond); | 791 | new_hashtbl = kmalloc(size, GFP_KERNEL); |
806 | 792 | if (!new_hashtbl) { | |
807 | bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL); | ||
808 | if (!bond_info->rx_hashtbl) { | ||
809 | printk(KERN_ERR DRV_NAME | 793 | printk(KERN_ERR DRV_NAME |
810 | ": Error: %s: Failed to allocate RLB hash table\n", | 794 | ": %s: Error: Failed to allocate RLB hash table\n", |
811 | bond->dev->name); | 795 | bond->dev->name); |
812 | _unlock_rx_hashtbl(bond); | ||
813 | return -1; | 796 | return -1; |
814 | } | 797 | } |
798 | _lock_rx_hashtbl(bond); | ||
799 | |||
800 | bond_info->rx_hashtbl = new_hashtbl; | ||
815 | 801 | ||
816 | bond_info->rx_hashtbl_head = RLB_NULL_INDEX; | 802 | bond_info->rx_hashtbl_head = RLB_NULL_INDEX; |
817 | 803 | ||
@@ -927,7 +913,8 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]) | |||
927 | skb = vlan_put_tag(skb, vlan->vlan_id); | 913 | skb = vlan_put_tag(skb, vlan->vlan_id); |
928 | if (!skb) { | 914 | if (!skb) { |
929 | printk(KERN_ERR DRV_NAME | 915 | printk(KERN_ERR DRV_NAME |
930 | ": Error: failed to insert VLAN tag\n"); | 916 | ": %s: Error: failed to insert VLAN tag\n", |
917 | bond->dev->name); | ||
931 | continue; | 918 | continue; |
932 | } | 919 | } |
933 | } | 920 | } |
@@ -956,11 +943,11 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw) | |||
956 | s_addr.sa_family = dev->type; | 943 | s_addr.sa_family = dev->type; |
957 | if (dev_set_mac_address(dev, &s_addr)) { | 944 | if (dev_set_mac_address(dev, &s_addr)) { |
958 | printk(KERN_ERR DRV_NAME | 945 | printk(KERN_ERR DRV_NAME |
959 | ": Error: dev_set_mac_address of dev %s failed! ALB " | 946 | ": %s: Error: dev_set_mac_address of dev %s failed! ALB " |
960 | "mode requires that the base driver support setting " | 947 | "mode requires that the base driver support setting " |
961 | "the hw address also when the network device's " | 948 | "the hw address also when the network device's " |
962 | "interface is open\n", | 949 | "interface is open\n", |
963 | dev->name); | 950 | dev->master->name, dev->name); |
964 | return -EOPNOTSUPP; | 951 | return -EOPNOTSUPP; |
965 | } | 952 | } |
966 | return 0; | 953 | return 0; |
@@ -1153,16 +1140,16 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav | |||
1153 | bond->alb_info.rlb_enabled); | 1140 | bond->alb_info.rlb_enabled); |
1154 | 1141 | ||
1155 | printk(KERN_WARNING DRV_NAME | 1142 | printk(KERN_WARNING DRV_NAME |
1156 | ": Warning: the hw address of slave %s is in use by " | 1143 | ": %s: Warning: the hw address of slave %s is in use by " |
1157 | "the bond; giving it the hw address of %s\n", | 1144 | "the bond; giving it the hw address of %s\n", |
1158 | slave->dev->name, free_mac_slave->dev->name); | 1145 | bond->dev->name, slave->dev->name, free_mac_slave->dev->name); |
1159 | 1146 | ||
1160 | } else if (has_bond_addr) { | 1147 | } else if (has_bond_addr) { |
1161 | printk(KERN_ERR DRV_NAME | 1148 | printk(KERN_ERR DRV_NAME |
1162 | ": Error: the hw address of slave %s is in use by the " | 1149 | ": %s: Error: the hw address of slave %s is in use by the " |
1163 | "bond; couldn't find a slave with a free hw address to " | 1150 | "bond; couldn't find a slave with a free hw address to " |
1164 | "give it (this should not have happened)\n", | 1151 | "give it (this should not have happened)\n", |
1165 | slave->dev->name); | 1152 | bond->dev->name, slave->dev->name); |
1166 | return -EFAULT; | 1153 | return -EFAULT; |
1167 | } | 1154 | } |
1168 | 1155 | ||
@@ -1250,6 +1237,8 @@ int bond_alb_initialize(struct bonding *bond, int rlb_enabled) | |||
1250 | tlb_deinitialize(bond); | 1237 | tlb_deinitialize(bond); |
1251 | return res; | 1238 | return res; |
1252 | } | 1239 | } |
1240 | } else { | ||
1241 | bond->alb_info.rlb_enabled = 0; | ||
1253 | } | 1242 | } |
1254 | 1243 | ||
1255 | return 0; | 1244 | return 0; |
@@ -1409,7 +1398,7 @@ void bond_alb_monitor(struct bonding *bond) | |||
1409 | read_lock(&bond->curr_slave_lock); | 1398 | read_lock(&bond->curr_slave_lock); |
1410 | 1399 | ||
1411 | bond_for_each_slave(bond, slave, i) { | 1400 | bond_for_each_slave(bond, slave, i) { |
1412 | alb_send_learning_packets(slave,slave->dev->dev_addr); | 1401 | alb_send_learning_packets(slave, slave->dev->dev_addr); |
1413 | } | 1402 | } |
1414 | 1403 | ||
1415 | read_unlock(&bond->curr_slave_lock); | 1404 | read_unlock(&bond->curr_slave_lock); |