examples/l3fwd: merge l3fwd-acl example
[dpdk.git] / lib / eal / include / rte_memory.h
index bba9b53..68b069f 100644 (file)
@@ -19,6 +19,7 @@
 extern "C" {
 #endif
 
+#include <rte_bitops.h>
 #include <rte_common.h>
 #include <rte_compat.h>
 #include <rte_config.h>
@@ -37,11 +38,14 @@ extern "C" {
 
 #define SOCKET_ID_ANY -1                    /**< Any NUMA socket. */
 
+/** Prevent this segment from being freed back to the OS. */
+#define RTE_MEMSEG_FLAG_DO_NOT_FREE RTE_BIT32(0)
+/** This segment is not filled with zeros. */
+#define RTE_MEMSEG_FLAG_DIRTY RTE_BIT32(1)
+
 /**
  * Physical memory segment descriptor.
  */
-#define RTE_MEMSEG_FLAG_DO_NOT_FREE (1 << 0)
-/**< Prevent this segment from being freed back to the OS. */
 struct rte_memseg {
        rte_iova_t iova;            /**< Start IO address. */
        RTE_STD_C11
@@ -127,7 +131,6 @@ rte_iova_t rte_mem_virt2iova(const void *virt);
  *   Virtual address corresponding to iova address (or NULL if address does not
  *   exist within DPDK memory map).
  */
-__rte_experimental
 void *
 rte_mem_iova2virt(rte_iova_t iova);
 
@@ -142,7 +145,6 @@ rte_mem_iova2virt(rte_iova_t iova);
  * @return
  *   Memseg pointer on success, or NULL on error.
  */
-__rte_experimental
 struct rte_memseg *
 rte_mem_virt2memseg(const void *virt, const struct rte_memseg_list *msl);
 
@@ -154,7 +156,6 @@ rte_mem_virt2memseg(const void *virt, const struct rte_memseg_list *msl);
  * @return
  *   Memseg list to which this virtual address belongs to.
  */
-__rte_experimental
 struct rte_memseg_list *
 rte_mem_virt2memseg_list(const void *virt);
 
@@ -209,7 +210,6 @@ typedef int (*rte_memseg_list_walk_t)(const struct rte_memseg_list *msl,
  *   1 if stopped by the user
  *   -1 if user function reported error
  */
-__rte_experimental
 int
 rte_memseg_walk(rte_memseg_walk_t func, void *arg);
 
@@ -231,7 +231,6 @@ rte_memseg_walk(rte_memseg_walk_t func, void *arg);
  *   1 if stopped by the user
  *   -1 if user function reported error
  */
-__rte_experimental
 int
 rte_memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg);
 
@@ -253,7 +252,6 @@ rte_memseg_contig_walk(rte_memseg_contig_walk_t func, void *arg);
  *   1 if stopped by the user
  *   -1 if user function reported error
  */
-__rte_experimental
 int
 rte_memseg_list_walk(rte_memseg_list_walk_t func, void *arg);
 
@@ -272,7 +270,6 @@ rte_memseg_list_walk(rte_memseg_list_walk_t func, void *arg);
  *   1 if stopped by the user
  *   -1 if user function reported error
  */
-__rte_experimental
 int
 rte_memseg_walk_thread_unsafe(rte_memseg_walk_t func, void *arg);
 
@@ -291,7 +288,6 @@ rte_memseg_walk_thread_unsafe(rte_memseg_walk_t func, void *arg);
  *   1 if stopped by the user
  *   -1 if user function reported error
  */
-__rte_experimental
 int
 rte_memseg_contig_walk_thread_unsafe(rte_memseg_contig_walk_t func, void *arg);
 
@@ -310,7 +306,6 @@ rte_memseg_contig_walk_thread_unsafe(rte_memseg_contig_walk_t func, void *arg);
  *   1 if stopped by the user
  *   -1 if user function reported error
  */
-__rte_experimental
 int
 rte_memseg_list_walk_thread_unsafe(rte_memseg_list_walk_t func, void *arg);
 
@@ -335,7 +330,6 @@ rte_memseg_list_walk_thread_unsafe(rte_memseg_list_walk_t func, void *arg);
  *     - ENOENT  - ``ms`` is an unused segment
  *     - ENOTSUP - segment fd's are not supported
  */
-__rte_experimental
 int
 rte_memseg_get_fd(const struct rte_memseg *ms);
 
@@ -360,7 +354,6 @@ rte_memseg_get_fd(const struct rte_memseg *ms);
  *     - ENOENT  - ``ms`` is an unused segment
  *     - ENOTSUP - segment fd's are not supported
  */
-__rte_experimental
 int
 rte_memseg_get_fd_thread_unsafe(const struct rte_memseg *ms);
 
@@ -385,7 +378,6 @@ rte_memseg_get_fd_thread_unsafe(const struct rte_memseg *ms);
  *     - ENOENT  - ``ms`` is an unused segment
  *     - ENOTSUP - segment fd's are not supported
  */
-__rte_experimental
 int
 rte_memseg_get_fd_offset(const struct rte_memseg *ms, size_t *offset);
 
@@ -410,15 +402,11 @@ rte_memseg_get_fd_offset(const struct rte_memseg *ms, size_t *offset);
  *     - ENOENT  - ``ms`` is an unused segment
  *     - ENOTSUP - segment fd's are not supported
  */
-__rte_experimental
 int
 rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg *ms,
                size_t *offset);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * Register external memory chunk with DPDK.
  *
  * @note Using this API is mutually exclusive with ``rte_malloc`` family of
@@ -452,15 +440,11 @@ rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg *ms,
  *     EEXIST - memory chunk is already registered
  *     ENOSPC - no more space in internal config to store a new memory chunk
  */
-__rte_experimental
 int
 rte_extmem_register(void *va_addr, size_t len, rte_iova_t iova_addrs[],
                unsigned int n_pages, size_t page_sz);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * Unregister external memory chunk with DPDK.
  *
  * @note Using this API is mutually exclusive with ``rte_malloc`` family of
@@ -483,14 +467,10 @@ rte_extmem_register(void *va_addr, size_t len, rte_iova_t iova_addrs[],
  *     EINVAL - one of the parameters was invalid
  *     ENOENT - memory chunk was not found
  */
-__rte_experimental
 int
 rte_extmem_unregister(void *va_addr, size_t len);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * Attach to external memory chunk registered in another process.
  *
  * @note Using this API is mutually exclusive with ``rte_malloc`` family of
@@ -510,14 +490,10 @@ rte_extmem_unregister(void *va_addr, size_t len);
  *     EINVAL - one of the parameters was invalid
  *     ENOENT - memory chunk was not found
  */
-__rte_experimental
 int
 rte_extmem_attach(void *va_addr, size_t len);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * Detach from external memory chunk registered in another process.
  *
  * @note Using this API is mutually exclusive with ``rte_malloc`` family of
@@ -537,7 +513,6 @@ rte_extmem_attach(void *va_addr, size_t len);
  *     EINVAL - one of the parameters was invalid
  *     ENOENT - memory chunk was not found
  */
-__rte_experimental
 int
 rte_extmem_detach(void *va_addr, size_t len);
 
@@ -582,22 +557,15 @@ unsigned rte_memory_get_nchannel(void);
 unsigned rte_memory_get_nrank(void);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * Check if all currently allocated memory segments are compliant with
  * supplied DMA address width.
  *
  *  @param maskbits
  *    Address width to check against.
  */
-__rte_experimental
 int rte_mem_check_dma_mask(uint8_t maskbits);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * Check if all currently allocated memory segments are compliant with
  * supplied DMA address width. This function will use
  * rte_memseg_walk_thread_unsafe instead of rte_memseg_walk implying
@@ -610,18 +578,13 @@ int rte_mem_check_dma_mask(uint8_t maskbits);
  *  @param maskbits
  *    Address width to check against.
  */
-__rte_experimental
 int rte_mem_check_dma_mask_thread_unsafe(uint8_t maskbits);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  *  Set dma mask to use once memory initialization is done. Previous functions
  *  rte_mem_check_dma_mask and rte_mem_check_dma_mask_thread_unsafe can not be
  *  used safely until memory has been initialized.
  */
-__rte_experimental
 void rte_mem_set_dma_mask(uint8_t maskbits);
 
 /**
@@ -678,7 +641,6 @@ typedef void (*rte_mem_event_callback_t)(enum rte_mem_event event_type,
  *   -1 on unsuccessful callback register, with rte_errno value indicating
  *   reason for failure.
  */
-__rte_experimental
 int
 rte_mem_event_callback_register(const char *name, rte_mem_event_callback_t clb,
                void *arg);
@@ -697,7 +659,6 @@ rte_mem_event_callback_register(const char *name, rte_mem_event_callback_t clb,
  *   -1 on unsuccessful callback unregister, with rte_errno value indicating
  *   reason for failure.
  */
-__rte_experimental
 int
 rte_mem_event_callback_unregister(const char *name, void *arg);
 
@@ -747,7 +708,6 @@ typedef int (*rte_mem_alloc_validator_t)(int socket_id,
  *   -1 on unsuccessful callback register, with rte_errno value indicating
  *   reason for failure.
  */
-__rte_experimental
 int
 rte_mem_alloc_validator_register(const char *name,
                rte_mem_alloc_validator_t clb, int socket_id, size_t limit);
@@ -766,7 +726,6 @@ rte_mem_alloc_validator_register(const char *name,
  *   -1 on unsuccessful callback unregister, with rte_errno value indicating
  *   reason for failure.
  */
-__rte_experimental
 int
 rte_mem_alloc_validator_unregister(const char *name, int socket_id);