Re: [net-next sample action optimization v2 4/4] Openvswitch: Refactor sample and recirc actions implementation
From: Pravin Shelar <hidden>
Date: 2017-03-16 19:33:11
On Tue, Mar 14, 2017 at 4:08 PM, Andy Zhou [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Added execute_or_defer_actions() that both sample and recirc action's implementation can use. Signed-off-by: Andy Zhou <redacted> --- net/openvswitch/actions.c | 96 +++++++++++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 37 deletions(-)diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 1638370..fd7d903 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c
...
quoted hunk ↗ jump to hunk
@@ -1286,6 +1262,52 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, return 0; } +static int execute_or_defer_actions(struct datapath *dp, struct sk_buff *skb, + struct sw_flow_key *clone, + struct sw_flow_key *key, + u32 *recirc_id, + const struct nlattr *actions, int len) +{ + struct deferred_action *da; + + /* If within the limit of 'OVS_DEFERRED_ACTION_THRESHOLD', + * recirc immediately, otherwise, defer it for later execution. + */ + if (clone) { + if (recirc_id) { + clone->recirc_id = *recirc_id; + ovs_dp_process_packet(skb, clone); + return 0; + } else { + return do_execute_actions(dp, skb, clone, + actions, len);
the exec_actions_level inc and dec should be moved here, since it is only needed around this function.