2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ofproto-dpif-xlate: optimize 0% sampling

When sampling field is 0, no need to generate sample or
the inner action.

Signed-off-by: Benli Ye <daniely@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Benli Ye
2016-12-22 21:58:00 -08:00
committed by Ben Pfaff
parent 95f2f97c60
commit b97f2c3a9e

View File

@@ -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);