ring: store memzone pointer

Add a new field to the rte_ring structure to store the memzone pointer which
contains the ring. For rings created using rte_ring_create(), the field will
be set automatically.

This new field will allow users of the ring to query the numa node a ring is
allocated on, or to get the physical address of the ring, if so needed.

The rte_ring structure will also maintain ABI compatibility, as the
structure members, after the new one, are set to be cache line aligned,
so leaving a space.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
Bruce Richardson 2015-09-30 13:12:20 +01:00 committed by Thomas Monjalon
parent 651c505af8
commit 4768c47500
2 changed files with 5 additions and 0 deletions

View File

@ -196,6 +196,7 @@ rte_ring_create(const char *name, unsigned count, int socket_id,
rte_ring_init(r, name, count, flags);
te->data = (void *) r;
r->memzone = mz;
TAILQ_INSERT_TAIL(ring_list, te, next);
} else {

View File

@ -134,6 +134,8 @@ struct rte_ring_debug_stats {
* if RTE_RING_PAUSE_REP not defined. */
#endif
struct rte_memzone; /* forward declaration, so as not to require memzone.h */
/**
* An RTE ring structure.
*
@ -147,6 +149,8 @@ struct rte_ring_debug_stats {
struct rte_ring {
char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */
int flags; /**< Flags supplied at creation. */
const struct rte_memzone *memzone;
/**< Memzone, if any, containing the rte_ring */
/** Ring producer status. */
struct prod {