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/vport-internal_dev.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/vport-internal_dev.c')
-rw-r--r-- | datapath/vport-internal_dev.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index c4de2be6..c0e250db 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -97,16 +97,13 @@ static void internal_dev_getinfo(struct net_device *netdev, struct ethtool_drvinfo *info) { struct vport *vport = internal_dev_get_vport(netdev); - struct dp_port *dp_port; strcpy(info->driver, "openvswitch"); if (!vport) return; - dp_port = vport_get_dp_port(vport); - if (dp_port) - sprintf(info->bus_info, "%d.%d", dp_port->dp->dp_idx, dp_port->port_no); + sprintf(info->bus_info, "%d.%d", vport->dp->dp_idx, vport->port_no); } static const struct ethtool_ops internal_dev_ethtool_ops = { @@ -127,14 +124,8 @@ static int internal_dev_change_mtu(struct net_device *netdev, int new_mtu) if (new_mtu < 68) return -EINVAL; - if (vport) { - struct dp_port *dp_port = vport_get_dp_port(vport); - - if (dp_port) { - if (new_mtu > dp_min_mtu(dp_port->dp)) - return -EINVAL; - } - } + if (vport && new_mtu > dp_min_mtu(vport->dp)) + return -EINVAL; netdev->mtu = new_mtu; return 0; @@ -194,7 +185,7 @@ static struct vport *internal_dev_create(const struct vport_parms *parms) struct internal_dev *internal_dev; int err; - vport = vport_alloc(sizeof(struct netdev_vport), &internal_vport_ops); + vport = vport_alloc(sizeof(struct netdev_vport), &internal_vport_ops, parms); if (IS_ERR(vport)) { err = PTR_ERR(vport); goto error; |