1 /* SPDX-License-Identifier: BSD-3-Clause
6 #include <rte_compat.h>
10 #include <rte_mbuf_pool_ops.h>
13 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
15 const struct rte_memzone *mz;
17 size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
20 if (len == RTE_MEMPOOL_OPS_NAMESIZE)
23 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
25 mz = rte_memzone_reserve("mbuf_platform_pool_ops",
26 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
29 strcpy(mz->addr, ops_name);
31 } else if (strcmp(mz->addr, ops_name) == 0) {
36 "%s is already registered as platform mbuf pool ops\n",
42 rte_mbuf_platform_mempool_ops(void)
44 const struct rte_memzone *mz;
46 mz = rte_memzone_lookup("mbuf_platform_pool_ops");
53 rte_mbuf_set_user_mempool_ops(const char *ops_name)
55 const struct rte_memzone *mz;
57 size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
60 if (len == RTE_MEMPOOL_OPS_NAMESIZE)
63 mz = rte_memzone_lookup("mbuf_user_pool_ops");
65 mz = rte_memzone_reserve("mbuf_user_pool_ops",
66 RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0);
71 strcpy(mz->addr, ops_name);
77 rte_mbuf_user_mempool_ops(void)
79 const struct rte_memzone *mz;
81 mz = rte_memzone_lookup("mbuf_user_pool_ops");
83 return rte_eal_mbuf_user_pool_ops();
87 /* Return mbuf pool ops name */
89 rte_mbuf_best_mempool_ops(void)
91 /* User defined mempool ops takes the priority */
92 const char *best_ops = rte_mbuf_user_mempool_ops();
96 /* Next choice is platform configured mempool ops */
97 best_ops = rte_mbuf_platform_mempool_ops();
101 /* Last choice is to use the compile time config pool */
102 return RTE_MBUF_DEFAULT_MEMPOOL_OPS;