port-array: Remove.
[openvswitch] / datapath / tunnel.c
index cdbb4f45609ffa5bce8616bc4357e4c091f7cd45..ec3ad936f824fbaf6857a38ef9a79a1bb53b13df 100644 (file)
@@ -29,6 +29,7 @@
 #include <net/xfrm.h>
 
 #include "actions.h"
+#include "checksum.h"
 #include "datapath.h"
 #include "table.h"
 #include "tunnel.h"
@@ -883,22 +884,17 @@ static struct tnl_cache *build_cache(struct vport *vport,
 #endif
 
        if (is_internal_dev(rt_dst(rt).dev)) {
-               int err;
+               struct odp_flow_key flow_key;
+               struct tbl_node *flow_node;
                struct vport *vport;
-               struct dp_port *dp_port;
                struct sk_buff *skb;
                bool is_frag;
-               struct odp_flow_key flow_key;
-               struct tbl_node *flow_node;
+               int err;
 
                vport = internal_dev_get_vport(rt_dst(rt).dev);
                if (!vport)
                        goto done;
 
-               dp_port = vport_get_dp_port(vport);
-               if (!dp_port)
-                       goto done;
-
                skb = alloc_skb(cache->len, GFP_ATOMIC);
                if (!skb)
                        goto done;
@@ -906,13 +902,13 @@ static struct tnl_cache *build_cache(struct vport *vport,
                __skb_put(skb, cache->len);
                memcpy(skb->data, get_cached_header(cache), cache->len);
 
-               err = flow_extract(skb, dp_port->port_no, &flow_key, &is_frag);
+               err = flow_extract(skb, vport->port_no, &flow_key, &is_frag);
 
                kfree_skb(skb);
                if (err || is_frag)
                        goto done;
 
-               flow_node = tbl_lookup(rcu_dereference(dp_port->dp->table),
+               flow_node = tbl_lookup(rcu_dereference(vport->dp->table),
                                       &flow_key, flow_hash(&flow_key),
                                       flow_cmp);
                if (flow_node) {
@@ -1300,15 +1296,14 @@ out:
        return sent_len;
 }
 
-static int set_config(const void __user *uconfig, const struct tnl_ops *tnl_ops,
+static int set_config(const void *config, const struct tnl_ops *tnl_ops,
                      const struct vport *cur_vport,
                      struct tnl_mutable_config *mutable)
 {
        const struct vport *old_vport;
        const struct tnl_mutable_config *old_mutable;
 
-       if (copy_from_user(&mutable->port_config, uconfig, sizeof(struct tnl_port_config)))
-               return -EFAULT;
+       mutable->port_config = *(struct tnl_port_config *)config;
 
        if (mutable->port_config.daddr == 0)
                return -EINVAL;
@@ -1353,7 +1348,7 @@ struct vport *tnl_create(const struct vport_parms *parms,
        int initial_frag_id;
        int err;
 
-       vport = vport_alloc(sizeof(struct tnl_vport), vport_ops);
+       vport = vport_alloc(sizeof(struct tnl_vport), vport_ops, parms);
        if (IS_ERR(vport)) {
                err = PTR_ERR(vport);
                goto error;
@@ -1401,7 +1396,7 @@ error:
        return ERR_PTR(err);
 }
 
-int tnl_modify(struct vport *vport, const void __user *config)
+int tnl_modify(struct vport *vport, struct odp_port *port)
 {
        struct tnl_vport *tnl_vport = tnl_vport_priv(vport);
        struct tnl_mutable_config *mutable;
@@ -1413,7 +1408,7 @@ int tnl_modify(struct vport *vport, const void __user *config)
                goto error;
        }
 
-       err = set_config(config, tnl_vport->tnl_ops, vport, mutable);
+       err = set_config(port->config, tnl_vport->tnl_ops, vport, mutable);
        if (err)
                goto error_free;