ring: relax alignment constraint on ring structure
[dpdk.git] / lib / librte_ring / rte_ring.h
index 253cdc9..d3d3f7f 100644 (file)
@@ -62,14 +62,6 @@ enum rte_ring_queue_behavior {
 
 struct rte_memzone; /* forward declaration, so as not to require memzone.h */
 
-#if RTE_CACHE_LINE_SIZE < 128
-#define PROD_ALIGN (RTE_CACHE_LINE_SIZE * 2)
-#define CONS_ALIGN (RTE_CACHE_LINE_SIZE * 2)
-#else
-#define PROD_ALIGN RTE_CACHE_LINE_SIZE
-#define CONS_ALIGN RTE_CACHE_LINE_SIZE
-#endif
-
 /* structure to hold a pair of head/tail values and other metadata */
 struct rte_ring_headtail {
        volatile uint32_t head;  /**< Prod/consumer head. */
@@ -101,11 +93,15 @@ struct rte_ring {
        uint32_t mask;           /**< Mask (size-1) of ring. */
        uint32_t capacity;       /**< Usable size of ring */
 
+       char pad0 __rte_cache_aligned; /**< empty cache line */
+
        /** Ring producer status. */
-       struct rte_ring_headtail prod __rte_aligned(PROD_ALIGN);
+       struct rte_ring_headtail prod __rte_cache_aligned;
+       char pad1 __rte_cache_aligned; /**< empty cache line */
 
        /** Ring consumer status. */
-       struct rte_ring_headtail cons __rte_aligned(CONS_ALIGN);
+       struct rte_ring_headtail cons __rte_cache_aligned;
+       char pad2 __rte_cache_aligned; /**< empty cache line */
 };
 
 #define RING_F_SP_ENQ 0x0001 /**< The default enqueue is "single-producer". */