From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id CAC835A8B for ; Thu, 4 Jun 2015 01:10:32 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 03 Jun 2015 16:10:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,549,1427785200"; d="scan'208";a="704934626" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2015 16:10:28 -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 t53NAQgH006140; Thu, 4 Jun 2015 00:10:26 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t53NAQQ1005752; Thu, 4 Jun 2015 00:10:26 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id t53NAQoY005748; Thu, 4 Jun 2015 00:10:26 +0100 From: Konstantin Ananyev To: dev@dpdk.org Date: Thu, 4 Jun 2015 00:10:18 +0100 Message-Id: <1433373024-5558-3-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433373024-5558-1-git-send-email-konstantin.ananyev@intel.com> References: <1433373024-5558-1-git-send-email-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCH 2/8] ACL: code cleanup - use global RTE_LEN2MASK macro 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: , X-List-Received-Date: Wed, 03 Jun 2015 23:10:33 -0000 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 e2db9bf..19a4178 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 -- 1.8.5.3