From: Bruce Richardson Date: Thu, 23 Feb 2017 16:42:00 +0000 (+0000) Subject: ring: add a function to return the ring size X-Git-Tag: spdx-start~4438 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=03437f29474881a557bd8ed4591b1f0bd238d849;p=dpdk.git 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 Acked-by: Olivier Matz --- diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index e359affc5b..72ccca5874 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -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 *