From patchwork Fri Sep 11 01:41:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 516522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id E788A140081 for ; Fri, 11 Sep 2015 11:41:44 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 676D710BFC; Thu, 10 Sep 2015 18:41:43 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 7125010BFA for ; Thu, 10 Sep 2015 18:41:42 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id 708D661809A for ; Thu, 10 Sep 2015 19:41:41 -0600 (MDT) X-ASG-Debug-ID: 1441935700-03dc21432f20c60001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar4.cudamail.com with ESMTP id WunGIEFlN2nttW5J (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 10 Sep 2015 19:41:40 -0600 (MDT) X-Barracuda-Envelope-From: joestringer@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mail-pa0-f50.google.com) (209.85.220.50) by mx3-pf1.cudamail.com with ESMTPS (RC4-SHA encrypted); 11 Sep 2015 01:41:40 -0000 Received-SPF: unknown (mx3-pf1.cudamail.com: Multiple SPF records returned) X-Barracuda-Apparent-Source-IP: 209.85.220.50 X-Barracuda-RBL-IP: 209.85.220.50 Received: by padhy16 with SMTP id hy16so59047864pad.1 for ; Thu, 10 Sep 2015 18:41:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=suJIpFSpOG9A/bS2qcCxU4RbrZuffzU3vf8j7lU5xk8=; b=XvE580XVecsRNzaDLVyohZdLlVVCrFtzUmHxUvLwfnuZeH9JtI8i+z8vW7PtiCzd0t 1ztw7va0KKeTZghh+LAaEaD7WKCAEFb7NYlObbs5vFy1oTYZNH/SFobistI6/qm7P4WB ALvLpB+ffe81/LLW5R5iHKFvJrXFE17X2R8Fbj+9VQr5g78jslKm9zGGn6hFaX8//h8b cHQ8kpzLRkOdguu0ytsXQPu0Tg3dXsl+TZVI/B26gCaPKRVjQZAFueVcodr4Mk6Rwutj GH42rF37068f6EEDdylyKtrh+rlXwk4a0bJ/cvj8V8u3L4IlUhQEIL4jFDo4FypZU5iB Ut9A== X-Gm-Message-State: ALoCoQlWERwjnemML7la2IHnmtP58mmbrQ1Kgm65hAAkG2MEncQcpWpwbyEnq2SiZsgkAftJTyWQ X-Received: by 10.69.1.7 with SMTP id bc7mr90655754pbd.154.1441935700241; Thu, 10 Sep 2015 18:41:40 -0700 (PDT) Received: from localhost.localdomain ([208.91.2.4]) by smtp.gmail.com with ESMTPSA id uh10sm14422889pab.41.2015.09.10.18.41.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Sep 2015 18:41:39 -0700 (PDT) X-CudaMail-Envelope-Sender: joestringer@nicira.com From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-909069370 X-CudaMail-DTE: 091015 X-CudaMail-Originating-IP: 209.85.220.50 Date: Thu, 10 Sep 2015 18:41:31 -0700 X-ASG-Orig-Subj: [##CM-V1-909069370##][PATCH 2/3] ipfix: Add bridge_exporter_enabled(). Message-Id: <1441935692-6848-3-git-send-email-joestringer@nicira.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441935692-6848-1-git-send-email-joestringer@nicira.com> References: <1441935692-6848-1-git-send-email-joestringer@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1441935700 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 2/3] ipfix: Add bridge_exporter_enabled(). X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Rather than describing this intention after the fact, encode this meaning in the name of a function. Signed-off-by: Joe Stringer --- ofproto/ofproto-dpif-ipfix.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index b4d3ea0..48ff827 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -1674,6 +1674,12 @@ dpif_ipfix_sample(struct dpif_ipfix_exporter *exporter, ipfix_cache_update(exporter, entry); } +static bool +bridge_exporter_enabled(struct dpif_ipfix *di) +{ + return di->bridge_exporter.probability > 0; +} + void dpif_ipfix_bridge_sample(struct dpif_ipfix *di, const struct dp_packet *packet, const struct flow *flow, @@ -1822,7 +1828,7 @@ dpif_ipfix_run(struct dpif_ipfix *di) OVS_EXCLUDED(mutex) ovs_mutex_lock(&mutex); get_export_time_now(&export_time_usec, &export_time_sec); - if (di->bridge_exporter.probability > 0) { /* Bridge exporter enabled. */ + if (bridge_exporter_enabled(di)) { dpif_ipfix_cache_expire( &di->bridge_exporter.exporter, false, export_time_usec, export_time_sec); @@ -1842,7 +1848,7 @@ dpif_ipfix_wait(struct dpif_ipfix *di) OVS_EXCLUDED(mutex) struct dpif_ipfix_flow_exporter_map_node *flow_exporter_node; ovs_mutex_lock(&mutex); - if (di->bridge_exporter.probability > 0) { /* Bridge exporter enabled. */ + if (bridge_exporter_enabled(di)) { if (ipfix_cache_next_timeout_msec( &di->bridge_exporter.exporter, &next_timeout_msec)) { poll_timer_wait_until(next_timeout_msec);