From: Jia Yu Date: Fri, 7 Nov 2014 17:28:09 +0000 (-0800) Subject: lib: fix cache alignment of structures X-Git-Tag: spdx-start~9964 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3a52e64742c370bebc465b91f3197d940d5738cd;p=dpdk.git 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 Acked-by: Thomas Monjalon --- diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index aa2f740af3..e0fdb4c1db 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/librte_eal/common/include/rte_malloc_heap.h b/lib/librte_eal/common/include/rte_malloc_heap.h index f727b7a8b8..716216f253 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 #include #include +#include /* 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 230a903791..3989a5a819 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -46,6 +46,7 @@ #include #include +#include #include #include diff --git a/lib/librte_malloc/malloc_elem.h b/lib/librte_malloc/malloc_elem.h index 72f22a101d..9790b1a09e 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 + /* 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 efdefc43e6..16059c66ff 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -55,6 +55,7 @@ #include #include +#include #include #include #include diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c index 57d930be74..ff0ab9b808 100644 --- a/lib/librte_port/rte_port_frag.c +++ b/lib/librte_port/rte_port_frag.c @@ -34,6 +34,7 @@ #include #include +#include #include "rte_port_frag.h" diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c index 8a6eb0d7a6..4416311b9a 100644 --- a/lib/librte_table/rte_table_acl.c +++ b/lib/librte_table/rte_table_acl.c @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/lib/librte_table/rte_table_array.c b/lib/librte_table/rte_table_array.c index 4d3c05eeca..c0310700f9 100644 --- a/lib/librte_table/rte_table_array.c +++ b/lib/librte_table/rte_table_array.c @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c index f34b56d6e1..66e416bb31 100644 --- a/lib/librte_table/rte_table_hash_ext.c +++ b/lib/librte_table/rte_table_hash_ext.c @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index 94554168c5..ee5f639b8e 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -35,6 +35,7 @@ #include #include +#include #include #include diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c index 7e65516afd..da0ce6af9f 100644 --- a/lib/librte_table/rte_table_hash_key32.c +++ b/lib/librte_table/rte_table_hash_key32.c @@ -35,6 +35,7 @@ #include #include +#include #include #include diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c index 4b99dba2d9..443ca7da77 100644 --- a/lib/librte_table/rte_table_hash_key8.c +++ b/lib/librte_table/rte_table_hash_key8.c @@ -35,6 +35,7 @@ #include #include +#include #include #include diff --git a/lib/librte_table/rte_table_hash_lru.c b/lib/librte_table/rte_table_hash_lru.c index 5460a880cf..c9a8afd7d4 100644 --- a/lib/librte_table/rte_table_hash_lru.c +++ b/lib/librte_table/rte_table_hash_lru.c @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c index cf9261941c..64c684d03f 100644 --- a/lib/librte_table/rte_table_lpm.c +++ b/lib/librte_table/rte_table_lpm.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c index 2818c25818..ce4ddc0b04 100644 --- a/lib/librte_table/rte_table_lpm_ipv6.c +++ b/lib/librte_table/rte_table_lpm_ipv6.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include