|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
21 #include <sys/types.h>
33 fd = open (file_name, O_WRONLY);
42 if (write (fd, s,
vec_len (s)) < 0)
59 fd = open (file_name, O_RDONLY);
104 p = strrchr (
buffer,
'/');
125 if (log2_page_size == 0)
128 page_size = 1ULL << (log2_page_size - 10);
130 p =
format (p,
"/sys/devices/system/node/node%u%c", numa_node, 0);
132 if (stat ((
char *) p, &sb) == 0)
134 if (S_ISDIR (sb.st_mode) == 0)
140 else if (numa_node == 0)
143 p =
format (p,
"/sys/kernel/mm%c", 0);
144 if (stat ((
char *) p, &sb) < 0 || S_ISDIR (sb.st_mode) == 0)
158 p =
format (p,
"/hugepages/hugepages-%ukB/nr_hugepages%c", page_size, 0);
169 int log2_page_size,
int *val)
177 if (log2_page_size == 0)
180 page_size = 1ULL << (log2_page_size - 10);
183 p =
format (p,
"/sys/devices/system/node/node%u%c", numa_node, 0);
185 if (stat ((
char *) p, &sb) == 0)
187 if (S_ISDIR (sb.st_mode) == 0)
193 else if (numa_node == 0)
196 p =
format (p,
"/sys/kernel/mm%c", 0);
197 if (stat ((
char *) p, &sb) < 0 || S_ISDIR (sb.st_mode) == 0)
211 p =
format (p,
"/hugepages/hugepages-%ukB/%s_hugepages%c", page_size,
246 if (log2_page_size == 0)
249 page_size = 1ULL << (log2_page_size - 10);
261 clib_warning (
"pre-allocating %u additional %uK hugepages on numa node %u",
262 needed, page_size, numa_node);
266 __clib_export
uword *
272 fp = fopen (filename,
"r");
278 if (fgets ((
char *)
buffer, 256, fp))
282 strlen ((
char *)
buffer));
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
__clib_export u8 * clib_sysfs_link_to_name(char *link)
static_always_inline uword clib_mem_get_default_hugepage_size(void)
#define clib_error_return(e, args...)
clib_error_t * clib_sysfs_set_nr_hugepages(int numa_node, int log2_page_size, int nr)
clib_error_t * clib_sysfs_prealloc_hugepages(int numa_node, int log2_page_size, int nr)
static clib_error_t * clib_sysfs_get_xxx_hugepages(char *type, int numa_node, int log2_page_size, int *val)
vnet_hw_if_output_node_runtime_t * r
#define clib_unix_warning(format, args...)
__clib_export clib_error_t * clib_sysfs_write(char *file_name, char *fmt,...)
clib_error_t * clib_sysfs_get_free_hugepages(int numa_node, int log2_page_size, int *v)
__clib_export clib_error_t * clib_sysfs_read(char *file_name, char *fmt,...)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * clib_sysfs_get_nr_hugepages(int numa_node, int log2_page_size, int *v)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define vec_free(V)
Free vector's memory (no header).
description fragment has unexpected format
#define clib_error_return_unix(e, args...)
#define clib_warning(format, args...)
clib_error_t * clib_sysfs_get_surplus_hugepages(int numa_node, int log2_page_size, int *v)
static uword min_log2(uword x)
__clib_export uword unformat_bitmap_list(unformat_input_t *input, va_list *va)
unformat a list of bit ranges into a bitmap (eg "0-3,5-7,11" )
vl_api_fib_path_type_t type
__clib_export uword * clib_sysfs_list_to_bitmap(char *filename)