vswitch: Add support for IPsec certificate authentication.
[openvswitch] / datapath / datapath.c
index cf163234086b3800f8593b6259c1015ffd22c135..2be0ce12c6669dee6970c0e632a9edd6c93628f0 100644 (file)
@@ -252,7 +252,7 @@ static int create_dp(int dp_idx, const char __user *devnamep)
 
        /* Allocate table. */
        err = -ENOMEM;
-       rcu_assign_pointer(dp->table, tbl_create(0));
+       rcu_assign_pointer(dp->table, tbl_create(TBL_MIN_BUCKETS));
        if (!dp->table)
                goto err_free_dp;
 
@@ -653,7 +653,7 @@ static int flush_flows(struct datapath *dp)
        struct tbl *old_table = get_table_protected(dp);
        struct tbl *new_table;
 
-       new_table = tbl_create(0);
+       new_table = tbl_create(TBL_MIN_BUCKETS);
        if (!new_table)
                return -ENOMEM;
 
@@ -748,7 +748,7 @@ static struct sw_flow_actions *get_actions(const struct odp_flow *flow)
 
        error = -EFAULT;
        if (copy_from_user(actions->actions,
-                          (struct nlattr __user *)flow->actions,
+                          (struct nlattr __user __force *)flow->actions,
                           flow->actions_len))
                goto error_free_actions;
        error = validate_actions(actions->actions, actions->actions_len);
@@ -817,9 +817,11 @@ static int do_put_flow(struct datapath *dp, struct odp_flow_put *uf,
        struct sw_flow *flow;
        struct tbl *table;
        int error;
+       u32 hash;
 
+       hash = flow_hash(&uf->flow.key);
        table = get_table_protected(dp);
-       flow_node = tbl_lookup(table, &uf->flow.key, flow_hash(&uf->flow.key), flow_cmp);
+       flow_node = tbl_lookup(table, &uf->flow.key, hash, flow_cmp);
        if (!flow_node) {
                /* No such flow. */
                struct sw_flow_actions *acts;
@@ -853,7 +855,7 @@ static int do_put_flow(struct datapath *dp, struct odp_flow_put *uf,
                rcu_assign_pointer(flow->sf_acts, acts);
 
                /* Put flow in bucket. */
-               error = tbl_insert(table, &flow->tbl_node, flow_hash(&flow->key));
+               error = tbl_insert(table, &flow->tbl_node, hash);
                if (error)
                        goto error_free_flow_acts;
 
@@ -1016,7 +1018,7 @@ static int do_query_flows(struct datapath *dp, const struct odp_flowvec *flowvec
        u32 i;
 
        for (i = 0; i < flowvec->n_flows; i++) {
-               struct odp_flow __user *ufp = (struct odp_flow __user *)&flowvec->flows[i];
+               struct odp_flow __user *ufp = (struct odp_flow __user __force *)&flowvec->flows[i];
                struct odp_flow uf;
                struct tbl_node *flow_node;
                int error;
@@ -1069,7 +1071,7 @@ static int do_list_flows(struct datapath *dp, const struct odp_flowvec *flowvec)
                return 0;
 
        cbdata.dp = dp;
-       cbdata.uflows = (struct odp_flow __user *)flowvec->flows;
+       cbdata.uflows = (struct odp_flow __user __force*)flowvec->flows;
        cbdata.n_flows = flowvec->n_flows;
        cbdata.listed_flows = 0;
 
@@ -1119,7 +1121,7 @@ static int do_execute(struct datapath *dp, const struct odp_execute *execute)
 
        err = -EFAULT;
        if (copy_from_user(actions->actions,
-           (struct nlattr __user *)execute->actions, execute->actions_len))
+           (struct nlattr __user __force *)execute->actions, execute->actions_len))
                goto error_free_actions;
 
        err = validate_actions(actions->actions, execute->actions_len);
@@ -1133,7 +1135,7 @@ static int do_execute(struct datapath *dp, const struct odp_execute *execute)
 
        err = -EFAULT;
        if (copy_from_user(skb_put(skb, execute->length),
-                          (const void __user *)execute->data,
+                          (const void __user __force *)execute->data,
                           execute->length))
                goto error_free_skb;
 
@@ -1261,6 +1263,7 @@ static int put_port(const struct vport *p, struct odp_port __user *uop)
        rcu_read_lock();
        strncpy(op.devname, vport_get_name(p), sizeof op.devname);
        strncpy(op.type, vport_get_type(p), sizeof op.type);
+       vport_get_config(p, op.config);
        rcu_read_unlock();
 
        op.port = p->port_no;
@@ -1337,7 +1340,7 @@ static int list_ports(struct datapath *dp, struct odp_portvec __user *upv)
        if (copy_from_user(&pv, upv, sizeof pv))
                return -EFAULT;
 
-       retval = do_list_ports(dp, (struct odp_port __user *)pv.ports,
+       retval = do_list_ports(dp, (struct odp_port __user __force *)pv.ports,
                               pv.n_ports);
        if (retval < 0)
                return retval;