MCPcopy Create free account
hub / github.com/F-Stack/f-stack / send_thread

Function send_thread

dpdk/examples/packet_ordering/main.c:546–627  ·  view source on GitHub ↗

* Dequeue mbufs from the workers_to_tx ring and reorder them before * transmitting. */

Source from the content-addressed store, hash-verified

544 * transmitting.
545 */
546static int
547send_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 */

Callers

nothing calls this directly

Calls 9

rte_lcore_idFunction · 0.85
configure_tx_buffersFunction · 0.85
rte_ring_dequeue_burstFunction · 0.85
rte_reorder_insertFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
rte_eth_tx_burstFunction · 0.85
rte_reorder_drainFunction · 0.85
rte_eth_tx_bufferFunction · 0.85
free_tx_buffersFunction · 0.85

Tested by

no test coverage detected