From 4814619bae19d8e8779d0862c1e0b82c200a8d98 Mon Sep 17 00:00:00 2001 From: ashoksingh Date: Thu, 18 Aug 2016 09:58:20 +0530 Subject: [PATCH] Define minimum value for number of flow entries to be audited per iteration When the flow table size is less than 1800, the audit_yield_ value computed can become 0, which will result in assert. Change-Id: Iec7d55996b114641b1505cc0e29f3d6bca65be63 Closes-Bug: #1614359 --- src/vnsw/agent/vrouter/ksync/ksync_flow_memory.cc | 2 ++ src/vnsw/agent/vrouter/ksync/ksync_flow_memory.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.cc b/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.cc index 87e658afde0..3a8fbe47ad8 100644 --- a/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.cc +++ b/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.cc @@ -77,6 +77,8 @@ void KSyncFlowMemory::Init() { audit_yield_ = flow_table_count / timer_per_sweep; if (audit_yield_ > kAuditYieldMax) audit_yield_ = kAuditYieldMax; + if (audit_yield_ < kAuditYieldMin) + audit_yield_ = kAuditYieldMin; audit_timer_->Start(audit_interval_, boost::bind(&KSyncFlowMemory::AuditProcess, this)); diff --git a/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.h b/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.h index fe172d90b67..3d8c600b988 100644 --- a/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.h +++ b/src/vnsw/agent/vrouter/ksync/ksync_flow_memory.h @@ -26,6 +26,8 @@ class KSyncFlowMemory { static const uint32_t kAuditTimeout = (5 * 1000 * 1000); // in usec // Upper limit on number of entries to visit per timer static const uint32_t kAuditYieldMax = (1024); + // Lower limit on number of entries to visit per timer + static const uint32_t kAuditYieldMin = (100); KSyncFlowMemory(KSync *ksync); ~KSyncFlowMemory();