Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352407
b: refs/heads/master
c: 2cde6ac
h: refs/heads/master
i:
  352405: 04a74b2
  352403: 2caf374
  352399: f703788
v: v3
  • Loading branch information
Neil Horman authored and David S. Miller committed Feb 12, 2013
1 parent cd2e2ec commit 1953c65
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 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: f05de73bf82fbbc00265c06d12efb7273f7dc54a
refs/heads/master: 2cde6acd49daca58b96f1fbc697492825511ad31
2 changes: 1 addition & 1 deletion trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ static inline void slave_disable_netpoll(struct slave *slave)
return;

slave->np = NULL;
__netpoll_free_rcu(np);
__netpoll_free_async(np);
}
static inline bool slave_dev_support_netpoll(struct net_device *slave_dev)
{
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct netpoll {
u8 remote_mac[ETH_ALEN];

struct list_head rx; /* rx_np list element */
struct rcu_head rcu;
struct work_struct cleanup_work;
};

struct netpoll_info {
Expand Down Expand Up @@ -68,7 +68,7 @@ int netpoll_setup(struct netpoll *np);
int netpoll_trap(void);
void netpoll_set_trap(int trap);
void __netpoll_cleanup(struct netpoll *np);
void __netpoll_free_rcu(struct netpoll *np);
void __netpoll_free_async(struct netpoll *np);
void netpoll_cleanup(struct netpoll *np);
int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/8021q/vlan_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ static void vlan_dev_netpoll_cleanup(struct net_device *dev)

vlan->netpoll = NULL;

__netpoll_free_rcu(netpoll);
__netpoll_free_async(netpoll);
}
#endif /* CONFIG_NET_POLL_CONTROLLER */

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/bridge/br_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void br_netpoll_disable(struct net_bridge_port *p)

p->np = NULL;

__netpoll_free_rcu(np);
__netpoll_free_async(np);
}

#endif
Expand Down
16 changes: 10 additions & 6 deletions trunk/net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static struct srcu_struct netpoll_srcu;

static void zap_completion_queue(void);
static void netpoll_neigh_reply(struct sk_buff *skb, struct netpoll_info *npinfo);
static void netpoll_async_cleanup(struct work_struct *work);

static unsigned int carrier_timeout = 4;
module_param(carrier_timeout, uint, 0644);
Expand Down Expand Up @@ -1020,6 +1021,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp)

np->dev = ndev;
strlcpy(np->dev_name, ndev->name, IFNAMSIZ);
INIT_WORK(&np->cleanup_work, netpoll_async_cleanup);

if ((ndev->priv_flags & IFF_DISABLE_NETPOLL) ||
!ndev->netdev_ops->ndo_poll_controller) {
Expand Down Expand Up @@ -1255,25 +1257,27 @@ void __netpoll_cleanup(struct netpoll *np)
if (ops->ndo_netpoll_cleanup)
ops->ndo_netpoll_cleanup(np->dev);

RCU_INIT_POINTER(np->dev->npinfo, NULL);
rcu_assign_pointer(np->dev->npinfo, NULL);
call_rcu_bh(&npinfo->rcu, rcu_cleanup_netpoll_info);
}
}
EXPORT_SYMBOL_GPL(__netpoll_cleanup);

static void rcu_cleanup_netpoll(struct rcu_head *rcu_head)
static void netpoll_async_cleanup(struct work_struct *work)
{
struct netpoll *np = container_of(rcu_head, struct netpoll, rcu);
struct netpoll *np = container_of(work, struct netpoll, cleanup_work);

rtnl_lock();
__netpoll_cleanup(np);
rtnl_unlock();
kfree(np);
}

void __netpoll_free_rcu(struct netpoll *np)
void __netpoll_free_async(struct netpoll *np)
{
call_rcu_bh(&np->rcu, rcu_cleanup_netpoll);
schedule_work(&np->cleanup_work);
}
EXPORT_SYMBOL_GPL(__netpoll_free_rcu);
EXPORT_SYMBOL_GPL(__netpoll_free_async);

void netpoll_cleanup(struct netpoll *np)
{
Expand Down

0 comments on commit 1953c65

Please sign in to comment.