On Mar 28, 2014, at 1:26 PM, Pravin Shelar <pshe...@nicira.com> wrote:
> On Tue, Mar 25, 2014 at 2:35 PM, Jarno Rajahalme <jrajaha...@nicira.com> > wrote: >> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com> >> --- >> v5: Make functionality after ovs_unlock() case specific to make the common >> case more optimal. >> >> datapath/datapath.c | 135 >> ++++++++++++++++++++++++++++++--------------------- >> 1 file changed, 81 insertions(+), 54 deletions(-) >> >> diff --git a/datapath/datapath.c b/datapath/datapath.c >> index 0de00ad..aa3f789 100644 >> --- a/datapath/datapath.c >> +++ b/datapath/datapath.c >> @@ -808,7 +808,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct >> genl_info *info) >> struct nlattr **a = info->attrs; >> struct ovs_header *ovs_header = info->userhdr; >> struct sw_flow_key key, masked_key; >> - struct sw_flow *flow; >> + struct sw_flow *flow, *new_flow; >> struct sw_flow_mask mask; >> struct sk_buff *reply; >> struct datapath *dp; >> @@ -842,35 +842,52 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, >> struct genl_info *info) >> &masked_key, 0, &acts); >> if (error) { >> OVS_NLERR("Flow actions may not be safe on all matching >> packets.\n"); >> - goto err_kfree; >> + goto err_kfree_acts; >> + } >> + >> + reply = ovs_flow_cmd_alloc_info(acts, info, false); >> + if (IS_ERR(reply)) { >> + error = PTR_ERR(reply); >> + goto err_kfree_acts; >> } >> >> + /* Most of the time we need to allocate a new flow, do it before >> + * locking. */ >> + new_flow = ovs_flow_alloc(); >> + if (IS_ERR(new_flow)) { >> + error = PTR_ERR(new_flow); >> + goto err_kfree_reply; >> + } >> + new_flow->key = masked_key; >> + new_flow->unmasked_key = key; >> + > If flow alloc is done at start, we can directly use flow->key and > flow->unmasked_key rather than using local key and unmasked_key. > Right, will happen in the next version. Jarno
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev