xref: /dpdk/lib/port/rte_port_source_sink.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2010-2016 Intel Corporation
399a2dd95SBruce Richardson  */
499a2dd95SBruce Richardson 
599a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_PORT_SOURCE_SINK_H__
699a2dd95SBruce Richardson #define __INCLUDE_RTE_PORT_SOURCE_SINK_H__
799a2dd95SBruce Richardson 
899a2dd95SBruce Richardson /**
999a2dd95SBruce Richardson  * @file
1099a2dd95SBruce Richardson  * RTE Port Source/Sink
1199a2dd95SBruce Richardson  *
1299a2dd95SBruce Richardson  * source: input port that can be used to generate packets
1399a2dd95SBruce Richardson  * sink: output port that drops all packets written to it
143e4c5be9SThomas Monjalon  */
1599a2dd95SBruce Richardson 
1699a2dd95SBruce Richardson #include "rte_port.h"
1799a2dd95SBruce Richardson 
18*719834a6SMattias Rönnblom #ifdef __cplusplus
19*719834a6SMattias Rönnblom extern "C" {
20*719834a6SMattias Rönnblom #endif
21*719834a6SMattias Rönnblom 
2299a2dd95SBruce Richardson /** source port parameters */
2399a2dd95SBruce Richardson struct rte_port_source_params {
2499a2dd95SBruce Richardson 	/** Pre-initialized buffer pool */
2599a2dd95SBruce Richardson 	struct rte_mempool *mempool;
2699a2dd95SBruce Richardson 
2799a2dd95SBruce Richardson 	/** The full path of the pcap file to read packets from */
2899a2dd95SBruce Richardson 	const char *file_name;
2999a2dd95SBruce Richardson 	/** The number of bytes to be read from each packet in the
3099a2dd95SBruce Richardson 	 *  pcap file. If this value is 0, the whole packet is read;
3199a2dd95SBruce Richardson 	 *  if it is bigger than packet size, the generated packets
3299a2dd95SBruce Richardson 	 *  will contain the whole packet */
3399a2dd95SBruce Richardson 	uint32_t n_bytes_per_pkt;
3499a2dd95SBruce Richardson };
3599a2dd95SBruce Richardson 
3699a2dd95SBruce Richardson /** source port operations */
3799a2dd95SBruce Richardson extern struct rte_port_in_ops rte_port_source_ops;
3899a2dd95SBruce Richardson 
3999a2dd95SBruce Richardson /** sink port parameters */
4099a2dd95SBruce Richardson struct rte_port_sink_params {
4199a2dd95SBruce Richardson 	/** The full path of the pcap file to write the packets to */
4299a2dd95SBruce Richardson 	const char *file_name;
4399a2dd95SBruce Richardson 	/** The maximum number of packets write to the pcap file.
4499a2dd95SBruce Richardson 	 *  If this value is 0, the "infinite" write will be carried
4599a2dd95SBruce Richardson 	 *  out.
4699a2dd95SBruce Richardson 	 */
4799a2dd95SBruce Richardson 	uint32_t max_n_pkts;
4899a2dd95SBruce Richardson };
4999a2dd95SBruce Richardson 
5099a2dd95SBruce Richardson /** sink port operations */
5199a2dd95SBruce Richardson extern struct rte_port_out_ops rte_port_sink_ops;
5299a2dd95SBruce Richardson 
5399a2dd95SBruce Richardson #ifdef __cplusplus
5499a2dd95SBruce Richardson }
5599a2dd95SBruce Richardson #endif
5699a2dd95SBruce Richardson 
5799a2dd95SBruce Richardson #endif
58