1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2020 Intel Corporation 3 */ 4 #ifndef __INCLUDE_RTE_SWX_PORT_SOURCE_SINK_H__ 5 #define __INCLUDE_RTE_SWX_PORT_SOURCE_SINK_H__ 6 7 /** 8 * @file 9 * RTE SWX Source and Sink Ports 10 */ 11 12 #include "rte_swx_port.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 /** Maximum number of packets to read from the PCAP file. */ 19 #ifndef RTE_SWX_PORT_SOURCE_PKTS_MAX 20 #define RTE_SWX_PORT_SOURCE_PKTS_MAX 1024 21 #endif 22 23 /** Source port creation parameters. */ 24 struct rte_swx_port_source_params { 25 /** Buffer pool. Must be valid. */ 26 struct rte_mempool *pool; 27 28 /** Name of a valid PCAP file to read the input packets from. */ 29 const char *file_name; 30 31 /** Number of times to loop through the input PCAP file. 32 * Loop infinite times when set to 0. 33 */ 34 uint64_t n_loops; 35 36 /** Maximum number of packets to read from the PCAP file. When 0, it is 37 * internally set to RTE_SWX_PORT_SOURCE_PKTS_MAX. Once read from the 38 * PCAP file, the same packets are looped forever. 39 */ 40 uint32_t n_pkts_max; 41 }; 42 43 /** Source port operations. */ 44 extern struct rte_swx_port_in_ops rte_swx_port_source_ops; 45 46 /** Sink port creation parameters. */ 47 struct rte_swx_port_sink_params { 48 /** Name of a valid PCAP file to write the output packets to. When NULL, 49 * all the output packets are dropped instead of being saved to a PCAP 50 * file. 51 */ 52 const char *file_name; 53 }; 54 55 /** Sink port operations. */ 56 extern struct rte_swx_port_out_ops rte_swx_port_sink_ops; 57 58 #ifdef __cplusplus 59 } 60 #endif 61 62 #endif 63