diff options
author | Ben Pfaff <blp@nicira.com> | 2010-12-03 13:09:26 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-12-03 14:43:38 -0800 |
commit | e779d8d90d65297473febcf82ec44c9225cc4fe3 (patch) | |
tree | e9707a52c2ffc4840dc4701c85e964895ff8b2e6 /datapath/dp_notify.c | |
parent | 98563392dba5c82a9b952c421dec8b16c8a24023 (diff) |
datapath: Merge "struct dp_port" into "struct vport".
After the previous commit, which changed the datapath to always create and
attach a vport at the same time, and to always detach and delete a vport
at the same time, there is no longer any real distinction between a dp_port
and a vport. This commit, therefore, merges the two together to simplify
code. It might even improve performance, although I have not checked.
I wasn't sure at first whether the merged structure should be "struct
dp_port" or "struct vport". I went with the latter since the "v" prefix
sounds cool.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/dp_notify.c')
-rw-r--r-- | datapath/dp_notify.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/datapath/dp_notify.c b/datapath/dp_notify.c index 1843d756..e7d08bc3 100644 --- a/datapath/dp_notify.c +++ b/datapath/dp_notify.c @@ -19,7 +19,6 @@ static int dp_device_event(struct notifier_block *unused, unsigned long event, { struct net_device *dev = ptr; struct vport *vport; - struct dp_port *p; struct datapath *dp; if (is_internal_dev(dev)) @@ -30,24 +29,20 @@ static int dp_device_event(struct notifier_block *unused, unsigned long event, if (!vport) return NOTIFY_DONE; - p = vport_get_dp_port(vport); - - if (!p) - return NOTIFY_DONE; - dp = p->dp; + dp = vport->dp; switch (event) { case NETDEV_UNREGISTER: mutex_lock(&dp->mutex); - dp_detach_port(p); + dp_detach_port(vport); mutex_unlock(&dp->mutex); break; case NETDEV_CHANGENAME: - if (p->port_no != ODPP_LOCAL) { + if (vport->port_no != ODPP_LOCAL) { mutex_lock(&dp->mutex); - dp_sysfs_del_if(p); - dp_sysfs_add_if(p); + dp_sysfs_del_if(vport); + dp_sysfs_add_if(vport); mutex_unlock(&dp->mutex); } break; |