DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/3] Add RTE_ prefix to CACHE_LINE_ROUNDUP macro
Date: Wed, 19 Nov 2014 12:26:08 +0000	[thread overview]
Message-ID: <1416399968-348-4-git-send-email-sergio.gonzalez.monroy@intel.com> (raw)
In-Reply-To: <1416399968-348-1-git-send-email-sergio.gonzalez.monroy@intel.com>

Adding RTE_ for consistency with other renamed macros and to avoid
potential conflicts.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
 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;
 
-- 
2.1.0

  parent reply	other threads:[~2014-11-19 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 12:26 [dpdk-dev] [PATCH 0/3] Add RTE_ prefix to CACHE_LINE related macros Sergio Gonzalez Monroy
2014-11-19 12:26 ` [dpdk-dev] [PATCH 1/3] Add RTE_ prefix to CACHE_LINE_SIZE macro Sergio Gonzalez Monroy
2014-11-19 12:26 ` [dpdk-dev] [PATCH 2/3] Add RTE_ prefix to CACHE_LINE_MASK macro Sergio Gonzalez Monroy
2014-11-19 12:26 ` Sergio Gonzalez Monroy [this message]
2014-11-27 13:58 ` [dpdk-dev] [PATCH 0/3] Add RTE_ prefix to CACHE_LINE related macros Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416399968-348-4-git-send-email-sergio.gonzalez.monroy@intel.com \
    --to=sergio.gonzalez.monroy@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).