diff mbox

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

Message ID 1481863290-29624-1-git-send-email-daniely@vmware.com
State Changes Requested
Headers show

Commit Message

Daniel Benli Ye Dec. 16, 2016, 4:41 a.m. UTC
When sampling field is 0, no need to generate sample or
the inner action.
---
 ofproto/ofproto-dpif-xlate.c | 5 +++++
 vswitchd/vswitch.ovsschema   | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Ben Pfaff Dec. 22, 2016, 4:49 p.m. UTC | #1
On Thu, Dec 15, 2016 at 08:41:29PM -0800, Benli Ye wrote:
> When sampling field is 0, no need to generate sample or
> the inner action.

Thanks for the patch.

The change to compose_sample_action() makes sense to me.

I don't think that we should change the database schema because the
benefit of the change is minimal but it carries the risk of breaking a
few users' configurations.

Can you repost with a Signed-off-by?

Thanks,

Ben.
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index d0f9a33..840062b 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2479,6 +2479,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);
 
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index b04d360..87e00fc 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@ 
 {"name": "Open_vSwitch",
  "version": "7.14.0",
- "cksum": "3374030633 22987",
+ "cksum": "4010240282 23110",
  "tables": {
    "Open_vSwitch": {
      "columns": {
@@ -453,7 +453,10 @@ 
        "targets": {
          "type": {"key": "string", "min": 1, "max": "unlimited"}},
        "sampling": {
-         "type": {"key": "integer", "min": 0, "max": 1}},
+         "type": {"key": {"type": "integer",
+                          "minInteger": 1,
+                          "maxInteger": 4294967295},
+                  "min": 0, "max": 1}},
        "polling": {
          "type": {"key": "integer", "min": 0, "max": 1}},
        "header": {