From patchwork Thu Sep 17 23:04:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 519066 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 0A4AF14027C for ; Fri, 18 Sep 2015 09:04:57 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id DC32522C3D8; Thu, 17 Sep 2015 16:04:44 -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 8E73422C3D8 for ; Thu, 17 Sep 2015 16:04:43 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id 979C5618DD5 for ; Thu, 17 Sep 2015 17:04:40 -0600 (MDT) X-ASG-Debug-ID: 1442531080-03dc2140190a5c0001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar4.cudamail.com with ESMTP id ylIgxwiNAsAEFdNi (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 17 Sep 2015 17:04:40 -0600 (MDT) X-Barracuda-Envelope-From: joestringer@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mail-pa0-f52.google.com) (209.85.220.52) by mx3-pf3.cudamail.com with ESMTPS (RC4-SHA encrypted); 17 Sep 2015 23:04:39 -0000 Received-SPF: unknown (mx3-pf3.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.52 Received: by pacfv12 with SMTP id fv12so32045789pac.2 for ; Thu, 17 Sep 2015 16:04:39 -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=c0pvNska9CLWOgDIQsZ/0wa9C7myATThPoM6+HrwCVM=; b=bwclEr07cIFlyN+tBXXDnkXeYHk6FdhY4UFx2HJO5wUM7h8UfZu8qXL4tWMlUTJjpJ YF0bQqkTFPPXR7dNeMDaN4jN9H2gdoDYPycmai5JLSkjSq6kJD5YARSDq0+ils83Uq3/ GcCD9gvwPbtsHP0m5ptwDMrlJ3fz6lrHSuML6r0OXaWJ2Wia/r4Rs+h1FfCfSDof8V/5 j+W6NN1Tpv1y4Q4p+GJe8pk0W/wKmUvF37VzfIaVkfsiPrJUiwXw95BmPcLHcV62/IB1 ddnd8xSZFy7xtprvulucjx0J7jYeVVyGdj0SHj6F3gDZeRf2VhPoSCzGzHaFi5GB/wzP ArVg== X-Gm-Message-State: ALoCoQkW2B0YCkDtaRfORLMd1fAfLgo7KdEfgUDSdg2par9BdOuOqKc3dYjH4+5sPB9iKYEnkCV6 X-Received: by 10.68.166.97 with SMTP id zf1mr3370537pbb.72.1442531079676; Thu, 17 Sep 2015 16:04:39 -0700 (PDT) Received: from localhost.localdomain ([208.91.2.4]) by smtp.gmail.com with ESMTPSA id zk9sm5336003pac.7.2015.09.17.16.04.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Sep 2015 16:04:38 -0700 (PDT) X-CudaMail-Envelope-Sender: joestringer@nicira.com X-Barracuda-Apparent-Source-IP: 208.91.2.4 From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-916068161 X-CudaMail-DTE: 091715 X-CudaMail-Originating-IP: 209.85.220.52 Date: Thu, 17 Sep 2015 16:04:25 -0700 X-ASG-Orig-Subj: [##CM-V3-916068161##][PATCHv2 3/6] lib: Introduce ovs_u128_is_zero(). Message-Id: <1442531068-41423-4-git-send-email-joestringer@nicira.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442531068-41423-1-git-send-email-joestringer@nicira.com> References: <1442531068-41423-1-git-send-email-joestringer@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1442531080 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] [PATCHv2 3/6] lib: Introduce ovs_u128_is_zero(). 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" From: Daniele Di Proietto is_all_zeros() is quite slow for u128 initialization because: - It is not inlined - It checks byte by byte This commit introduces a new function to perform this function, which improves performance in the DPDK packet processing path for upcoming commits that regularly check u128 values. Signed-off-by: Joe Stringer Acked-by: Jarno Rajahalme Acked-by: Ben Pfaff --- lib/util.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/util.h b/lib/util.h index 7080a0c..eebc6e9 100644 --- a/lib/util.h +++ b/lib/util.h @@ -568,6 +568,13 @@ ovs_u128_equals(const ovs_u128 *a, const ovs_u128 *b) return (a->u64.hi == b->u64.hi) && (a->u64.lo == b->u64.lo); } +/* Returns true if 'val' is 0. */ +static inline bool +ovs_u128_is_zero(const ovs_u128 *val) +{ + return !(val->u64.hi || val->u64.lo); +} + void xsleep(unsigned int seconds); #ifdef _WIN32