| 76 | } |
| 77 | |
| 78 | static int |
| 79 | ring_alloc(struct rte_mempool *mp, uint32_t rg_flags) |
| 80 | { |
| 81 | int ret; |
| 82 | char rg_name[RTE_RING_NAMESIZE]; |
| 83 | struct rte_ring *r; |
| 84 | |
| 85 | ret = snprintf(rg_name, sizeof(rg_name), |
| 86 | RTE_MEMPOOL_MZ_FORMAT, mp->name); |
| 87 | if (ret < 0 || ret >= (int)sizeof(rg_name)) { |
| 88 | rte_errno = ENAMETOOLONG; |
| 89 | return -rte_errno; |
| 90 | } |
| 91 | |
| 92 | /* |
| 93 | * Allocate the ring that will be used to store objects. |
| 94 | * Ring functions will return appropriate errors if we are |
| 95 | * running as a secondary process etc., so no checks made |
| 96 | * in this function for that condition. |
| 97 | */ |
| 98 | r = rte_ring_create(rg_name, rte_align32pow2(mp->size + 1), |
| 99 | mp->socket_id, rg_flags); |
| 100 | if (r == NULL) |
| 101 | return -rte_errno; |
| 102 | |
| 103 | mp->pool_data = r; |
| 104 | |
| 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | static int |
| 109 | common_ring_alloc(struct rte_mempool *mp) |
no test coverage detected