| 418 | } |
| 419 | |
| 420 | static int |
| 421 | init_dispatch_ring(void) |
| 422 | { |
| 423 | int j; |
| 424 | char name_buf[RTE_RING_NAMESIZE]; |
| 425 | int queueid; |
| 426 | |
| 427 | unsigned socketid = lcore_conf.socket_id; |
| 428 | |
| 429 | /* Create ring according to ports actually being used. */ |
| 430 | int nb_ports = ff_global_cfg.dpdk.nb_ports; |
| 431 | for (j = 0; j < nb_ports; j++) { |
| 432 | uint16_t portid = ff_global_cfg.dpdk.portid_list[j]; |
| 433 | struct ff_port_cfg *pconf = &ff_global_cfg.dpdk.port_cfgs[portid]; |
| 434 | int nb_queues = pconf->nb_lcores; |
| 435 | if (dispatch_ring[portid] == NULL) { |
| 436 | snprintf(name_buf, RTE_RING_NAMESIZE, "ring_ptr_p%d", portid); |
| 437 | |
| 438 | dispatch_ring[portid] = rte_zmalloc(name_buf, |
| 439 | sizeof(struct rte_ring *) * nb_queues, |
| 440 | RTE_CACHE_LINE_SIZE); |
| 441 | if (dispatch_ring[portid] == NULL) { |
| 442 | rte_exit(EXIT_FAILURE, "rte_zmalloc(%s (struct rte_ring*)) " |
| 443 | "failed\n", name_buf); |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | for(queueid = 0; queueid < nb_queues; ++queueid) { |
| 448 | snprintf(name_buf, RTE_RING_NAMESIZE, "dispatch_ring_p%d_q%d", |
| 449 | portid, queueid); |
| 450 | dispatch_ring[portid][queueid] = create_ring(name_buf, |
| 451 | DISPATCH_RING_SIZE, socketid, RING_F_SC_DEQ); |
| 452 | |
| 453 | if (dispatch_ring[portid][queueid] == NULL) |
| 454 | rte_panic("create ring:%s failed!\n", name_buf); |
| 455 | |
| 456 | ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "create ring:%s success, %u ring entries are now free!\n", |
| 457 | name_buf, rte_ring_free_count(dispatch_ring[portid][queueid])); |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | return 0; |
| 462 | } |
| 463 | |
| 464 | static void |
| 465 | ff_msg_init(struct rte_mempool *mp, |
no test coverage detected