From patchwork Fri Feb 15 18:07:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Stillwell Jr, Paul M" X-Patchwork-Id: 50340 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 767AA1B4C8; Fri, 15 Feb 2019 19:07:18 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E4A961B4B7 for ; Fri, 15 Feb 2019 19:07:16 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Feb 2019 10:07:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,373,1544515200"; d="scan'208";a="143823047" Received: from dpdk-srv1.jf.intel.com ([10.166.17.53]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2019 10:07:15 -0800 From: Paul M Stillwell Jr To: qi.z.zhang@intel.com Cc: dev@dpdk.org, Jesse Brandeburg , Paul M Stillwell Jr Date: Fri, 15 Feb 2019 10:07:10 -0800 Message-Id: <1550254030-216363-1-git-send-email-paul.m.stillwell.jr@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH v2] net/ice: faster bit check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jesse Brandeburg Implement a slightly faster bit check, used for checking descriptors in the hot path. Signed-off-by: Jesse Brandeburg Signed-off-by: Paul M Stillwell Jr --- v2: fixed checkpatch issues --- drivers/net/ice/ice_rxtx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index c794ee8..7c82931 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -955,14 +955,13 @@ static inline uint64_t ice_rxd_status_to_pkt_flags(uint64_t qword) { - uint64_t flags; - - /* Check if RSS_HASH */ - flags = (((qword >> ICE_RX_DESC_STATUS_FLTSTAT_S) & - ICE_RX_DESC_FLTSTAT_RSS_HASH) == - ICE_RX_DESC_FLTSTAT_RSS_HASH) ? PKT_RX_RSS_HASH : 0; - - return flags; + static const uint64_t bitcheck = + (ICE_RX_DESC_FLTSTAT_RSS_HASH << ICE_RX_DESC_STATUS_FLTSTAT_S); + /* Check if RSS_HASH */ + if ((qword & bitcheck) == bitcheck) + return PKT_RX_RSS_HASH; + + return 0; } /* Rx L3/L4 checksum */