1174a1631SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 2174a1631SBruce Richardson * Copyright(c) 2010-2014 Intel Corporation 3af75078fSIntel */ 4af75078fSIntel 5af75078fSIntel #include <stdarg.h> 6af75078fSIntel #include <stdio.h> 7af75078fSIntel #include <string.h> 8af75078fSIntel #include <errno.h> 9af75078fSIntel #include <stdint.h> 10af75078fSIntel #include <unistd.h> 11af75078fSIntel #include <inttypes.h> 12af75078fSIntel 13af75078fSIntel #include <sys/queue.h> 14af75078fSIntel #include <sys/stat.h> 15af75078fSIntel 16af75078fSIntel #include <rte_common.h> 17af75078fSIntel #include <rte_byteorder.h> 18af75078fSIntel #include <rte_log.h> 19af75078fSIntel #include <rte_debug.h> 20af75078fSIntel #include <rte_cycles.h> 21af75078fSIntel #include <rte_memory.h> 22af75078fSIntel #include <rte_launch.h> 23af75078fSIntel #include <rte_eal.h> 24af75078fSIntel #include <rte_per_lcore.h> 25af75078fSIntel #include <rte_lcore.h> 26af75078fSIntel #include <rte_branch_prediction.h> 27af75078fSIntel #include <rte_memcpy.h> 28af75078fSIntel #include <rte_mempool.h> 29af75078fSIntel #include <rte_mbuf.h> 30af75078fSIntel #include <rte_interrupts.h> 31af75078fSIntel #include <rte_ether.h> 32af75078fSIntel #include <rte_ethdev.h> 33af75078fSIntel #include <rte_string_fns.h> 34938a184aSAdrien Mazarguil #include <rte_flow.h> 35af75078fSIntel 36af75078fSIntel #include "testpmd.h" 37af75078fSIntel 38af75078fSIntel /* 39af75078fSIntel * Forwarding of packets in I/O mode. 40af75078fSIntel * Forward packets "as-is". 41af75078fSIntel * This is the fastest possible forwarding operation, as it does not access 42af75078fSIntel * to packets data. 43af75078fSIntel */ 4406c20561SDavid Marchand static bool pkt_burst_io_forward(struct fwd_stream * fs)45af75078fSIntelpkt_burst_io_forward(struct fwd_stream *fs) 46af75078fSIntel { 47af75078fSIntel struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; 48af75078fSIntel uint16_t nb_rx; 49af75078fSIntel 50af75078fSIntel /* 51af75078fSIntel * Receive a burst of packets and forward them. 52af75078fSIntel */ 53d3dae396SDavid Marchand nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); 54af75078fSIntel if (unlikely(nb_rx == 0)) 5506c20561SDavid Marchand return false; 56af75078fSIntel 57*655131ccSDavid Marchand common_fwd_stream_transmit(fs, pkts_burst, nb_rx); 58bc700b67SDharmik Thakkar 5906c20561SDavid Marchand return true; 60af75078fSIntel } 61af75078fSIntel 62af75078fSIntel struct fwd_engine io_fwd_engine = { 63af75078fSIntel .fwd_mode_name = "io", 64180ba023SDavid Marchand .stream_init = common_fwd_stream_init, 65af75078fSIntel .packet_fwd = pkt_burst_io_forward, 66af75078fSIntel }; 67