diff options
| author | Ben Pfaff <blp@nicira.com> | 2010-12-03 14:41:38 -0800 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2010-12-03 14:41:38 -0800 |
| commit | c3827f619a38d3d202020838e1f92860046a3dbe (patch) | |
| tree | 7f4b1c921a95a62ebbbc80ec1af04ae246a9d1fc /datapath/vport-patch.c | |
| parent | 94903c989826268a7fab3c730cd7d0b35ef423d5 (diff) | |
| download | openvswitch-c3827f619a38d3d202020838e1f92860046a3dbe.tar.gz | |
datapath: Make adding and attaching a vport a single step.
For some time now, Open vSwitch datapaths have internally made a
distinction between adding a vport and attaching it to a datapath. Adding
a vport just means to create it, as an entity detached from any datapath.
Attaching it gives it a port number and a datapath. Similarly, a vport
could be detached and deleted separately.
After some study, I think I understand why this distinction exists. It is
because ovs-vswitchd tries to open all the datapath ports before it tries
to create them. However, changing it to create them before it tries to
open them is not difficult, so this commit does this.
The bulk of this commit, however, changes the datapath interface to one
that always creates a vport and attaches it to a datapath in a single step,
and similarly detaches a vport and deletes it in a single step.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/vport-patch.c')
| -rw-r--r-- | datapath/vport-patch.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/datapath/vport-patch.c b/datapath/vport-patch.c index eb3915805..b5276b171 100644 --- a/datapath/vport-patch.c +++ b/datapath/vport-patch.c @@ -83,17 +83,12 @@ static void patch_exit(void) kfree(peer_table); } -static int set_config(struct vport *vport, const void __user *uconfig) +static int set_config(struct vport *vport, const void *config) { struct patch_vport *patch_vport = patch_vport_priv(vport); char peer_name[IFNAMSIZ]; - int retval; - retval = strncpy_from_user(peer_name, uconfig, IFNAMSIZ); - if (retval < 0) - return -EFAULT; - else if (retval >= IFNAMSIZ) - return -ENAMETOOLONG; + strlcpy(peer_name, config, IFNAMSIZ); if (!strcmp(patch_vport->name, peer_name)) return -EINVAL; @@ -149,9 +144,9 @@ error: return ERR_PTR(err); } -static int patch_modify(struct vport *vport, const void __user *config) +static int patch_modify(struct vport *vport, struct odp_port *port) { - return set_config(vport, config); + return set_config(vport, port->config); } static int patch_destroy(struct vport *vport) |
