1174a1631SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 2174a1631SBruce Richardson * Copyright(c) 2010-2014 Intel Corporation 3af75078fSIntel */ 4af75078fSIntel 5af75078fSIntel #include <stdarg.h> 6af75078fSIntel #include <string.h> 7af75078fSIntel #include <stdio.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_memcpy.h> 23af75078fSIntel #include <rte_launch.h> 24af75078fSIntel #include <rte_eal.h> 25af75078fSIntel #include <rte_per_lcore.h> 26af75078fSIntel #include <rte_lcore.h> 27af75078fSIntel #include <rte_branch_prediction.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> 34bd948f20SJijiang Liu #include <rte_ip.h> 35bd948f20SJijiang Liu #include <rte_udp.h> 36144ba889SOlivier Matz #include <rte_net.h> 37938a184aSAdrien Mazarguil #include <rte_flow.h> 38af75078fSIntel 39af75078fSIntel #include "testpmd.h" 40af75078fSIntel 41af75078fSIntel /* 42af75078fSIntel * Received a burst of packets. 43af75078fSIntel */ 4406c20561SDavid Marchand static bool pkt_burst_receive(struct fwd_stream * fs)45af75078fSIntelpkt_burst_receive(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. 52af75078fSIntel */ 53*d3dae396SDavid Marchand nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); 547569b8c1SHonnappa Nagarahalli if (unlikely(nb_rx == 0)) 5506c20561SDavid Marchand return false; 567569b8c1SHonnappa Nagarahalli 57d00fee5dSDavid Marchand rte_pktmbuf_free_bulk(pkts_burst, nb_rx); 58af75078fSIntel 5906c20561SDavid Marchand return true; 60af75078fSIntel } 61af75078fSIntel 623c4426dbSDmitry Kozlyuk static void stream_init_receive(struct fwd_stream * fs)633c4426dbSDmitry Kozlyukstream_init_receive(struct fwd_stream *fs) 643c4426dbSDmitry Kozlyuk { 653c4426dbSDmitry Kozlyuk fs->disabled = ports[fs->rx_port].rxq[fs->rx_queue].state == 663c4426dbSDmitry Kozlyuk RTE_ETH_QUEUE_STATE_STOPPED; 673c4426dbSDmitry Kozlyuk } 683c4426dbSDmitry Kozlyuk 69af75078fSIntel struct fwd_engine rx_only_engine = { 70af75078fSIntel .fwd_mode_name = "rxonly", 713c4426dbSDmitry Kozlyuk .stream_init = stream_init_receive, 72af75078fSIntel .packet_fwd = pkt_burst_receive, 73af75078fSIntel }; 74