mempool: rename functions with confusing names
[dpdk.git] / lib / librte_mempool / rte_mempool.h
index c8a81e2..fb7052e 100644 (file)
@@ -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);
 }
 
 /**