Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223224
b: refs/heads/master
c: fb4fa76
h: refs/heads/master
v: v3
  • Loading branch information
Neil Horman authored and David S. Miller committed Dec 10, 2010
1 parent 3473e67 commit bcc7677
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4e085e76cbe558b79b54cbab772f61185879bc64
refs/heads/master: fb4fa76a1fa59340154c42d998d700e1f8bf21e0
17 changes: 5 additions & 12 deletions trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link
/*----------------------------- Global variables ----------------------------*/

#ifdef CONFIG_NET_POLL_CONTROLLER
cpumask_var_t netpoll_block_tx;
atomic_t netpoll_block_tx = ATOMIC_INIT(0);
#endif

static const char * const version =
Expand Down Expand Up @@ -5299,13 +5299,6 @@ static int __init bonding_init(void)
if (res)
goto out;

#ifdef CONFIG_NET_POLL_CONTROLLER
if (!alloc_cpumask_var(&netpoll_block_tx, GFP_KERNEL)) {
res = -ENOMEM;
goto out;
}
#endif

res = register_pernet_subsys(&bond_net_ops);
if (res)
goto out;
Expand Down Expand Up @@ -5334,9 +5327,6 @@ static int __init bonding_init(void)
rtnl_link_unregister(&bond_link_ops);
err_link:
unregister_pernet_subsys(&bond_net_ops);
#ifdef CONFIG_NET_POLL_CONTROLLER
free_cpumask_var(netpoll_block_tx);
#endif
goto out;

}
Expand All @@ -5353,7 +5343,10 @@ static void __exit bonding_exit(void)
unregister_pernet_subsys(&bond_net_ops);

#ifdef CONFIG_NET_POLL_CONTROLLER
free_cpumask_var(netpoll_block_tx);
/*
* Make sure we don't have an imbalance on our netpoll blocking
*/
WARN_ON(atomic_read(&netpoll_block_tx));
#endif
}

Expand Down
12 changes: 4 additions & 8 deletions trunk/drivers/net/bonding/bonding.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,22 @@


#ifdef CONFIG_NET_POLL_CONTROLLER
extern cpumask_var_t netpoll_block_tx;
extern atomic_t netpoll_block_tx;

static inline void block_netpoll_tx(void)
{
preempt_disable();
BUG_ON(cpumask_test_and_set_cpu(smp_processor_id(),
netpoll_block_tx));
atomic_inc(&netpoll_block_tx);
}

static inline void unblock_netpoll_tx(void)
{
BUG_ON(!cpumask_test_and_clear_cpu(smp_processor_id(),
netpoll_block_tx));
preempt_enable();
atomic_dec(&netpoll_block_tx);
}

static inline int is_netpoll_tx_blocked(struct net_device *dev)
{
if (unlikely(dev->priv_flags & IFF_IN_NETPOLL))
return cpumask_test_cpu(smp_processor_id(), netpoll_block_tx);
return atomic_read(&netpoll_block_tx);
return 0;
}
#else
Expand Down

0 comments on commit bcc7677

Please sign in to comment.