ring: add a function to return the ring size

Applications and other libraries should not be reading inside the
rte_ring structure directly to get the ring size. Instead add a fn
to allow it to be queried.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Bruce Richardson 2017-02-23 16:42:00 +00:00 committed by Thomas Monjalon
parent 40f1806e23
commit 03437f2947

View File

@ -1107,6 +1107,20 @@ rte_ring_free_count(const struct rte_ring *r)
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
*