xref: /dpdk/lib/port/rte_swx_port_source_sink.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2020 Intel Corporation
399a2dd95SBruce Richardson  */
499a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_SWX_PORT_SOURCE_SINK_H__
599a2dd95SBruce Richardson #define __INCLUDE_RTE_SWX_PORT_SOURCE_SINK_H__
699a2dd95SBruce Richardson 
799a2dd95SBruce Richardson /**
899a2dd95SBruce Richardson  * @file
999a2dd95SBruce Richardson  * RTE SWX Source and Sink Ports
1099a2dd95SBruce Richardson  */
1199a2dd95SBruce Richardson 
1299a2dd95SBruce Richardson #include "rte_swx_port.h"
1399a2dd95SBruce Richardson 
14*719834a6SMattias Rönnblom #ifdef __cplusplus
15*719834a6SMattias Rönnblom extern "C" {
16*719834a6SMattias Rönnblom #endif
17*719834a6SMattias Rönnblom 
1899a2dd95SBruce Richardson /** Maximum number of packets to read from the PCAP file. */
1999a2dd95SBruce Richardson #ifndef RTE_SWX_PORT_SOURCE_PKTS_MAX
2099a2dd95SBruce Richardson #define RTE_SWX_PORT_SOURCE_PKTS_MAX 1024
2199a2dd95SBruce Richardson #endif
2299a2dd95SBruce Richardson 
2399a2dd95SBruce Richardson /** Source port creation parameters. */
2499a2dd95SBruce Richardson struct rte_swx_port_source_params {
2599a2dd95SBruce Richardson 	/** Buffer pool. Must be valid. */
2699a2dd95SBruce Richardson 	struct rte_mempool *pool;
2799a2dd95SBruce Richardson 
2899a2dd95SBruce Richardson 	/** Name of a valid PCAP file to read the input packets from. */
2999a2dd95SBruce Richardson 	const char *file_name;
3099a2dd95SBruce Richardson 
310317c452SYogesh Jangra 	/** Number of times to loop through the input PCAP file.
320317c452SYogesh Jangra 	 * Loop infinite times when set to 0.
330317c452SYogesh Jangra 	 */
340317c452SYogesh Jangra 	uint64_t n_loops;
350317c452SYogesh Jangra 
3699a2dd95SBruce Richardson 	/** Maximum number of packets to read from the PCAP file. When 0, it is
3799a2dd95SBruce Richardson 	 * internally set to RTE_SWX_PORT_SOURCE_PKTS_MAX. Once read from the
3899a2dd95SBruce Richardson 	 * PCAP file, the same packets are looped forever.
3999a2dd95SBruce Richardson 	 */
4099a2dd95SBruce Richardson 	uint32_t n_pkts_max;
4199a2dd95SBruce Richardson };
4299a2dd95SBruce Richardson 
4399a2dd95SBruce Richardson /** Source port operations. */
4499a2dd95SBruce Richardson extern struct rte_swx_port_in_ops rte_swx_port_source_ops;
4599a2dd95SBruce Richardson 
4699a2dd95SBruce Richardson /** Sink port creation parameters. */
4799a2dd95SBruce Richardson struct rte_swx_port_sink_params {
4899a2dd95SBruce Richardson 	/** Name of a valid PCAP file to write the output packets to. When NULL,
4999a2dd95SBruce Richardson 	 * all the output packets are dropped instead of being saved to a PCAP
5099a2dd95SBruce Richardson 	 * file.
5199a2dd95SBruce Richardson 	 */
5299a2dd95SBruce Richardson 	const char *file_name;
5399a2dd95SBruce Richardson };
5499a2dd95SBruce Richardson 
5599a2dd95SBruce Richardson /** Sink port operations. */
5699a2dd95SBruce Richardson extern struct rte_swx_port_out_ops rte_swx_port_sink_ops;
5799a2dd95SBruce Richardson 
5899a2dd95SBruce Richardson #ifdef __cplusplus
5999a2dd95SBruce Richardson }
6099a2dd95SBruce Richardson #endif
6199a2dd95SBruce Richardson 
6299a2dd95SBruce Richardson #endif
63