From patchwork Mon Jun 8 10:41:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ananyev, Konstantin" X-Patchwork-Id: 5283 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 1B9135A92; Mon, 8 Jun 2015 12:43:58 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 106C42716 for ; Mon, 8 Jun 2015 12:43:53 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 08 Jun 2015 03:41:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,573,1427785200"; d="scan'208";a="742911384" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 08 Jun 2015 03:41:37 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t58Afb7w029632; Mon, 8 Jun 2015 11:41:37 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t58Afakp017558; Mon, 8 Jun 2015 11:41:36 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id t58Afals017554; Mon, 8 Jun 2015 11:41:36 +0100 From: Konstantin Ananyev To: dev@dpdk.org Date: Mon, 8 Jun 2015 11:41:24 +0100 Message-Id: <1433760090-17110-3-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433760090-17110-1-git-send-email-konstantin.ananyev@intel.com> References: <1433373024-5558-2-git-send-email-konstantin.ananyev@intel.com> <1433760090-17110-1-git-send-email-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCHv2 2/8] acl: code cleanup - use global EAL macro, instead of creating a local copy X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" use global RTE_LEN2MASK macro, instead of LEN2MASK. Signed-off-by: Konstantin Ananyev --- app/test-acl/main.c | 3 ++- lib/librte_acl/acl_bld.c | 3 ++- lib/librte_acl/rte_acl.c | 3 ++- lib/librte_acl/rte_acl.h | 2 +- lib/librte_acl/rte_acl_osdep.h | 2 -- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/test-acl/main.c b/app/test-acl/main.c index 524c43a..be3d773 100644 --- a/app/test-acl/main.c +++ b/app/test-acl/main.c @@ -739,7 +739,8 @@ add_cb_rules(FILE *f, struct rte_acl_ctx *ctx) return rc; } - v.data.category_mask = LEN2MASK(RTE_ACL_MAX_CATEGORIES); + v.data.category_mask = RTE_LEN2MASK(RTE_ACL_MAX_CATEGORIES, + typeof(v.data.category_mask)); v.data.priority = RTE_ACL_MAX_PRIORITY - n; v.data.userdata = n; diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c index aee6ed5..ff3ba8b 100644 --- a/lib/librte_acl/acl_bld.c +++ b/lib/librte_acl/acl_bld.c @@ -1772,7 +1772,8 @@ acl_bld(struct acl_build_context *bcx, struct rte_acl_ctx *ctx, bcx->pool.alignment = ACL_POOL_ALIGN; bcx->pool.min_alloc = ACL_POOL_ALLOC_MIN; bcx->cfg = *cfg; - bcx->category_mask = LEN2MASK(bcx->cfg.num_categories); + bcx->category_mask = RTE_LEN2MASK(bcx->cfg.num_categories, + typeof(bcx->category_mask)); bcx->node_max = node_max; rc = sigsetjmp(bcx->pool.fail, 0); diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c index b6ddeeb..a54d531 100644 --- a/lib/librte_acl/rte_acl.c +++ b/lib/librte_acl/rte_acl.c @@ -271,7 +271,8 @@ acl_add_rules(struct rte_acl_ctx *ctx, const void *rules, uint32_t num) static int acl_check_rule(const struct rte_acl_rule_data *rd) { - if ((rd->category_mask & LEN2MASK(RTE_ACL_MAX_CATEGORIES)) == 0 || + if ((RTE_LEN2MASK(RTE_ACL_MAX_CATEGORIES, typeof(rd->category_mask)) & + rd->category_mask) == 0 || rd->priority > RTE_ACL_MAX_PRIORITY || rd->priority < RTE_ACL_MIN_PRIORITY || rd->userdata == RTE_ACL_INVALID_USERDATA) diff --git a/lib/librte_acl/rte_acl.h b/lib/librte_acl/rte_acl.h index 3a93730..8d9bbe5 100644 --- a/lib/librte_acl/rte_acl.h +++ b/lib/librte_acl/rte_acl.h @@ -115,7 +115,7 @@ struct rte_acl_field { enum { RTE_ACL_TYPE_SHIFT = 29, - RTE_ACL_MAX_INDEX = LEN2MASK(RTE_ACL_TYPE_SHIFT), + RTE_ACL_MAX_INDEX = RTE_LEN2MASK(RTE_ACL_TYPE_SHIFT, uint32_t), RTE_ACL_MAX_PRIORITY = RTE_ACL_MAX_INDEX, RTE_ACL_MIN_PRIORITY = 0, }; diff --git a/lib/librte_acl/rte_acl_osdep.h b/lib/librte_acl/rte_acl_osdep.h index 81fdefb..41f7e3d 100644 --- a/lib/librte_acl/rte_acl_osdep.h +++ b/lib/librte_acl/rte_acl_osdep.h @@ -56,8 +56,6 @@ * Common defines. */ -#define LEN2MASK(ln) ((uint32_t)(((uint64_t)1 << (ln)) - 1)) - #define DIM(x) RTE_DIM(x) #include