X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ring%2Frte_ring.h;h=e8493f268738fc8a47487813a6484953b526d2b8;hb=a182620042aa297ba1dc88f3089537d94b51bcf9;hp=775ea790ea1bff32d4f0d53ecc7044b34ca9b62a;hpb=5d8751b83bb9faeeb2730b3e84254b6b7a1648cb;p=dpdk.git diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index 775ea790ea..e8493f2687 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -198,6 +198,22 @@ struct rte_ring { #define __RING_STAT_ADD(r, name, n) do {} while(0) #endif +/** + * Calculate the memory size needed for a ring + * + * This function returns the number of bytes needed for a ring, given + * the number of elements in it. This value is the sum of the size of + * the structure rte_ring and the size of the memory needed by the + * objects pointers. The value is aligned to a cache line size. + * + * @param count + * The number of elements in the ring (must be a power of 2). + * @return + * - The memory size needed for the ring on success. + * - -EINVAL if count is not a power of 2. + */ +ssize_t rte_ring_get_memsize(unsigned count); + /** * Create a new ring named *name* in memory. *