aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-05-10 05:31:08 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-16 02:10:01 -0400
commitcfb478da70f2213520866c84cb0aea0d7c0e1148 (patch)
treebc1a1ea16bbb2be0481d3231a2fbe5611437da55
parentc17b274dc2aa538b68c1f02b01a3c4e124b435ba (diff)
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>
-rw-r--r--net/bridge/br_device.c30
-rw-r--r--net/bridge/br_if.c23
-rw-r--r--net/bridge/br_private.h14
3 files changed, 39 insertions, 28 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index f15f9c4a0dd2..22b97ba7dc52 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)
199} 199}
200 200
201#ifdef CONFIG_NET_POLL_CONTROLLER 201#ifdef CONFIG_NET_POLL_CONTROLLER
202bool br_devices_support_netpoll(struct net_bridge *br) 202static bool br_devices_support_netpoll(struct net_bridge *br)
203{ 203{
204 struct net_bridge_port *p; 204 struct net_bridge_port *p;
205 bool ret = true; 205 bool ret = true;
@@ -225,9 +225,9 @@ static void br_poll_controller(struct net_device *br_dev)
225 netpoll_poll_dev(np->real_dev); 225 netpoll_poll_dev(np->real_dev);
226} 226}
227 227
228void br_netpoll_cleanup(struct net_device *br_dev) 228void br_netpoll_cleanup(struct net_device *dev)
229{ 229{
230 struct net_bridge *br = netdev_priv(br_dev); 230 struct net_bridge *br = netdev_priv(dev);
231 struct net_bridge_port *p, *n; 231 struct net_bridge_port *p, *n;
232 const struct net_device_ops *ops; 232 const struct net_device_ops *ops;
233 233
@@ -243,10 +243,30 @@ void br_netpoll_cleanup(struct net_device *br_dev)
243 } 243 }
244} 244}
245 245
246#else 246void br_netpoll_disable(struct net_bridge *br,
247 struct net_device *dev)
248{
249 if (br_devices_support_netpoll(br))
250 br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
251 if (dev->netdev_ops->ndo_netpoll_cleanup)
252 dev->netdev_ops->ndo_netpoll_cleanup(dev);
253 else
254 dev->npinfo = NULL;
255}
247 256
248void br_netpoll_cleanup(struct net_device *br_dev) 257void br_netpoll_enable(struct net_bridge *br,
258 struct net_device *dev)
249{ 259{
260 if (br_devices_support_netpoll(br)) {
261 br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
262 if (br->dev->npinfo)
263 dev->npinfo = br->dev->npinfo;
264 } else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) {
265 br->dev->priv_flags |= IFF_DISABLE_NETPOLL;
266 printk(KERN_INFO "%s:new device %s"
267 " does not support netpoll (disabling)",
268 br->dev->name, dev->name);
269 }
250} 270}
251 271
252#endif 272#endif
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 537bdd60d9b9..45f3f8871149 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -154,14 +154,7 @@ static void del_nbp(struct net_bridge_port *p)
154 kobject_uevent(&p->kobj, KOBJ_REMOVE); 154 kobject_uevent(&p->kobj, KOBJ_REMOVE);
155 kobject_del(&p->kobj); 155 kobject_del(&p->kobj);
156 156
157#ifdef CONFIG_NET_POLL_CONTROLLER 157 br_netpoll_disable(br, dev);
158 if (br_devices_support_netpoll(br))
159 br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
160 if (dev->netdev_ops->ndo_netpoll_cleanup)
161 dev->netdev_ops->ndo_netpoll_cleanup(dev);
162 else
163 dev->npinfo = NULL;
164#endif
165 call_rcu(&p->rcu, destroy_nbp_rcu); 158 call_rcu(&p->rcu, destroy_nbp_rcu);
166} 159}
167 160
@@ -455,19 +448,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
455 448
456 kobject_uevent(&p->kobj, KOBJ_ADD); 449 kobject_uevent(&p->kobj, KOBJ_ADD);
457 450
458#ifdef CONFIG_NET_POLL_CONTROLLER 451 br_netpoll_enable(br, dev);
459 if (br_devices_support_netpoll(br)) {
460 br->dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
461 if (br->dev->npinfo)
462 dev->npinfo = br->dev->npinfo;
463 } else if (!(br->dev->priv_flags & IFF_DISABLE_NETPOLL)) {
464 br->dev->priv_flags |= IFF_DISABLE_NETPOLL;
465 printk(KERN_INFO "New device %s does not support netpoll\n",
466 dev->name);
467 printk(KERN_INFO "Disabling netpoll for %s\n",
468 br->dev->name);
469 }
470#endif
471 452
472 return 0; 453 return 0;
473err2: 454err2:
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 3d2d3fe0a97e..8a072661a744 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -253,8 +253,18 @@ static inline int br_is_root_bridge(const struct net_bridge *br)
253extern void br_dev_setup(struct net_device *dev); 253extern void br_dev_setup(struct net_device *dev);
254extern netdev_tx_t br_dev_xmit(struct sk_buff *skb, 254extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
255 struct net_device *dev); 255 struct net_device *dev);
256extern bool br_devices_support_netpoll(struct net_bridge *br); 256#ifdef CONFIG_NET_POLL_CONTROLLER
257extern void br_netpoll_cleanup(struct net_device *br_dev); 257extern void br_netpoll_cleanup(struct net_device *dev);
258extern void br_netpoll_enable(struct net_bridge *br,
259 struct net_device *dev);
260extern void br_netpoll_disable(struct net_bridge *br,
261 struct net_device *dev);
262#else
263#define br_netpoll_cleanup(br)
264#define br_netpoll_enable(br, dev)
265#define br_netpoll_disable(br, dev)
266
267#endif
258 268
259/* br_fdb.c */ 269/* br_fdb.c */
260extern int br_fdb_init(void); 270extern int br_fdb_init(void);