From: Konstantin Ananyev Date: Mon, 8 Jun 2015 10:41:24 +0000 (+0100) Subject: acl: remove redundant macro X-Git-Tag: spdx-start~9048 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=12c4e86969f92b2de5aade476261edcf3acaf693;p=dpdk.git acl: remove redundant macro Use global RTE_LEN2MASK macro, instead of local LEN2MASK. Signed-off-by: Konstantin Ananyev --- diff --git a/app/test-acl/main.c b/app/test-acl/main.c index 524c43a433..be3d773f4d 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 aee6ed573a..ff3ba8ba46 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 b6ddeebcaf..a54d531ad0 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 3a9373007d..8d9bbe5c9b 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 81fdefbf49..41f7e3d4d1 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