1 /* SPDX-License-Identifier: BSD-3-Clause
6 #include <rte_compat.h>
10 #include <rte_mbuf_pool_ops.h>
12 int __rte_experimental
13 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
15 const struct rte_memzone *mz;
17 if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
20 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
22 mz = rte_memzone_reserve("mbuf_platform_pool_ops",
23 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
26 strcpy(mz->addr, ops_name);
28 } else if (strcmp(mz->addr, ops_name) == 0) {
33 "%s is already registered as platform mbuf pool ops\n",
38 const char * __rte_experimental
39 rte_mbuf_platform_mempool_ops(void)
41 const struct rte_memzone *mz;
43 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
49 int __rte_experimental
50 rte_mbuf_set_user_mempool_ops(const char *ops_name)
52 const struct rte_memzone *mz;
54 if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
57 mz = rte_memzone_lookup("mbuf_user_pool_ops");
59 mz = rte_memzone_reserve("mbuf_user_pool_ops",
60 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
65 strcpy(mz->addr, ops_name);
70 const char * __rte_experimental
71 rte_mbuf_user_mempool_ops(void)
73 const struct rte_memzone *mz;
75 mz = rte_memzone_lookup("mbuf_user_pool_ops");
77 return rte_eal_mbuf_user_pool_ops();
81 /* Return mbuf pool ops name */
82 const char * __rte_experimental
83 rte_mbuf_best_mempool_ops(void)
85 /* User defined mempool ops takes the priority */
86 const char *best_ops = rte_mbuf_user_mempool_ops();
90 /* Next choice is platform configured mempool ops */
91 best_ops = rte_mbuf_platform_mempool_ops();
95 /* Last choice is to use the compile time config pool */
96 return RTE_MBUF_DEFAULT_MEMPOOL_OPS;