extern "C" {
#endif
+#include <rte_bitops.h>
#include <rte_common.h>
#include <rte_compat.h>
#include <rte_config.h>
#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
* 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);
* @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);
* @return
* Memseg list to which this virtual address belongs to.
*/
-__rte_experimental
struct rte_memseg_list *
rte_mem_virt2memseg_list(const void *virt);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* - 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);
* - 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);
* - 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);
* - 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
* 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
* 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
* 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
* 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);
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
* @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);
/**
* -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);
* -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);
* -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);
* -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);