DPDK  20.08.0
Enumerations | Functions
rte_eal_paging.h File Reference
#include <stdint.h>
#include <sys/mman.h>
#include <rte_compat.h>

Go to the source code of this file.

Enumerations

enum  rte_mem_prot { RTE_PROT_READ = 1 << 0, RTE_PROT_WRITE = 1 << 1, RTE_PROT_EXECUTE = 1 << 2 }
 
enum  rte_map_flags
 

Functions

__rte_internal void * rte_mem_map (void *requested_addr, size_t size, int prot, int flags, int fd, size_t offset)
 
__rte_internal int rte_mem_unmap (void *virt, size_t size)
 
__rte_internal size_t rte_mem_page_size (void)
 
__rte_internal int rte_mem_lock (const void *virt, size_t size)
 

Enumeration Type Documentation

Memory protection flags.

Enumerator
RTE_PROT_READ 

Read access.

RTE_PROT_WRITE 

Write access.

RTE_PROT_EXECUTE 

Code execution.

Definition at line 20 of file rte_eal_paging.h.

Additional flags for memory mapping.

Definition at line 27 of file rte_eal_paging.h.

Function Documentation

__rte_internal void* rte_mem_map ( void *  requested_addr,
size_t  size,
int  prot,
int  flags,
int  fd,
size_t  offset 
)

Map a portion of an opened file or the page file into memory.

This function is similar to POSIX mmap(3) with common MAP_ANONYMOUS extension, except for the return value.

Parameters
requested_addrDesired virtual address for mapping. Can be NULL to let OS choose.
sizeSize of the mapping in bytes.
protProtection flags, a combination of rte_mem_prot values.
flagsAdditional mapping flags, a combination of rte_map_flags.
fdMapped file descriptor. Can be negative for anonymous mapping.
offsetOffset of the mapped region in fd. Must be 0 for anonymous mappings.
Returns
Mapped address or NULL on failure and rte_errno is set to OS error.
__rte_internal int rte_mem_unmap ( void *  virt,
size_t  size 
)

OS-independent implementation of POSIX munmap(3).

__rte_internal size_t rte_mem_page_size ( void  )

Get system page size. This function never fails.

Returns
Page size in bytes.
__rte_internal int rte_mem_lock ( const void *  virt,
size_t  size 
)

Lock in physical memory all pages crossed by the address region.

Parameters
virtBase virtual address of the region.
sizeSize of the region.
Returns
0 on success, negative on error.
See also
rte_mem_page_size() to retrieve the page size.
rte_mem_lock_page() to lock an entire single page.