aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-12-17 15:27:22 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-17 15:27:22 -0500
commitb4aa9e05a61b845541fa6f5b1d246976922601f0 (patch)
treeca94478c3df281ab76a3399f5ba6341ade3f5791 /drivers/net/bonding/bond_main.c
parent1dc0f3c54ce1df957f99c17b145488fd03eb1a59 (diff)
parent4b8fe66300acb2fba8b16d62606e0d30204022fc (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/bnx2x/bnx2x.h drivers/net/wireless/iwlwifi/iwl-1000.c drivers/net/wireless/iwlwifi/iwl-6000.c drivers/net/wireless/iwlwifi/iwl-core.h drivers/vhost/vhost.c
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c59
1 files changed, 15 insertions, 44 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 07011e42cec..b1025b85acf 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -171,7 +171,7 @@ MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link
171/*----------------------------- Global variables ----------------------------*/ 171/*----------------------------- Global variables ----------------------------*/
172 172
173#ifdef CONFIG_NET_POLL_CONTROLLER 173#ifdef CONFIG_NET_POLL_CONTROLLER
174cpumask_var_t netpoll_block_tx; 174atomic_t netpoll_block_tx = ATOMIC_INIT(0);
175#endif 175#endif
176 176
177static const char * const version = 177static const char * const version =
@@ -418,36 +418,11 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr)
418 * @bond: bond device that got this skb for tx. 418 * @bond: bond device that got this skb for tx.
419 * @skb: hw accel VLAN tagged skb to transmit 419 * @skb: hw accel VLAN tagged skb to transmit
420 * @slave_dev: slave that is supposed to xmit this skbuff 420 * @slave_dev: slave that is supposed to xmit this skbuff
421 *
422 * When the bond gets an skb to transmit that is
423 * already hardware accelerated VLAN tagged, and it
424 * needs to relay this skb to a slave that is not
425 * hw accel capable, the skb needs to be "unaccelerated",
426 * i.e. strip the hwaccel tag and re-insert it as part
427 * of the payload.
428 */ 421 */
429int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, 422int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
430 struct net_device *slave_dev) 423 struct net_device *slave_dev)
431{ 424{
432 unsigned short uninitialized_var(vlan_id); 425 skb->dev = slave_dev;
433
434 /* Test vlan_list not vlgrp to catch and handle 802.1p tags */
435 if (!list_empty(&bond->vlan_list) &&
436 !(slave_dev->features & NETIF_F_HW_VLAN_TX) &&
437 vlan_get_tag(skb, &vlan_id) == 0) {
438 skb->dev = slave_dev;
439 skb = vlan_put_tag(skb, vlan_id);
440 if (!skb) {
441 /* vlan_put_tag() frees the skb in case of error,
442 * so return success here so the calling functions
443 * won't attempt to free is again.
444 */
445 return 0;
446 }
447 } else {
448 skb->dev = slave_dev;
449 }
450
451 skb->priority = 1; 426 skb->priority = 1;
452#ifdef CONFIG_NET_POLL_CONTROLLER 427#ifdef CONFIG_NET_POLL_CONTROLLER
453 if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) { 428 if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) {
@@ -1197,11 +1172,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1197 bond_do_fail_over_mac(bond, new_active, 1172 bond_do_fail_over_mac(bond, new_active,
1198 old_active); 1173 old_active);
1199 1174
1200 bond->send_grat_arp = bond->params.num_grat_arp; 1175 if (netif_running(bond->dev)) {
1201 bond_send_gratuitous_arp(bond); 1176 bond->send_grat_arp = bond->params.num_grat_arp;
1177 bond_send_gratuitous_arp(bond);
1202 1178
1203 bond->send_unsol_na = bond->params.num_unsol_na; 1179 bond->send_unsol_na = bond->params.num_unsol_na;
1204 bond_send_unsolicited_na(bond); 1180 bond_send_unsolicited_na(bond);
1181 }
1205 1182
1206 write_unlock_bh(&bond->curr_slave_lock); 1183 write_unlock_bh(&bond->curr_slave_lock);
1207 read_unlock(&bond->lock); 1184 read_unlock(&bond->lock);
@@ -1215,8 +1192,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1215 1192
1216 /* resend IGMP joins since active slave has changed or 1193 /* resend IGMP joins since active slave has changed or
1217 * all were sent on curr_active_slave */ 1194 * all were sent on curr_active_slave */
1218 if ((USES_PRIMARY(bond->params.mode) && new_active) || 1195 if (((USES_PRIMARY(bond->params.mode) && new_active) ||
1219 bond->params.mode == BOND_MODE_ROUNDROBIN) { 1196 bond->params.mode == BOND_MODE_ROUNDROBIN) &&
1197 netif_running(bond->dev)) {
1220 bond->igmp_retrans = bond->params.resend_igmp; 1198 bond->igmp_retrans = bond->params.resend_igmp;
1221 queue_delayed_work(bond->wq, &bond->mcast_work, 0); 1199 queue_delayed_work(bond->wq, &bond->mcast_work, 0);
1222 } 1200 }
@@ -5299,13 +5277,6 @@ static int __init bonding_init(void)
5299 if (res) 5277 if (res)
5300 goto out; 5278 goto out;
5301 5279
5302#ifdef CONFIG_NET_POLL_CONTROLLER
5303 if (!alloc_cpumask_var(&netpoll_block_tx, GFP_KERNEL)) {
5304 res = -ENOMEM;
5305 goto out;
5306 }
5307#endif
5308
5309 res = register_pernet_subsys(&bond_net_ops); 5280 res = register_pernet_subsys(&bond_net_ops);
5310 if (res) 5281 if (res)
5311 goto out; 5282 goto out;
@@ -5335,9 +5306,6 @@ err:
5335 rtnl_link_unregister(&bond_link_ops); 5306 rtnl_link_unregister(&bond_link_ops);
5336err_link: 5307err_link:
5337 unregister_pernet_subsys(&bond_net_ops); 5308 unregister_pernet_subsys(&bond_net_ops);
5338#ifdef CONFIG_NET_POLL_CONTROLLER
5339 free_cpumask_var(netpoll_block_tx);
5340#endif
5341 goto out; 5309 goto out;
5342 5310
5343} 5311}
@@ -5355,7 +5323,10 @@ static void __exit bonding_exit(void)
5355 unregister_pernet_subsys(&bond_net_ops); 5323 unregister_pernet_subsys(&bond_net_ops);
5356 5324
5357#ifdef CONFIG_NET_POLL_CONTROLLER 5325#ifdef CONFIG_NET_POLL_CONTROLLER
5358 free_cpumask_var(netpoll_block_tx); 5326 /*
5327 * Make sure we don't have an imbalance on our netpoll blocking
5328 */
5329 WARN_ON(atomic_read(&netpoll_block_tx));
5359#endif 5330#endif
5360} 5331}
5361 5332