aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_global_data.h
blob: a9eccc2b531f51860f6c0c328bde77d85c42632d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Copyright (c) 2013-2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef ODP_GLOBAL_DATA_H_
#define ODP_GLOBAL_DATA_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/init.h>
#include <odp/api/cpumask.h>
#include <odp/api/random.h>
#include <sys/types.h>
#include <pthread.h>
#include <stdint.h>
#include <libconfig.h>

#define MAX_CPU_NUMBER 128
#define UID_MAXLEN 30

typedef struct {
	uint64_t cpu_hz_max[MAX_CPU_NUMBER];
	uint64_t page_size;
	int      cache_line_size;
	int      cpu_count;
	char     cpu_arch_str[128];
	char     model_str[MAX_CPU_NUMBER][128];
} system_info_t;

typedef struct {
	uint64_t default_huge_page_size;
	char     *default_huge_page_dir;
} hugepage_info_t;

struct odp_global_data_s {
	/* directory for odp mmaped files */
	char *shm_dir;
	/* overload default with env */
	int   shm_dir_from_env;
	uint64_t shm_max_memory;
	uint64_t shm_max_size;
	pid_t main_pid;
	char uid[UID_MAXLEN];
	odp_log_func_t log_fn;
	odp_abort_func_t abort_fn;
	system_info_t system_info;
	hugepage_info_t hugepage_info;
	odp_cpumask_t control_cpus;
	odp_cpumask_t worker_cpus;
	int num_cpus_installed;
	config_t libconfig_default;
	config_t libconfig_runtime;
	int inotify_pcapng_fd;
	int inotify_watch_fd;
	pthread_t inotify_thread;
	int inotify_pcapng_is_running;
	odp_random_kind_t ipsec_rand_kind;
};

extern struct odp_global_data_s odp_global_data;

#ifdef __cplusplus
}
#endif

#endif