DPDK  2.0.0
Data Structures | Macros | Typedefs | Functions
rte_memory.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>

Data Structures

struct  rte_memseg

Macros

#define SOCKET_ID_ANY   -1
#define RTE_CACHE_LINE_SIZE   64
#define RTE_CACHE_LINE_MASK   (RTE_CACHE_LINE_SIZE-1)
#define RTE_CACHE_LINE_ROUNDUP(size)   (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE))
#define __rte_cache_aligned   __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))

Typedefs

typedef uint64_t phys_addr_t

Functions

int rte_mem_lock_page (const void *virt)
phys_addr_t rte_mem_virt2phy (const void *virt)
struct rte_memsegrte_eal_get_physmem_layout (void)
void rte_dump_physmem_layout (FILE *f)
uint64_t rte_eal_get_physmem_size (void)
unsigned rte_memory_get_nchannel (void)
unsigned rte_memory_get_nrank (void)

Detailed Description

Memory-related RTE API.

Macro Definition Documentation

struct virtio_net __rte_cache_aligned   __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))

Force alignment to cache line.

#define RTE_CACHE_LINE_MASK   (RTE_CACHE_LINE_SIZE-1)

Cache line mask.

#define RTE_CACHE_LINE_ROUNDUP (   size)    (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE))

Return the first cache-aligned value greater or equal to size.

#define RTE_CACHE_LINE_SIZE   64

Cache line size.

#define SOCKET_ID_ANY   -1

Any NUMA socket.

Typedef Documentation

typedef uint64_t phys_addr_t

Physical address definition.

Function Documentation

void rte_dump_physmem_layout ( FILE *  f)

Dump the physical memory layout to the console.

Parameters
fA pointer to a file for output
struct rte_memseg* rte_eal_get_physmem_layout ( void  )
read

Get the layout of the available physical memory.

It can be useful for an application to have the full physical memory layout to decide the size of a memory zone to reserve. This table is stored in rte_config (see rte_eal_get_configuration()).

Returns
  • On success, return a pointer to a read-only table of struct rte_physmem_desc elements, containing the layout of all addressable physical memory. The last element of the table contains a NULL address.
  • On error, return NULL. This should not happen since it is a fatal error that will probably cause the entire system to panic.
uint64_t rte_eal_get_physmem_size ( void  )

Get the total amount of available physical memory.

Returns
The total amount of available physical memory in bytes.
int rte_mem_lock_page ( const void *  virt)

Lock page in physical memory and prevent from swapping.

Parameters
virtThe virtual address.
Returns
0 on success, negative on error.
phys_addr_t rte_mem_virt2phy ( const void *  virt)

Get physical address of any mapped virtual address in the current process. It is found by browsing the /proc/self/pagemap special file. The page must be locked.

Parameters
virtThe virtual address.
Returns
The physical address or RTE_BAD_PHYS_ADDR on error.
unsigned rte_memory_get_nchannel ( void  )

Get the number of memory channels.

Returns
The number of memory channels on the system. The value is 0 if unknown or not the same on all devices.
unsigned rte_memory_get_nrank ( void  )

Get the number of memory ranks.

Returns
The number of memory ranks on the system. The value is 0 if unknown or not the same on all devices.