diff mbox

[ovs-dev,v2,1/2] sflow: restrict sampling from 1 to UINT32_MAX

Message ID 1482472681-69569-1-git-send-email-daniely@vmware.com
State Accepted
Headers show

Commit Message

Daniel Benli Ye Dec. 23, 2016, 5:58 a.m. UTC
When sampling field is 0, no need to generate sample or
the inner action.

Signed-off-by: Benli Ye <daniely@vmware.com>
---
 ofproto/ofproto-dpif-xlate.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Ben Pfaff Dec. 23, 2016, 5:17 p.m. UTC | #1
On Thu, Dec 22, 2016 at 09:58:00PM -0800, Benli Ye wrote:
> When sampling field is 0, no need to generate sample or
> the inner action.
> 
> Signed-off-by: Benli Ye <daniely@vmware.com>

Thanks for the updated patches.  I applied them to master.

I made some stylistic fixes in patch 2.
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 08a72a7..3eb94ac 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -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);