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