aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_device.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-05-10 09:31:08 +0000
committerDavid S. Miller <davem@davemloft.net>2010-05-15 23:10:01 -0700
commitcfb478da70f2213520866c84cb0aea0d7c0e1148 (patch)
treebc1a1ea16bbb2be0481d3231a2fbe5611437da55 /net/bridge/br_device.c
parentc17b274dc2aa538b68c1f02b01a3c4e124b435ba (diff)
downloadkernel_samsung_aries-cfb478da70f2213520866c84cb0aea0d7c0e1148.zip
kernel_samsung_aries-cfb478da70f2213520866c84cb0aea0d7c0e1148.tar.gz
kernel_samsung_aries-cfb478da70f2213520866c84cb0aea0d7c0e1148.tar.bz2
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: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_device.c')
-rw-r--r--net/bridge/br_device.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index f15f9c4..22b97ba 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -199,7 +199,7 @@ static int br_set_tx_csum(struct net_device *dev, u32 data)
}
#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;
bool ret = true;
@@ -225,9 +225,9 @@ static void br_poll_controller(struct net_device *br_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;
const struct net_device_ops *ops;
@@ -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