2 * Copyright (c) 2007-2012 Nicira, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 #include <linux/netdevice.h>
20 #include <net/genetlink.h>
23 #include "vport-internal_dev.h"
24 #include "vport-netdev.h"
26 static int dp_device_event(struct notifier_block *unused, unsigned long event,
29 struct net_device *dev = ptr;
32 if (ovs_is_internal_dev(dev))
33 vport = ovs_internal_dev_get_vport(dev);
35 vport = ovs_netdev_get_vport(dev);
41 case NETDEV_UNREGISTER:
42 if (!ovs_is_internal_dev(dev)) {
43 struct sk_buff *notify;
45 notify = ovs_vport_cmd_build_info(vport, 0, 0,
47 ovs_dp_detach_port(vport);
49 netlink_set_err(GENL_SOCK(ovs_dp_get_net(vport->dp)), 0,
50 ovs_dp_vport_multicast_group.id,
55 genlmsg_multicast_netns(ovs_dp_get_net(vport->dp), notify, 0,
56 ovs_dp_vport_multicast_group.id,
61 case NETDEV_CHANGENAME:
62 if (vport->port_no != OVSP_LOCAL) {
63 ovs_dp_sysfs_del_if(vport);
64 ovs_dp_sysfs_add_if(vport);
72 struct notifier_block ovs_dp_device_notifier = {
73 .notifier_call = dp_device_event