-
-struct vport *ovs_tnl_create(const struct vport_parms *parms,
- const struct vport_ops *vport_ops,
- const struct tnl_ops *tnl_ops)
-{
- struct vport *vport;
- struct tnl_vport *tnl_vport;
- int err;
-
- vport = ovs_vport_alloc(sizeof(struct tnl_vport), vport_ops, parms);
- if (IS_ERR(vport)) {
- err = PTR_ERR(vport);
- goto error;
- }
-
- tnl_vport = tnl_vport_priv(vport);
-
- strcpy(tnl_vport->name, parms->name);
- tnl_vport->tnl_ops = tnl_ops;
-
- return vport;
-
-error:
- return ERR_PTR(err);
-}
-
-static void free_port_rcu(struct rcu_head *rcu)
-{
- struct tnl_vport *tnl_vport = container_of(rcu,
- struct tnl_vport, rcu);
-
- ovs_vport_free(vport_from_priv(tnl_vport));
-}
-
-void ovs_tnl_destroy(struct vport *vport)
-{
- struct tnl_vport *tnl_vport = tnl_vport_priv(vport);
-
- call_rcu(&tnl_vport->rcu, free_port_rcu);
-}
-
-const char *ovs_tnl_get_name(const struct vport *vport)
-{
- const struct tnl_vport *tnl_vport = tnl_vport_priv(vport);
- return tnl_vport->name;
-}