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 if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
19 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
21 mz = rte_memzone_reserve("mbuf_platform_pool_ops",
22 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
25 strncpy(mz->addr, ops_name, strlen(ops_name));
27 } else if (strcmp(mz->addr, ops_name) == 0) {
32 "%s is already registered as platform mbuf pool ops\n",
38 rte_mbuf_platform_mempool_ops(void)
40 const struct rte_memzone *mz;
42 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
49 rte_mbuf_set_user_mempool_ops(const char *ops_name)
51 const struct rte_memzone *mz;
53 if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
56 mz = rte_memzone_lookup("mbuf_user_pool_ops");
58 mz = rte_memzone_reserve("mbuf_user_pool_ops",
59 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
64 strncpy(mz->addr, ops_name, strlen(ops_name));
70 rte_mbuf_user_mempool_ops(void)
72 const struct rte_memzone *mz;
74 mz = rte_memzone_lookup("mbuf_user_pool_ops");
76 return rte_eal_mbuf_default_mempool_ops();
80 /* Return mbuf pool ops name */
82 rte_mbuf_best_mempool_ops(void)
84 /* User defined mempool ops takes the priority */
85 const char *best_ops = rte_mbuf_user_mempool_ops();
89 /* Next choice is platform configured mempool ops */
90 best_ops = rte_mbuf_platform_mempool_ops();
94 /* Last choice is to use the compile time config pool */
95 return RTE_MBUF_DEFAULT_MEMPOOL_OPS;