[dpdk-dev] [PATCH v5 03/10] eal: add __rte_packed /__rte_aligned macros

Declan Doherty declan.doherty at intel.com
Mon Nov 9 21:34:12 CET 2015


Adding a new marco for specifing __aligned__ attribute, and updating the
current __rte_cache_aligned macro to use it.

Also adding a new macro to specify the __packed__ attribute

Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy at intel.com>
Signed-off-by: Declan Doherty <declan.doherty at intel.com>
---
 lib/librte_eal/common/include/rte_memory.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
index 1bed415..af688ef 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -76,9 +76,19 @@ enum rte_page_sizes {
 /**< Return the first cache-aligned value greater or equal to size. */
 
 /**
+ * Force alignment
+ */
+#define __rte_aligned(a) __attribute__((__aligned__(a)))
+
+/**
  * Force alignment to cache line.
  */
-#define __rte_cache_aligned __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))
+#define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
+
+/**
+ * Force a structure to be packed
+ */
+#define __rte_packed __attribute__((__packed__))
 
 typedef uint64_t phys_addr_t; /**< Physical address definition. */
 #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
-- 
2.4.3



More information about the dev mailing list