| 230 | } |
| 231 | |
| 232 | static int |
| 233 | init_mbufpool(unsigned nb_mbuf) |
| 234 | { |
| 235 | int socketid; |
| 236 | unsigned lcore_id; |
| 237 | char s[64]; |
| 238 | |
| 239 | for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { |
| 240 | if (rte_lcore_is_enabled(lcore_id) == 0) |
| 241 | continue; |
| 242 | |
| 243 | socketid = rte_lcore_to_socket_id(lcore_id); |
| 244 | if (socketid >= NB_SOCKETS) { |
| 245 | rte_exit(EXIT_FAILURE, |
| 246 | "Socket %d of lcore %u is out of range %d\n", |
| 247 | socketid, lcore_id, NB_SOCKETS); |
| 248 | } |
| 249 | if (mbufpool[socketid] == NULL) { |
| 250 | snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); |
| 251 | mbufpool[socketid] = |
| 252 | rte_pktmbuf_pool_create(s, nb_mbuf, |
| 253 | MEMPOOL_CACHE_SIZE, 0, |
| 254 | RTE_MBUF_DEFAULT_BUF_SIZE, socketid); |
| 255 | if (mbufpool[socketid] == NULL) |
| 256 | rte_exit(EXIT_FAILURE, |
| 257 | "Cannot init mbuf pool on socket %d\n", |
| 258 | socketid); |
| 259 | else |
| 260 | printf("Allocated mbuf pool on socket %d\n", |
| 261 | socketid); |
| 262 | } |
| 263 | } |
| 264 | return 0; |
| 265 | } |
| 266 | |
| 267 | static uint16_t |
| 268 | alloc_lcore(int socketid) |
no test coverage detected