New upstream version 18.08
[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
17 #include <rte_compat.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /**
24  * Set the platform supported pktmbuf HW mempool ops name
25  *
26  * This function allow the HW to register the actively supported HW mempool
27  * ops_name. Only one HW mempool ops can be registered at any point of time.
28  *
29  * @param ops_name
30  * @return
31  *   - On success, zero.
32  *   - On failure, a negative value.
33  */
34 int
35 rte_mbuf_set_platform_mempool_ops(const char *ops_name);
36
37 /**
38  * Get configured platform supported pktmbuf HW mempool ops name
39  *
40  * This function returns the platform supported mempool ops name.
41  *
42  * @return
43  *   - On success, platform pool ops name.
44  *   - On failure, NULL.
45  */
46 const char *
47 rte_mbuf_platform_mempool_ops(void);
48
49 /**
50  * Set the user preferred pktmbuf mempool ops name
51  *
52  * This function can be used by the user to configure user preferred
53  * mempool ops name.
54  *
55  * @param ops_name
56  * @return
57  *   - On success, zero.
58  *   - On failure, a negative value.
59  */
60 int
61 rte_mbuf_set_user_mempool_ops(const char *ops_name);
62
63 /**
64  * Get user preferred pool ops name for mbuf
65  *
66  * This function returns the user configured mempool ops name.
67  *
68  * @return
69  *   - On success, user pool ops name..
70  *   - On failure, NULL.
71  */
72 const char *
73 rte_mbuf_user_mempool_ops(void);
74
75 /**
76  * Get the best mempool ops name for pktmbuf.
77  *
78  * This function is used to determine the best options for mempool ops for
79  * pktmbuf allocations. Following are the priority order:
80  * 1. User defined, 2. Platform HW supported, 3. Compile time configured.
81  * This function is also used by the rte_pktmbuf_pool_create to get the best
82  * mempool ops name.
83  *
84  * @return
85  *   returns preferred mbuf pool ops name
86  */
87 const char *
88 rte_mbuf_best_mempool_ops(void);
89
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif /* _RTE_MBUF_POOL_OPS_H_ */