xref: /spdk/include/spdk/env_dpdk.h (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2018 Intel Corporation.
3  *   All rights reserved.
4  */
5 
6 /** \file
7  * Encapsulated DPDK specific dependencies
8  */
9 
10 #include "spdk/stdinc.h"
11 
12 #ifndef SPDK_ENV_DPDK_H
13 #define SPDK_ENV_DPDK_H
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /**
20  * Initialize the environment library after DPDK env is already initialized.
21  * If DPDK's rte_eal_init is already called, this function must be called
22  * instead of spdk_env_init, prior to using any other functions in SPDK
23  * env library.
24  *
25  * \param legacy_mem Indicates whether DPDK was initialized with --legacy-mem
26  *                   eal parameter.
27  * \return 0 on success, or negative errno on failure.
28  */
29 int spdk_env_dpdk_post_init(bool legacy_mem);
30 
31 /**
32  * Release any resources of the environment library that were allocated with
33  * spdk_env_dpdk_post_init(). After this call, no DPDK function calls may
34  * be made. It is expected that common usage of this function is to call it
35  * just before terminating the process.
36  */
37 void spdk_env_dpdk_post_fini(void);
38 
39 /**
40  * Check if DPDK was initialized external to the SPDK env_dpdk library.
41  *
42  * \return true if DPDK was initialized external to the SPDK env_dpdk library.
43  * \return false otherwise
44  */
45 bool spdk_env_dpdk_external_init(void);
46 
47 /**
48  * Dump the env allocated memory to the given file.
49  *
50  * \param file The file object to write to.
51  */
52 void spdk_env_dpdk_dump_mem_stats(FILE *file);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif
59