lib: fix cache alignment of structures
authorJia Yu <jyu@vmware.com>
Fri, 7 Nov 2014 17:28:09 +0000 (09:28 -0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 11 Dec 2014 00:42:02 +0000 (01:42 +0100)
commit3a52e64742c370bebc465b91f3197d940d5738cd
treeaddfa35c616455e8b49c3b53404aab9c64c5b3e3
parentff41b5785a1a6ff195852eae14659f95723bd399
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>
15 files changed:
lib/librte_distributor/rte_distributor.c
lib/librte_eal/common/include/rte_malloc_heap.h
lib/librte_ip_frag/rte_ip_frag.h
lib/librte_malloc/malloc_elem.h
lib/librte_mbuf/rte_mbuf.h
lib/librte_port/rte_port_frag.c
lib/librte_table/rte_table_acl.c
lib/librte_table/rte_table_array.c
lib/librte_table/rte_table_hash_ext.c
lib/librte_table/rte_table_hash_key16.c
lib/librte_table/rte_table_hash_key32.c
lib/librte_table/rte_table_hash_key8.c
lib/librte_table/rte_table_hash_lru.c
lib/librte_table/rte_table_lpm.c
lib/librte_table/rte_table_lpm_ipv6.c