-static int
-do_vport_add(struct odp_vport_add *vport_config)
-{
- struct vport *vport;
- int err = 0;
-
- vport_config->port_type[VPORT_TYPE_SIZE - 1] = '\0';
- vport_config->devname[IFNAMSIZ - 1] = '\0';
-
- rtnl_lock();
-
- vport = vport_locate(vport_config->devname);
- if (vport) {
- err = -EEXIST;
- goto out;
- }
-
- vport_lock();
- vport = vport_add(vport_config->devname, vport_config->port_type,
- vport_config->config);
- vport_unlock();
-
- if (IS_ERR(vport))
- err = PTR_ERR(vport);
-
-out:
- rtnl_unlock();
- return err;
-}
-
-/**
- * vport_user_add - add vport device (for userspace callers)
- *
- * @uvport_config: New port configuration.
- *
- * Creates a new vport with the specified configuration (which is dependent
- * on device type). This function is for userspace callers and assumes no
- * locks are held.
- */
-int
-vport_user_add(const struct odp_vport_add __user *uvport_config)
-{
- struct odp_vport_add vport_config;
-
- if (copy_from_user(&vport_config, uvport_config, sizeof(struct odp_vport_add)))
- return -EFAULT;
-
- return do_vport_add(&vport_config);
-}
-
-#ifdef CONFIG_COMPAT
-int
-compat_vport_user_add(struct compat_odp_vport_add *ucompat)
-{
- struct compat_odp_vport_add compat;
- struct odp_vport_add vport_config;
-
- if (copy_from_user(&compat, ucompat, sizeof(struct compat_odp_vport_add)))
- return -EFAULT;
-
- memcpy(vport_config.port_type, compat.port_type, VPORT_TYPE_SIZE);
- memcpy(vport_config.devname, compat.devname, IFNAMSIZ);
- vport_config.config = compat_ptr(compat.config);
-
- return do_vport_add(&vport_config);
-}
-#endif
-
-static int
-do_vport_mod(struct odp_vport_mod *vport_config)
-{
- struct vport *vport;
- int err;
-
- vport_config->devname[IFNAMSIZ - 1] = '\0';
-
- rtnl_lock();
-
- vport = vport_locate(vport_config->devname);
- if (!vport) {
- err = -ENODEV;
- goto out;
- }
-
- vport_lock();
- err = vport_mod(vport, vport_config->config);
- vport_unlock();
-
-out:
- rtnl_unlock();
- return err;
-}
-