| 460 | |
| 461 | |
| 462 | static int |
| 463 | lcore_tx(struct rte_ring *in_r) |
| 464 | { |
| 465 | static struct output_buffer tx_buffers[RTE_MAX_ETHPORTS]; |
| 466 | const int socket_id = rte_socket_id(); |
| 467 | uint16_t port; |
| 468 | |
| 469 | RTE_ETH_FOREACH_DEV(port) { |
| 470 | /* skip ports that are not enabled */ |
| 471 | if ((enabled_port_mask & (1 << port)) == 0) |
| 472 | continue; |
| 473 | |
| 474 | if (rte_eth_dev_socket_id(port) >= 0 && |
| 475 | rte_eth_dev_socket_id(port) != socket_id) |
| 476 | printf("WARNING, port %u is on remote NUMA node to " |
| 477 | "TX thread.\n\tPerformance will not " |
| 478 | "be optimal.\n", port); |
| 479 | } |
| 480 | |
| 481 | printf("\nCore %u doing packet TX.\n", rte_lcore_id()); |
| 482 | while (!quit_signal) { |
| 483 | |
| 484 | RTE_ETH_FOREACH_DEV(port) { |
| 485 | /* skip ports that are not enabled */ |
| 486 | if ((enabled_port_mask & (1 << port)) == 0) |
| 487 | continue; |
| 488 | |
| 489 | struct rte_mbuf *bufs[BURST_SIZE_TX]; |
| 490 | const uint16_t nb_rx = rte_ring_dequeue_burst(in_r, |
| 491 | (void *)bufs, BURST_SIZE_TX, NULL); |
| 492 | app_stats.tx.dequeue_pkts += nb_rx; |
| 493 | |
| 494 | /* if we get no traffic, flush anything we have */ |
| 495 | if (unlikely(nb_rx == 0)) { |
| 496 | flush_all_ports(tx_buffers); |
| 497 | continue; |
| 498 | } |
| 499 | |
| 500 | /* for traffic we receive, queue it up for transmit */ |
| 501 | uint16_t i; |
| 502 | rte_prefetch_non_temporal((void *)bufs[0]); |
| 503 | rte_prefetch_non_temporal((void *)bufs[1]); |
| 504 | rte_prefetch_non_temporal((void *)bufs[2]); |
| 505 | for (i = 0; i < nb_rx; i++) { |
| 506 | struct output_buffer *outbuf; |
| 507 | uint8_t outp; |
| 508 | rte_prefetch_non_temporal((void *)bufs[i + 3]); |
| 509 | /* |
| 510 | * workers should update in_port to hold the |
| 511 | * output port value |
| 512 | */ |
| 513 | outp = bufs[i]->port; |
| 514 | /* skip ports that are not enabled */ |
| 515 | if ((enabled_port_mask & (1 << outp)) == 0) |
| 516 | continue; |
| 517 | |
| 518 | outbuf = &tx_buffers[outp]; |
| 519 | outbuf->mbufs[outbuf->count++] = bufs[i]; |
nothing calls this directly
no test coverage detected