net/cxgbe: fix Tx queue stuck with mbuf chain coalescing
[dpdk.git] / lib / mempool / rte_mempool.h
index 2657417..3ada37c 100644 (file)
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <stdint.h>
-#include <errno.h>
 #include <inttypes.h>
 
 #include <rte_config.h>
 #include <rte_spinlock.h>
-#include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_lcore.h>
-#include <rte_memory.h>
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
 #include <rte_memcpy.h>
@@ -116,10 +112,11 @@ struct rte_mempool_objsz {
 /* "MP_<name>" */
 #define        RTE_MEMPOOL_MZ_FORMAT   RTE_MEMPOOL_MZ_PREFIX "%s"
 
-#define        MEMPOOL_PG_SHIFT_MAX    (sizeof(uintptr_t) * CHAR_BIT - 1)
+#define        MEMPOOL_PG_SHIFT_MAX \
+       RTE_DEPRECATED(MEMPOOL_PG_SHIFT_MAX) (sizeof(uintptr_t) * CHAR_BIT - 1)
 
-/** Mempool over one chunk of physically continuous memory */
-#define        MEMPOOL_PG_NUM_DEFAULT  1
+/** Deprecated. Mempool over one chunk of physically continuous memory */
+#define        MEMPOOL_PG_NUM_DEFAULT  RTE_DEPRECATED(MEMPOOL_PG_NUM_DEFAULT) 1
 
 #ifndef RTE_MEMPOOL_ALIGN
 /**
@@ -290,6 +287,15 @@ struct rte_mempool {
 /** Internal: no object from the pool can be used for device IO (DMA). */
 #define RTE_MEMPOOL_F_NON_IO           0x0040
 
+/**
+ * This macro lists all the mempool flags an application may request.
+ */
+#define RTE_MEMPOOL_VALID_USER_FLAGS (RTE_MEMPOOL_F_NO_SPREAD \
+       | RTE_MEMPOOL_F_NO_CACHE_ALIGN \
+       | RTE_MEMPOOL_F_SP_PUT \
+       | RTE_MEMPOOL_F_SC_GET \
+       | RTE_MEMPOOL_F_NO_IOVA_CONTIG \
+       )
 /**
  * @internal When debug is enabled, store some statistics.
  *
@@ -312,17 +318,21 @@ struct rte_mempool {
 #endif
 
 /**
- * Calculate the size of the mempool header.
+ * @internal Calculate the size of the mempool header.
  *
  * @param mp
  *   Pointer to the memory pool.
  * @param cs
  *   Size of the per-lcore cache.
  */
-#define MEMPOOL_HEADER_SIZE(mp, cs) \
+#define RTE_MEMPOOL_HEADER_SIZE(mp, cs) \
        (sizeof(*(mp)) + (((cs) == 0) ? 0 : \
        (sizeof(struct rte_mempool_cache) * RTE_MAX_LCORE)))
 
+/** Deprecated. Use RTE_MEMPOOL_HEADER_SIZE() for internal purposes only. */
+#define MEMPOOL_HEADER_SIZE(mp, cs) \
+       RTE_DEPRECATED(MEMPOOL_HEADER_SIZE) RTE_MEMPOOL_HEADER_SIZE(mp, cs)
+
 /* return the header of a mempool object (internal) */
 static inline struct rte_mempool_objhdr *
 rte_mempool_get_header(void *obj)
@@ -918,12 +928,16 @@ int rte_mempool_register_ops(const struct rte_mempool_ops *ops);
  * Note that the rte_mempool_register_ops fails silently here when
  * more than RTE_MEMPOOL_MAX_OPS_IDX is registered.
  */
-#define MEMPOOL_REGISTER_OPS(ops)                              \
+#define RTE_MEMPOOL_REGISTER_OPS(ops)                          \
        RTE_INIT(mp_hdlr_init_##ops)                            \
        {                                                       \
                rte_mempool_register_ops(&ops);                 \
        }
 
+/** Deprecated. Use RTE_MEMPOOL_REGISTER_OPS() instead. */
+#define MEMPOOL_REGISTER_OPS(ops) \
+       RTE_DEPRECATED(MEMPOOL_REGISTER_OPS) RTE_MEMPOOL_REGISTER_OPS(ops)
+
 /**
  * An object callback function for mempool.
  *
@@ -1083,6 +1097,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
  *
  * @param mp
  *   A pointer to the mempool structure.
+ *   If NULL then, the function does nothing.
  */
 void
 rte_mempool_free(struct rte_mempool *mp);
@@ -1739,7 +1754,7 @@ void rte_mempool_audit(struct rte_mempool *mp);
 static inline void *rte_mempool_get_priv(struct rte_mempool *mp)
 {
        return (char *)mp +
-               MEMPOOL_HEADER_SIZE(mp, mp->cache_size);
+               RTE_MEMPOOL_HEADER_SIZE(mp, mp->cache_size);
 }
 
 /**