Skip to content

Commit

Permalink
ofproto-dpif-xlate: optimize 0% sampling
Browse files Browse the repository at this point in the history
When sampling field is 0, no need to generate sample or
the inner action.

Signed-off-by: Benli Ye <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
Benli Ye authored and blp committed Dec 23, 2016
1 parent 95f2f97 commit b97f2c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ofproto/ofproto-dpif-xlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2506,6 +2506,11 @@ compose_sample_action(struct xlate_ctx *ctx,
const odp_port_t tunnel_out_port,
bool include_actions)
{
if (probability == 0) {
/* No need to generate sampling or the inner action. */
return 0;
}

size_t sample_offset = nl_msg_start_nested(ctx->odp_actions,
OVS_ACTION_ATTR_SAMPLE);

Expand Down

0 comments on commit b97f2c3

Please sign in to comment.