git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ring: remove split cacheline build setting
[dpdk.git]
/
lib
/
librte_ring
/
rte_ring.h
diff --git
a/lib/librte_ring/rte_ring.h
b/lib/librte_ring/rte_ring.h
index
0e22e69
..
399ae3b
100644
(file)
--- a/
lib/librte_ring/rte_ring.h
+++ b/
lib/librte_ring/rte_ring.h
@@
-106,7
+106,7
@@
extern "C" {
enum rte_ring_queue_behavior {
RTE_RING_QUEUE_FIXED = 0, /* Enq/Deq a fixed number of items from a ring */
enum rte_ring_queue_behavior {
RTE_RING_QUEUE_FIXED = 0, /* Enq/Deq a fixed number of items from a ring */
- RTE_RING_QUEUE_VARIABLE /* Enq/Deq as many items a possible from ring */
+ RTE_RING_QUEUE_VARIABLE /* Enq/Deq as many items a
s
possible from ring */
};
#ifdef RTE_LIBRTE_RING_DEBUG
};
#ifdef RTE_LIBRTE_RING_DEBUG
@@
-139,6
+139,14
@@
struct rte_ring_debug_stats {
struct rte_memzone; /* forward declaration, so as not to require memzone.h */
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
+
/**
* An RTE ring structure.
*
/**
* An RTE ring structure.
*
@@
-168,7
+176,7
@@
struct rte_ring {
uint32_t mask; /**< Mask (size-1) of ring. */
volatile uint32_t head; /**< Producer head. */
volatile uint32_t tail; /**< Producer tail. */
uint32_t mask; /**< Mask (size-1) of ring. */
volatile uint32_t head; /**< Producer head. */
volatile uint32_t tail; /**< Producer tail. */
- } prod __rte_
cache_aligned
;
+ } prod __rte_
aligned(PROD_ALIGN)
;
/** Ring consumer status. */
struct cons {
/** Ring consumer status. */
struct cons {
@@
-177,17
+185,13
@@
struct rte_ring {
uint32_t mask; /**< Mask (size-1) of ring. */
volatile uint32_t head; /**< Consumer head. */
volatile uint32_t tail; /**< Consumer tail. */
uint32_t mask; /**< Mask (size-1) of ring. */
volatile uint32_t head; /**< Consumer head. */
volatile uint32_t tail; /**< Consumer tail. */
-#ifdef RTE_RING_SPLIT_PROD_CONS
- } cons __rte_cache_aligned;
-#else
- } cons;
-#endif
+ } cons __rte_aligned(CONS_ALIGN);
#ifdef RTE_LIBRTE_RING_DEBUG
struct rte_ring_debug_stats stats[RTE_MAX_LCORE];
#endif
#ifdef RTE_LIBRTE_RING_DEBUG
struct rte_ring_debug_stats stats[RTE_MAX_LCORE];
#endif
- void *
ring[0] __rte_cache_aligned;
/**< Memory space of ring starts here.
+ void *
ring[] __rte_cache_aligned;
/**< Memory space of ring starts here.
* not volatile so need to be careful
* about compiler re-ordering */
};
* not volatile so need to be careful
* about compiler re-ordering */
};
@@
-341,7
+345,7
@@
void rte_ring_free(struct rte_ring *r);
int rte_ring_set_water_mark(struct rte_ring *r, unsigned count);
/**
int rte_ring_set_water_mark(struct rte_ring *r, unsigned count);
/**
- * Dump the status of the ring to
the conso
le.
+ * Dump the status of the ring to
a fi
le.
*
* @param f
* A pointer to a file for output
*
* @param f
* A pointer to a file for output
@@
-1107,6
+1111,20
@@
rte_ring_free_count(const struct rte_ring *r)
return (cons_tail - prod_tail - 1) & r->prod.mask;
}
return (cons_tail - prod_tail - 1) & r->prod.mask;
}
+/**
+ * Return the size of the ring.
+ *
+ * @param r
+ * A pointer to the ring structure.
+ * @return
+ * The number of elements which can be stored in the ring.
+ */
+static inline unsigned int
+rte_ring_get_size(const struct rte_ring *r)
+{
+ return r->prod.size;
+}
+
/**
* Dump the status of all rings on the console
*
/**
* Dump the status of all rings on the console
*