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