bridge: make bridge support netpoll
Based on the previous patch, make bridge support netpoll by: 1) implement the 2 methods to support netpoll for bridge; 2) modify netpoll during forwarding packets via bridge; 3) disable netpoll support of bridge when a netpoll-unabled device is added to bridge; 4) enable netpoll support when all underlying devices support netpoll. Cc: David Miller <davem@davemloft.net> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: Stephen Hemminger <shemminger@linux-foundation.org> Cc: Matt Mackall <mpm@selenic.com> Signed-off-by: WANG Cong <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
0e34e93177
commit
c06ee961d3
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/netpoll.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/module.h>
|
||||
@@ -153,6 +154,14 @@ static void del_nbp(struct net_bridge_port *p)
|
||||
kobject_uevent(&p->kobj, KOBJ_REMOVE);
|
||||
kobject_del(&p->kobj);
|
||||
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -165,6 +174,8 @@ static void del_br(struct net_bridge *br, struct list_head *head)
|
||||
del_nbp(p);
|
||||
}
|
||||
|
||||
br_netpoll_cleanup(br->dev);
|
||||
|
||||
del_timer_sync(&br->gc_timer);
|
||||
|
||||
br_sysfs_delbr(br->dev);
|
||||
@@ -444,6 +455,20 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
|
||||
|
||||
kobject_uevent(&p->kobj, KOBJ_ADD);
|
||||
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
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;
|
||||
err2:
|
||||
br_fdb_delete_by_port(br, p, 1);
|
||||
|
Reference in New Issue
Block a user