From patchwork Wed Nov 19 12:26:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Gonzalez Monroy X-Patchwork-Id: 1346 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 014B57F68; Wed, 19 Nov 2014 13:15:50 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 61DF57EB0 for ; Wed, 19 Nov 2014 13:15:46 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 19 Nov 2014 04:26:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,416,1413270000"; d="scan'208";a="624837294" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 19 Nov 2014 04:26:09 -0800 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 sAJCQ8VW008254 for ; Wed, 19 Nov 2014 12:26:09 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id sAJCQ8Y3000407 for ; Wed, 19 Nov 2014 12:26:08 GMT Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id sAJCQ8tU000403 for dev@dpdk.org; Wed, 19 Nov 2014 12:26:08 GMT From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Wed, 19 Nov 2014 12:26:08 +0000 Message-Id: <1416399968-348-4-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1416399968-348-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1416399968-348-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH 3/3] Add RTE_ prefix to CACHE_LINE_ROUNDUP 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding RTE_ for consistency with other renamed macros and to avoid potential conflicts. Signed-off-by: Sergio Gonzalez Monroy --- app/test-pmd/testpmd.c | 2 +- lib/librte_eal/common/include/rte_memory.h | 2 +- lib/librte_malloc/malloc_heap.c | 4 ++-- lib/librte_malloc/rte_malloc.c | 2 +- lib/librte_sched/rte_sched.c | 14 +++++++------- lib/librte_table/rte_table_acl.c | 6 +++--- lib/librte_table/rte_table_hash_ext.c | 14 +++++++------- lib/librte_table/rte_table_hash_lru.c | 10 +++++----- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 5f96899..7552bf9 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -444,7 +444,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, mbp_ctor_arg.seg_buf_size = (uint16_t) (RTE_PKTMBUF_HEADROOM + mbuf_seg_size); mb_ctor_arg.seg_buf_offset = - (uint16_t) CACHE_LINE_ROUNDUP(sizeof(struct rte_mbuf)); + (uint16_t) RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_mbuf)); mb_ctor_arg.seg_buf_size = mbp_ctor_arg.seg_buf_size; mb_size = mb_ctor_arg.seg_buf_offset + mb_ctor_arg.seg_buf_size; mbuf_poolname_build(socket_id, pool_name, sizeof(pool_name)); diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h index ab20c4b..05e55b9 100644 --- a/lib/librte_eal/common/include/rte_memory.h +++ b/lib/librte_eal/common/include/rte_memory.h @@ -64,7 +64,7 @@ enum rte_page_sizes { #endif #define RTE_CACHE_LINE_MASK (RTE_CACHE_LINE_SIZE-1) /**< Cache line mask. */ -#define CACHE_LINE_ROUNDUP(size) \ +#define RTE_CACHE_LINE_ROUNDUP(size) \ (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE)) /**< Return the first cache-aligned value greater or equal to size. */ diff --git a/lib/librte_malloc/malloc_heap.c b/lib/librte_malloc/malloc_heap.c index a1d0ebb..95fcfec 100644 --- a/lib/librte_malloc/malloc_heap.c +++ b/lib/librte_malloc/malloc_heap.c @@ -155,8 +155,8 @@ void * malloc_heap_alloc(struct malloc_heap *heap, const char *type __attribute__((unused)), size_t size, unsigned align) { - size = CACHE_LINE_ROUNDUP(size); - align = CACHE_LINE_ROUNDUP(align); + size = RTE_CACHE_LINE_ROUNDUP(size); + align = RTE_CACHE_LINE_ROUNDUP(align); rte_spinlock_lock(&heap->lock); struct malloc_elem *elem = find_suitable_element(heap, size, align); if (elem == NULL){ diff --git a/lib/librte_malloc/rte_malloc.c b/lib/librte_malloc/rte_malloc.c index ee36357..b966fc7 100644 --- a/lib/librte_malloc/rte_malloc.c +++ b/lib/librte_malloc/rte_malloc.c @@ -169,7 +169,7 @@ rte_realloc(void *ptr, size_t size, unsigned align) if (elem == NULL) rte_panic("Fatal error: memory corruption detected\n"); - size = CACHE_LINE_ROUNDUP(size), align = CACHE_LINE_ROUNDUP(align); + size = RTE_CACHE_LINE_ROUNDUP(size), align = RTE_CACHE_LINE_ROUNDUP(align); /* check alignment matches first, and if ok, see if we can resize block */ if (RTE_PTR_ALIGN(ptr,align) == ptr && malloc_elem_resize(elem, size) == 0) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 1447a27..95dee27 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -417,25 +417,25 @@ rte_sched_port_get_array_base(struct rte_sched_port_params *params, enum rte_sch base = 0; if (array == e_RTE_SCHED_PORT_ARRAY_SUBPORT) return base; - base += CACHE_LINE_ROUNDUP(size_subport); + base += RTE_CACHE_LINE_ROUNDUP(size_subport); if (array == e_RTE_SCHED_PORT_ARRAY_PIPE) return base; - base += CACHE_LINE_ROUNDUP(size_pipe); + base += RTE_CACHE_LINE_ROUNDUP(size_pipe); if (array == e_RTE_SCHED_PORT_ARRAY_QUEUE) return base; - base += CACHE_LINE_ROUNDUP(size_queue); + base += RTE_CACHE_LINE_ROUNDUP(size_queue); if (array == e_RTE_SCHED_PORT_ARRAY_QUEUE_EXTRA) return base; - base += CACHE_LINE_ROUNDUP(size_queue_extra); + base += RTE_CACHE_LINE_ROUNDUP(size_queue_extra); if (array == e_RTE_SCHED_PORT_ARRAY_PIPE_PROFILES) return base; - base += CACHE_LINE_ROUNDUP(size_pipe_profiles); + base += RTE_CACHE_LINE_ROUNDUP(size_pipe_profiles); if (array == e_RTE_SCHED_PORT_ARRAY_BMP_ARRAY) return base; - base += CACHE_LINE_ROUNDUP(size_bmp_array); + base += RTE_CACHE_LINE_ROUNDUP(size_bmp_array); if (array == e_RTE_SCHED_PORT_ARRAY_QUEUE_ARRAY) return base; - base += CACHE_LINE_ROUNDUP(size_queue_array); + base += RTE_CACHE_LINE_ROUNDUP(size_queue_array); return base; } diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c index ed0aae8..8a6eb0d 100644 --- a/lib/librte_table/rte_table_acl.c +++ b/lib/librte_table/rte_table_acl.c @@ -102,10 +102,10 @@ rte_table_acl_create( entry_size = RTE_ALIGN(entry_size, sizeof(uint64_t)); /* Memory allocation */ - action_table_size = CACHE_LINE_ROUNDUP(p->n_rules * entry_size); + action_table_size = RTE_CACHE_LINE_ROUNDUP(p->n_rules * entry_size); acl_rule_list_size = - CACHE_LINE_ROUNDUP(p->n_rules * sizeof(struct rte_acl_rule *)); - acl_rule_memory_size = CACHE_LINE_ROUNDUP(p->n_rules * + RTE_CACHE_LINE_ROUNDUP(p->n_rules * sizeof(struct rte_acl_rule *)); + acl_rule_memory_size = RTE_CACHE_LINE_ROUNDUP(p->n_rules * RTE_ACL_RULE_SZ(p->n_rule_fields)); total_size = sizeof(struct rte_table_acl) + action_table_size + acl_rule_list_size + acl_rule_memory_size; diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c index 638c2cd..68cb957 100644 --- a/lib/librte_table/rte_table_hash_ext.c +++ b/lib/librte_table/rte_table_hash_ext.c @@ -185,15 +185,15 @@ rte_table_hash_ext_create(void *params, int socket_id, uint32_t entry_size) return NULL; /* Memory allocation */ - table_meta_sz = CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash)); - bucket_sz = CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket)); + table_meta_sz = RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash)); + bucket_sz = RTE_CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket)); bucket_ext_sz = - CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(struct bucket)); - key_sz = CACHE_LINE_ROUNDUP(p->n_keys * p->key_size); - key_stack_sz = CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t)); + RTE_CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(struct bucket)); + key_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * p->key_size); + key_stack_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t)); bkt_ext_stack_sz = - CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(uint32_t)); - data_sz = CACHE_LINE_ROUNDUP(p->n_keys * entry_size); + RTE_CACHE_LINE_ROUNDUP(p->n_buckets_ext * sizeof(uint32_t)); + data_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * entry_size); total_size = table_meta_sz + bucket_sz + bucket_ext_sz + key_sz + key_stack_sz + bkt_ext_stack_sz + data_sz; diff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c index cea7a92..a7fa03c 100644 --- a/lib/librte_table/rte_table_hash_lru.c +++ b/lib/librte_table/rte_table_hash_lru.c @@ -161,11 +161,11 @@ rte_table_hash_lru_create(void *params, int socket_id, uint32_t entry_size) } /* Memory allocation */ - table_meta_sz = CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash)); - bucket_sz = CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket)); - key_sz = CACHE_LINE_ROUNDUP(p->n_keys * p->key_size); - key_stack_sz = CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t)); - data_sz = CACHE_LINE_ROUNDUP(p->n_keys * entry_size); + table_meta_sz = RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_table_hash)); + bucket_sz = RTE_CACHE_LINE_ROUNDUP(p->n_buckets * sizeof(struct bucket)); + key_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * p->key_size); + key_stack_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * sizeof(uint32_t)); + data_sz = RTE_CACHE_LINE_ROUNDUP(p->n_keys * entry_size); total_size = table_meta_sz + bucket_sz + key_sz + key_stack_sz + data_sz;