datapath: remove RCU annotation from flow->mask
authorAndy Zhou <azhou@nicira.com>
Mon, 22 Jul 2013 22:08:00 +0000 (15:08 -0700)
committerJesse Gross <jesse@nicira.com>
Mon, 22 Jul 2013 22:29:31 +0000 (15:29 -0700)
After a mask is assigned to a flow, it will not change for the life of
the flow. Since flow access is protected by RCU lock, access to
flow->mask after getting a flow is always safe.

Suggested-by: Jesse Gross <jesse@nicira.com>
Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Conflicts:
datapath/datapath.c

datapath/datapath.c
datapath/flow.c
datapath/flow.h

index 2b018c9..9b03fc0 100644 (file)
@@ -1157,8 +1157,7 @@ static int ovs_flow_cmd_fill_info(struct sw_flow *flow, struct datapath *dp,
        if (!nla)
                goto nla_put_failure;
 
-       err = ovs_flow_to_nlattrs(&flow->key,
-                       &ovsl_dereference(flow->mask)->key, skb);
+       err = ovs_flow_to_nlattrs(&flow->key, &flow->mask->key, skb);
        if (err)
                goto error;
 
@@ -1339,7 +1338,7 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info)
                }
 
                ovs_sw_flow_mask_add_ref(mask_p);
-               rcu_assign_pointer(flow->mask, mask_p);
+               flow->mask = mask_p;
                rcu_assign_pointer(flow->sf_acts, acts);
 
                /* Put flow in bucket. */
index e2f3c87..d2c3d64 100644 (file)
@@ -638,8 +638,7 @@ void ovs_flow_free(struct sw_flow *flow, bool deferred)
        if (!flow)
                return;
 
-       ovs_sw_flow_mask_del_ref((struct sw_flow_mask __force *)flow->mask,
-                                deferred);
+       ovs_sw_flow_mask_del_ref(flow->mask, deferred);
 
        if (deferred)
                call_rcu(&flow->rcu, rcu_free_flow_callback);
@@ -1071,9 +1070,8 @@ struct sw_flow *ovs_flow_lookup(struct flow_table *tbl,
 
 void ovs_flow_insert(struct flow_table *table, struct sw_flow *flow)
 {
-       flow->hash = ovs_flow_hash(&flow->key,
-                       ovsl_dereference(flow->mask)->range.start,
-                       ovsl_dereference(flow->mask)->range.end);
+       flow->hash = ovs_flow_hash(&flow->key, flow->mask->range.start,
+                       flow->mask->range.end);
        __tbl_insert(table, flow);
 }
 
index dc08d03..8f1ad3b 100644 (file)
@@ -123,7 +123,7 @@ struct sw_flow {
 
        struct sw_flow_key key;
        struct sw_flow_key unmasked_key;
-       struct sw_flow_mask __rcu *mask;
+       struct sw_flow_mask *mask;
        struct sw_flow_actions __rcu *sf_acts;
 
        spinlock_t lock;        /* Lock for values below. */