diff options
author | WANG Cong <amwang@redhat.com> | 2010-05-06 03:47:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-06 03:47:21 -0400 |
commit | 0e34e93177fb1f642cab080e0bde664c06c7183a (patch) | |
tree | 5353f873ab99c2cff76f12b41e9a9e2018e66b30 /drivers/net/netconsole.c | |
parent | 08259594e047170923ef11d1482648642bfe606f (diff) |
netpoll: add generic support for bridge and bonding devices
This whole patchset is for adding netpoll support to bridge and bonding
devices. I already tested it for bridge, bonding, bridge over bonding,
and bonding over bridge. It looks fine now.
To make bridge and bonding support netpoll, we need to adjust
some netpoll generic code. This patch does the following things:
1) introduce two new priv_flags for struct net_device:
IFF_IN_NETPOLL which identifies we are processing a netpoll;
IFF_DISABLE_NETPOLL is used to disable netpoll support for a device
at run-time;
2) introduce one new method for netdev_ops:
->ndo_netpoll_cleanup() is used to clean up netpoll when a device is
removed.
3) introduce netpoll_poll_dev() which takes a struct net_device * parameter;
export netpoll_send_skb() and netpoll_poll_dev() which will be used later;
4) hide a pointer to struct netpoll in struct netpoll_info, ditto.
5) introduce ->real_dev for struct netpoll.
6) introduce a new status NETDEV_BONDING_DESLAE, which is used to disable
netconsole before releasing a slave, to avoid deadlocks.
Cc: David Miller <davem@davemloft.net>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r-- | drivers/net/netconsole.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index a361dea35574..ca142c47b2e4 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -665,7 +665,8 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
665 | struct netconsole_target *nt; | 665 | struct netconsole_target *nt; |
666 | struct net_device *dev = ptr; | 666 | struct net_device *dev = ptr; |
667 | 667 | ||
668 | if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER)) | 668 | if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER || |
669 | event == NETDEV_BONDING_DESLAVE || event == NETDEV_GOING_DOWN)) | ||
669 | goto done; | 670 | goto done; |
670 | 671 | ||
671 | spin_lock_irqsave(&target_list_lock, flags); | 672 | spin_lock_irqsave(&target_list_lock, flags); |
@@ -677,19 +678,21 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
677 | strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); | 678 | strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); |
678 | break; | 679 | break; |
679 | case NETDEV_UNREGISTER: | 680 | case NETDEV_UNREGISTER: |
680 | if (!nt->enabled) | ||
681 | break; | ||
682 | netpoll_cleanup(&nt->np); | 681 | netpoll_cleanup(&nt->np); |
682 | /* Fall through */ | ||
683 | case NETDEV_GOING_DOWN: | ||
684 | case NETDEV_BONDING_DESLAVE: | ||
683 | nt->enabled = 0; | 685 | nt->enabled = 0; |
684 | printk(KERN_INFO "netconsole: network logging stopped" | ||
685 | ", interface %s unregistered\n", | ||
686 | dev->name); | ||
687 | break; | 686 | break; |
688 | } | 687 | } |
689 | } | 688 | } |
690 | netconsole_target_put(nt); | 689 | netconsole_target_put(nt); |
691 | } | 690 | } |
692 | spin_unlock_irqrestore(&target_list_lock, flags); | 691 | spin_unlock_irqrestore(&target_list_lock, flags); |
692 | if (event == NETDEV_UNREGISTER || event == NETDEV_BONDING_DESLAVE) | ||
693 | printk(KERN_INFO "netconsole: network logging stopped, " | ||
694 | "interface %s %s\n", dev->name, | ||
695 | event == NETDEV_UNREGISTER ? "unregistered" : "released slaves"); | ||
693 | 696 | ||
694 | done: | 697 | done: |
695 | return NOTIFY_DONE; | 698 | return NOTIFY_DONE; |