Commit cfb478da authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

bridge: netpoll cleanup

Move code around so that the ifdef for NETPOLL_CONTROLLER don't have to
show up in main code path. The control functions should be in helpers
that are only compiled if needed.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c17b274d
...@@ -199,7 +199,7 @@ static int br_set_tx_csum(struct net_device *dev, u32 data) ...@@ -199,7 +199,7 @@ static int br_set_tx_csum(struct net_device *dev, u32 data)
} }
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
bool br_devices_support_netpoll(struct net_bridge *br) static bool br_devices_support_netpoll(struct net_bridge *br)
{ {
struct net_bridge_port *p; struct net_bridge_port *p;
bool ret = true; bool ret = true;
...@@ -225,9 +225,9 @@ static void br_poll_controller(struct net_device *br_dev) ...@@ -225,9 +225,9 @@ static void br_poll_controller(struct net_device *br_dev)
netpoll_poll_dev(np->real_dev); netpoll_poll_dev(np->real_dev);
} }
void br_netpoll_cleanup(struct net_device *br_dev) void br_netpoll_cleanup(struct net_device *dev)
{ {
struct net_bridge *br = netdev_priv(br_dev); struct net_bridge *br = netdev_priv(dev);
struct net_bridge_port *p, *n; struct net_bridge_port *p, *n;
const struct net_device_ops *ops; const struct net_device_ops *ops;
...@@ -243,10 +243,30 @@ void br_netpoll_cleanup(struct net_device *br_dev) ...@@ -243,10 +243,30 @@ void br_netpoll_cleanup(struct net_device *br_dev)
} }
} }
#else void br_netpoll_disable(struct net_bridge *br,
struct net_device *dev)
{
if (br_devices_support_netpoll(br))
br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
if (dev->netdev_ops->ndo_netpoll_cleanup)
dev->netdev_ops->ndo_netpoll_cleanup(dev);
else
dev->npinfo = NULL;
}
void br_netpoll_cleanup(struct net_device *br_dev) void br_netpoll_enable(struct net_bridge *br,
struct net_device *dev)
{ {
if (br_devices_support_netpoll(br)) {
br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
if (br->dev->npinfo)
dev->npinfo = br->dev->npinfo;
} else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) {
br->dev->priv_flags |= IFF_DISABLE_NETPOLL;
printk(KERN_INFO "%s:new device %s"
" does not support netpoll (disabling)",
br->dev->name, dev->name);
}
} }
#endif #endif
......
...@@ -154,14 +154,7 @@ static void del_nbp(struct net_bridge_port *p) ...@@ -154,14 +154,7 @@ static void del_nbp(struct net_bridge_port *p)
kobject_uevent(&p->kobj, KOBJ_REMOVE); kobject_uevent(&p->kobj, KOBJ_REMOVE);
kobject_del(&p->kobj); kobject_del(&p->kobj);
#ifdef CONFIG_NET_POLL_CONTROLLER br_netpoll_disable(br, dev);
if (br_devices_support_netpoll(br))
br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
if (dev->netdev_ops->ndo_netpoll_cleanup)
dev->netdev_ops->ndo_netpoll_cleanup(dev);
else
dev->npinfo = NULL;
#endif
call_rcu(&p->rcu, destroy_nbp_rcu); call_rcu(&p->rcu, destroy_nbp_rcu);
} }
...@@ -455,19 +448,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) ...@@ -455,19 +448,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
kobject_uevent(&p->kobj, KOBJ_ADD); kobject_uevent(&p->kobj, KOBJ_ADD);
#ifdef CONFIG_NET_POLL_CONTROLLER br_netpoll_enable(br, dev);
if (br_devices_support_netpoll(br)) {
br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
if (br->dev->npinfo)
dev->npinfo = br->dev->npinfo;
} else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) {
br->dev->priv_flags |= IFF_DISABLE_NETPOLL;
printk(KERN_INFO "New device %s does not support netpoll\n",
dev->name);
printk(KERN_INFO "Disabling netpoll for %s\n",
br->dev->name);
}
#endif
return 0; return 0;
err2: err2:
......
...@@ -253,8 +253,18 @@ static inline int br_is_root_bridge(const struct net_bridge *br) ...@@ -253,8 +253,18 @@ static inline int br_is_root_bridge(const struct net_bridge *br)
extern void br_dev_setup(struct net_device *dev); extern void br_dev_setup(struct net_device *dev);
extern netdev_tx_t br_dev_xmit(struct sk_buff *skb, extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
struct net_device *dev); struct net_device *dev);
extern bool br_devices_support_netpoll(struct net_bridge *br); #ifdef CONFIG_NET_POLL_CONTROLLER
extern void br_netpoll_cleanup(struct net_device *br_dev); extern void br_netpoll_cleanup(struct net_device *dev);
extern void br_netpoll_enable(struct net_bridge *br,
struct net_device *dev);
extern void br_netpoll_disable(struct net_bridge *br,
struct net_device *dev);
#else
#define br_netpoll_cleanup(br)
#define br_netpoll_enable(br, dev)
#define br_netpoll_disable(br, dev)
#endif
/* br_fdb.c */ /* br_fdb.c */
extern int br_fdb_init(void); extern int br_fdb_init(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment