Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2010-2014 Intel Corporation 3 : : */ 4 : : 5 : : #include <stdarg.h> 6 : : #include <string.h> 7 : : #include <stdio.h> 8 : : #include <errno.h> 9 : : #include <stdint.h> 10 : : #include <unistd.h> 11 : : #include <inttypes.h> 12 : : 13 : : #include <sys/queue.h> 14 : : #include <sys/stat.h> 15 : : 16 : : #include <rte_common.h> 17 : : #include <rte_byteorder.h> 18 : : #include <rte_log.h> 19 : : #include <rte_debug.h> 20 : : #include <rte_cycles.h> 21 : : #include <rte_memory.h> 22 : : #include <rte_memcpy.h> 23 : : #include <rte_launch.h> 24 : : #include <rte_eal.h> 25 : : #include <rte_per_lcore.h> 26 : : #include <rte_lcore.h> 27 : : #include <rte_branch_prediction.h> 28 : : #include <rte_mempool.h> 29 : : #include <rte_mbuf.h> 30 : : #include <rte_interrupts.h> 31 : : #include <rte_ether.h> 32 : : #include <rte_ethdev.h> 33 : : #include <rte_string_fns.h> 34 : : #include <rte_ip.h> 35 : : #include <rte_udp.h> 36 : : #include <rte_net.h> 37 : : #include <rte_flow.h> 38 : : 39 : : #include "testpmd.h" 40 : : 41 : : /* 42 : : * Received a burst of packets. 43 : : */ 44 : : static bool 45 : 0 : pkt_burst_receive(struct fwd_stream *fs) 46 : : { 47 : : struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; 48 : : uint16_t nb_rx; 49 : : 50 : : /* 51 : : * Receive a burst of packets. 52 : : */ 53 : 0 : nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); 54 : 0 : if (unlikely(nb_rx == 0)) 55 : : return false; 56 : : 57 : 0 : rte_pktmbuf_free_bulk(pkts_burst, nb_rx); 58 : : 59 : 0 : return true; 60 : : } 61 : : 62 : : static void 63 : 0 : stream_init_receive(struct fwd_stream *fs) 64 : : { 65 : 0 : fs->disabled = ports[fs->rx_port].rxq[fs->rx_queue].state == 66 : : RTE_ETH_QUEUE_STATE_STOPPED; 67 : 0 : } 68 : : 69 : : struct fwd_engine rx_only_engine = { 70 : : .fwd_mode_name = "rxonly", 71 : : .stream_init = stream_init_receive, 72 : : .packet_fwd = pkt_burst_receive, 73 : : };