summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJia Yu <jyu@vmware.com>2014-11-07 09:28:09 -0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-12-11 01:42:02 +0100
commit3a52e64742c370bebc465b91f3197d940d5738cd (patch)
treeaddfa35c616455e8b49c3b53404aab9c64c5b3e3
parentff41b5785a1a6ff195852eae14659f95723bd399 (diff)
downloaddpdk-3a52e64742c370bebc465b91f3197d940d5738cd.zip
dpdk-3a52e64742c370bebc465b91f3197d940d5738cd.tar.gz
dpdk-3a52e64742c370bebc465b91f3197d940d5738cd.tar.xz
lib: fix cache alignment of structures
Include rte_memory.h for lib files that use __rte_cache_aligned attribute. Consider the following code: struct per_core_foo { ... } __rte_cache_aligned; struct global_foo { struct per_core_foo foo[RTE_MAX_CORE]; }; If __rte_cache_aligned is not defined (rte_memory.h is not included), the code compiles but the structure is not aligned... it defines the structure and creates a global variable called __rte_cache_aligned. And this can lead to really bad things if this code is in a .h that is included by files that may or may not include rte_memory.h Signed-off-by: Jia Yu <jyu@vmware.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
-rw-r--r--lib/librte_distributor/rte_distributor.c1
-rw-r--r--lib/librte_eal/common/include/rte_malloc_heap.h1
-rw-r--r--lib/librte_ip_frag/rte_ip_frag.h1
-rw-r--r--lib/librte_malloc/malloc_elem.h2
-rw-r--r--lib/librte_mbuf/rte_mbuf.h1
-rw-r--r--lib/librte_port/rte_port_frag.c1
-rw-r--r--lib/librte_table/rte_table_acl.c1
-rw-r--r--lib/librte_table/rte_table_array.c1
-rw-r--r--lib/librte_table/rte_table_hash_ext.c1
-rw-r--r--lib/librte_table/rte_table_hash_key16.c1
-rw-r--r--lib/librte_table/rte_table_hash_key32.c1
-rw-r--r--lib/librte_table/rte_table_hash_key8.c1
-rw-r--r--lib/librte_table/rte_table_hash_lru.c1
-rw-r--r--lib/librte_table/rte_table_lpm.c1
-rw-r--r--lib/librte_table/rte_table_lpm_ipv6.c1
15 files changed, 16 insertions, 0 deletions
diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index aa2f740..e0fdb4c 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -35,6 +35,7 @@
#include <sys/queue.h>
#include <string.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_errno.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_eal/common/include/rte_malloc_heap.h b/lib/librte_eal/common/include/rte_malloc_heap.h
index f727b7a..716216f 100644
--- a/lib/librte_eal/common/include/rte_malloc_heap.h
+++ b/lib/librte_eal/common/include/rte_malloc_heap.h
@@ -37,6 +37,7 @@
#include <stddef.h>
#include <sys/queue.h>
#include <rte_spinlock.h>
+#include <rte_memory.h>
/* Number of free lists per heap, grouped by size. */
#define RTE_HEAP_NUM_FREELISTS 5
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 230a903..3989a5a 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -46,6 +46,7 @@
#include <rte_malloc.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_ip.h>
#include <rte_byteorder.h>
diff --git a/lib/librte_malloc/malloc_elem.h b/lib/librte_malloc/malloc_elem.h
index 72f22a1..9790b1a 100644
--- a/lib/librte_malloc/malloc_elem.h
+++ b/lib/librte_malloc/malloc_elem.h
@@ -34,6 +34,8 @@
#ifndef MALLOC_ELEM_H_
#define MALLOC_ELEM_H_
+#include <rte_memory.h>
+
/* dummy definition of struct so we can use pointers to it in malloc_elem struct */
struct malloc_heap;
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index efdefc4..16059c6 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -55,6 +55,7 @@
#include <stdint.h>
#include <rte_mempool.h>
+#include <rte_memory.h>
#include <rte_atomic.h>
#include <rte_prefetch.h>
#include <rte_branch_prediction.h>
diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c
index 57d930b..ff0ab9b 100644
--- a/lib/librte_port/rte_port_frag.c
+++ b/lib/librte_port/rte_port_frag.c
@@ -34,6 +34,7 @@
#include <rte_ether.h>
#include <rte_ip_frag.h>
+#include <rte_memory.h>
#include "rte_port_frag.h"
diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c
index 8a6eb0d..4416311 100644
--- a/lib/librte_table/rte_table_acl.c
+++ b/lib/librte_table/rte_table_acl.c
@@ -36,6 +36,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_array.c b/lib/librte_table/rte_table_array.c
index 4d3c05e..c031070 100644
--- a/lib/librte_table/rte_table_array.c
+++ b/lib/librte_table/rte_table_array.c
@@ -36,6 +36,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c
index f34b56d..66e416b 100644
--- a/lib/librte_table/rte_table_hash_ext.c
+++ b/lib/librte_table/rte_table_hash_ext.c
@@ -36,6 +36,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c
index 9455416..ee5f639 100644
--- a/lib/librte_table/rte_table_hash_key16.c
+++ b/lib/librte_table/rte_table_hash_key16.c
@@ -35,6 +35,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c
index 7e65516..da0ce6a 100644
--- a/lib/librte_table/rte_table_hash_key32.c
+++ b/lib/librte_table/rte_table_hash_key32.c
@@ -35,6 +35,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c
index 4b99dba..443ca7d 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -35,6 +35,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c
index 5460a88..c9a8afd 100644
--- a/lib/librte_table/rte_table_hash_lru.c
+++ b/lib/librte_table/rte_table_hash_lru.c
@@ -36,6 +36,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index cf92619..64c684d 100644
--- a/lib/librte_table/rte_table_lpm.c
+++ b/lib/librte_table/rte_table_lpm.c
@@ -36,6 +36,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_byteorder.h>
#include <rte_log.h>
diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c
index 2818c25..ce4ddc0 100644
--- a/lib/librte_table/rte_table_lpm_ipv6.c
+++ b/lib/librte_table/rte_table_lpm_ipv6.c
@@ -36,6 +36,7 @@
#include <rte_common.h>
#include <rte_mbuf.h>
+#include <rte_memory.h>
#include <rte_malloc.h>
#include <rte_byteorder.h>
#include <rte_log.h>