* Dequeue mbufs from the workers_to_tx ring and reorder them before * transmitting. */
| 544 | * transmitting. |
| 545 | */ |
| 546 | static int |
| 547 | send_thread(struct send_thread_args *args) |
| 548 | { |
| 549 | int ret; |
| 550 | unsigned int i, dret; |
| 551 | uint16_t nb_dq_mbufs; |
| 552 | uint8_t outp; |
| 553 | unsigned sent; |
| 554 | struct rte_mbuf *mbufs[MAX_PKTS_BURST]; |
| 555 | struct rte_mbuf *rombufs[MAX_PKTS_BURST] = {NULL}; |
| 556 | static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; |
| 557 | |
| 558 | RTE_LOG(INFO, REORDERAPP, "%s() started on lcore %u\n", __func__, rte_lcore_id()); |
| 559 | |
| 560 | configure_tx_buffers(tx_buffer); |
| 561 | |
| 562 | while (!quit_signal) { |
| 563 | |
| 564 | /* deque the mbufs from workers_to_tx ring */ |
| 565 | nb_dq_mbufs = rte_ring_dequeue_burst(args->ring_in, |
| 566 | (void *)mbufs, MAX_PKTS_BURST, NULL); |
| 567 | |
| 568 | if (unlikely(nb_dq_mbufs == 0)) |
| 569 | continue; |
| 570 | |
| 571 | app_stats.tx.dequeue_pkts += nb_dq_mbufs; |
| 572 | |
| 573 | for (i = 0; i < nb_dq_mbufs; i++) { |
| 574 | /* send dequeued mbufs for reordering */ |
| 575 | ret = rte_reorder_insert(args->buffer, mbufs[i]); |
| 576 | |
| 577 | if (ret == -1 && rte_errno == ERANGE) { |
| 578 | /* Too early pkts should be transmitted out directly */ |
| 579 | RTE_LOG_DP(DEBUG, REORDERAPP, |
| 580 | "%s():Cannot reorder early packet " |
| 581 | "direct enqueuing to TX\n", __func__); |
| 582 | outp = mbufs[i]->port; |
| 583 | if ((portmask & (1 << outp)) == 0) { |
| 584 | rte_pktmbuf_free(mbufs[i]); |
| 585 | continue; |
| 586 | } |
| 587 | if (rte_eth_tx_burst(outp, 0, (void *)mbufs[i], 1) != 1) { |
| 588 | rte_pktmbuf_free(mbufs[i]); |
| 589 | app_stats.tx.early_pkts_tx_failed_woro++; |
| 590 | } else |
| 591 | app_stats.tx.early_pkts_txtd_woro++; |
| 592 | } else if (ret == -1 && rte_errno == ENOSPC) { |
| 593 | /** |
| 594 | * Early pkts just outside of window should be dropped |
| 595 | */ |
| 596 | rte_pktmbuf_free(mbufs[i]); |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | /* |
| 601 | * drain MAX_PKTS_BURST of reordered |
| 602 | * mbufs for transmit |
| 603 | */ |
nothing calls this directly
no test coverage detected