-/**
- * vport_attach - attach a vport to a datapath
- *
- * @vport: vport to attach.
- * @dp_port: Datapath port to attach the vport to.
- *
- * Attaches a vport to a specific datapath so that packets may be exchanged.
- * Both ports must be currently unattached. @dp_port must be successfully
- * attached to a vport before it is connected to a datapath and must not be
- * modified while connected. RTNL lock and the appropriate DP mutex must be held.
- */
-int vport_attach(struct vport *vport, struct dp_port *dp_port)
-{
- ASSERT_RTNL();
-
- if (vport_get_dp_port(vport))
- return -EBUSY;
-
- if (vport->ops->attach) {
- int err;
-
- err = vport->ops->attach(vport);
- if (err)
- return err;
- }
-
- rcu_assign_pointer(vport->dp_port, dp_port);
-
- return 0;
-}
-
-/**
- * vport_detach - detach a vport from a datapath
- *
- * @vport: vport to detach.
- *
- * Detaches a vport from a datapath. May fail for a variety of reasons,
- * including lack of memory. RTNL lock and the appropriate DP mutex must be held.
- */
-int vport_detach(struct vport *vport)
-{
- struct dp_port *dp_port;
-
- ASSERT_RTNL();
-
- dp_port = vport_get_dp_port(vport);
- if (!dp_port)
- return -EINVAL;
-
- rcu_assign_pointer(vport->dp_port, NULL);
-
- if (vport->ops->detach)
- return vport->ops->detach(vport);
- else
- return 0;
-}
-