X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=blobdiff_plain;f=lib%2Flibrte_mempool%2Frte_mempool.h;h=fb7052e1452313f801d526c826201250e2b29933;hp=c8a81e2da7dc207af19e5350bbabaf787e2e10e0;hb=a0fd91cefcc054b770dec6d8fb60db0d3145c45a;hpb=43ea4004944404388c033055b130b53e8ba03806 diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index c8a81e2da7..fb7052e145 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -1498,9 +1498,41 @@ rte_mempool_get(struct rte_mempool *mp, void **obj_p) * @return * The number of entries in the mempool. */ +unsigned int rte_mempool_avail_count(const struct rte_mempool *mp); + +/** + * @deprecated + * Return the number of entries in the mempool. + * + * When cache is enabled, this function has to browse the length of + * all lcores, so it should not be used in a data path, but only for + * debug purposes. + * + * @param mp + * A pointer to the mempool structure. + * @return + * The number of entries in the mempool. + */ +__rte_deprecated unsigned rte_mempool_count(const struct rte_mempool *mp); /** + * Return the number of elements which have been allocated from the mempool + * + * When cache is enabled, this function has to browse the length of + * all lcores, so it should not be used in a data path, but only for + * debug purposes. + * + * @param mp + * A pointer to the mempool structure. + * @return + * The number of free entries in the mempool. + */ +unsigned int +rte_mempool_in_use_count(const struct rte_mempool *mp); + +/** + * @deprecated * Return the number of free entries in the mempool ring. * i.e. how many entries can be freed back to the mempool. * @@ -1517,10 +1549,11 @@ unsigned rte_mempool_count(const struct rte_mempool *mp); * @return * The number of free entries in the mempool. */ +__rte_deprecated static inline unsigned rte_mempool_free_count(const struct rte_mempool *mp) { - return mp->size - rte_mempool_count(mp); + return rte_mempool_in_use_count(mp); } /** @@ -1539,7 +1572,7 @@ rte_mempool_free_count(const struct rte_mempool *mp) static inline int rte_mempool_full(const struct rte_mempool *mp) { - return !!(rte_mempool_count(mp) == mp->size); + return !!(rte_mempool_avail_count(mp) == mp->size); } /** @@ -1558,7 +1591,7 @@ rte_mempool_full(const struct rte_mempool *mp) static inline int rte_mempool_empty(const struct rte_mempool *mp) { - return !!(rte_mempool_count(mp) == 0); + return !!(rte_mempool_avail_count(mp) == 0); } /**