1 /* SPDX-License-Identifier: BSD-3-Clause
9 #include <rte_mbuf_pool_ops.h>
12 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
14 const struct rte_memzone *mz;
16 size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
19 if (len == RTE_MEMPOOL_OPS_NAMESIZE)
22 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
24 mz = rte_memzone_reserve("mbuf_platform_pool_ops",
25 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
28 strcpy(mz->addr, ops_name);
30 } else if (strcmp(mz->addr, ops_name) == 0) {
35 "%s is already registered as platform mbuf pool ops\n",
41 rte_mbuf_platform_mempool_ops(void)
43 const struct rte_memzone *mz;
45 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
52 rte_mbuf_set_user_mempool_ops(const char *ops_name)
54 const struct rte_memzone *mz;
56 size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
59 if (len == RTE_MEMPOOL_OPS_NAMESIZE)
62 mz = rte_memzone_lookup("mbuf_user_pool_ops");
64 mz = rte_memzone_reserve("mbuf_user_pool_ops",
65 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
70 strcpy(mz->addr, ops_name);
76 rte_mbuf_user_mempool_ops(void)
78 const struct rte_memzone *mz;
80 mz = rte_memzone_lookup("mbuf_user_pool_ops");
82 return rte_eal_mbuf_user_pool_ops();
86 /* Return mbuf pool ops name */
88 rte_mbuf_best_mempool_ops(void)
90 /* User defined mempool ops takes the priority */
91 const char *best_ops = rte_mbuf_user_mempool_ops();
95 /* Next choice is platform configured mempool ops */
96 best_ops = rte_mbuf_platform_mempool_ops();
100 /* Last choice is to use the compile time config pool */
101 return RTE_MBUF_DEFAULT_MEMPOOL_OPS;