2 * Distributed under the terms of the GNU GPL version 2.
3 * Copyright (c) 2007, 2008, 2009, 2010, 2011 Nicira Networks.
5 * Significant portions of this file may be copied from parts of the Linux
6 * kernel, by Linus Torvalds and others.
9 /* Handle changes to managed devices */
11 #include <linux/netdevice.h>
12 #include <net/genetlink.h>
15 #include "vport-internal_dev.h"
16 #include "vport-netdev.h"
18 static int dp_device_event(struct notifier_block *unused, unsigned long event,
21 struct net_device *dev = ptr;
25 if (is_internal_dev(dev))
26 vport = internal_dev_get_vport(dev);
28 vport = netdev_get_vport(dev);
36 case NETDEV_UNREGISTER:
37 if (!is_internal_dev(dev)) {
38 struct sk_buff *reply;
40 dp_detach_port(vport);
41 reply = ovs_vport_cmd_build_info(vport, 0, 0,
44 netlink_set_err(INIT_NET_GENL_SOCK, 0,
45 dp_vport_multicast_group.id,
50 genl_notify(reply, dev_net(dev), 0,
51 dp_vport_multicast_group.id, NULL,
56 case NETDEV_CHANGENAME:
57 if (vport->port_no != OVSP_LOCAL) {
58 dp_sysfs_del_if(vport);
59 dp_sysfs_add_if(vport);
66 struct notifier_block dp_device_notifier = {
67 .notifier_call = dp_device_event