2 * Distributed under the terms of the GNU GPL version 2.
3 * Copyright (c) 2007, 2008, 2009, 2010 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>
14 #include "vport-internal_dev.h"
15 #include "vport-netdev.h"
17 static int dp_device_event(struct notifier_block *unused, unsigned long event,
20 struct net_device *dev = ptr;
25 if (is_internal_dev(dev))
26 vport = internal_dev_get_vport(dev);
28 vport = netdev_get_vport(dev);
34 p = vport_get_dp_port(vport);
41 case NETDEV_UNREGISTER:
42 mutex_lock(&dp->mutex);
44 mutex_unlock(&dp->mutex);
47 case NETDEV_CHANGENAME:
48 if (p->port_no != ODPP_LOCAL) {
49 mutex_lock(&dp->mutex);
52 mutex_unlock(&dp->mutex);
56 case NETDEV_CHANGEMTU:
57 if (!is_internal_dev(dev)) {
58 mutex_lock(&dp->mutex);
59 set_internal_devs_mtu(dp);
60 mutex_unlock(&dp->mutex);
67 struct notifier_block dp_device_notifier = {
68 .notifier_call = dp_device_event