New upstream version 18.02
[deb_dpdk.git] / lib / librte_mbuf / rte_mbuf_pool_ops.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018 NXP
3  */
4
5 #ifndef _RTE_MBUF_POOL_OPS_H_
6 #define _RTE_MBUF_POOL_OPS_H_
7
8 /**
9  * @file
10  * RTE Mbuf Pool Ops
11  *
12  * These APIs are for configuring the mbuf pool ops names to be largely used by
13  * rte_pktmbuf_pool_create(). However, this can also be used to set and inquire
14  * the best mempool ops available.
15  *
16  * @warning
17  * @b EXPERIMENTAL: this API may change without prior notice
18  */
19
20 #include <rte_compat.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * Set the platform supported pktmbuf HW mempool ops name
28  *
29  * This function allow the HW to register the actively supported HW mempool
30  * ops_name. Only one HW mempool ops can be registered at any point of time.
31  *
32  * @param ops_name
33  * @return
34  *   - On success, zero.
35  *   - On failure, a negative value.
36  */
37 int __rte_experimental
38 rte_mbuf_set_platform_mempool_ops(const char *ops_name);
39
40 /**
41  * Get configured platform supported pktmbuf HW mempool ops name
42  *
43  * This function returns the platform supported mempool ops name.
44  *
45  * @return
46  *   - On success, platform pool ops name.
47  *   - On failure, NULL.
48  */
49 const char * __rte_experimental
50 rte_mbuf_platform_mempool_ops(void);
51
52 /**
53  * Set the user preferred pktmbuf mempool ops name
54  *
55  * This function can be used by the user to configure user preferred
56  * mempool ops name.
57  *
58  * @param ops_name
59  * @return
60  *   - On success, zero.
61  *   - On failure, a negative value.
62  */
63 int __rte_experimental
64 rte_mbuf_set_user_mempool_ops(const char *ops_name);
65
66 /**
67  * Get user preferred pool ops name for mbuf
68  *
69  * This function returns the user configured mempool ops name.
70  *
71  * @return
72  *   - On success, user pool ops name..
73  *   - On failure, NULL.
74  */
75 const char * __rte_experimental
76 rte_mbuf_user_mempool_ops(void);
77
78 /**
79  * Get the best mempool ops name for pktmbuf.
80  *
81  * This function is used to determine the best options for mempool ops for
82  * pktmbuf allocations. Following are the priority order:
83  * 1. User defined, 2. Platform HW supported, 3. Compile time configured.
84  * This function is also used by the rte_pktmbuf_pool_create to get the best
85  * mempool ops name.
86  *
87  * @return
88  *   returns preferred mbuf pool ops name
89  */
90 const char * __rte_experimental
91 rte_mbuf_best_mempool_ops(void);
92
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif /* _RTE_MBUF_POOL_OPS_H_ */