xref: /dpdk/lib/port/rte_port_fd.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_PORT_FD_H__
6 #define __INCLUDE_RTE_PORT_FD_H__
7 
8 /**
9  * @file
10  * RTE Port FD Device
11  *
12  * fd_reader: input port built on top of valid non-blocking file descriptor
13  * fd_writer: output port built on top of valid non-blocking file descriptor
14  */
15 
16 #include <stdint.h>
17 
18 #include "rte_port.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /** fd_reader port parameters */
25 struct rte_port_fd_reader_params {
26 	/** File descriptor */
27 	int fd;
28 
29 	/** Maximum Transfer Unit (MTU) */
30 	uint32_t mtu;
31 
32 	/** Pre-initialized buffer pool */
33 	struct rte_mempool *mempool;
34 };
35 
36 /** fd_reader port operations */
37 extern struct rte_port_in_ops rte_port_fd_reader_ops;
38 
39 /** fd_writer port parameters */
40 struct rte_port_fd_writer_params {
41 	/** File descriptor */
42 	int fd;
43 
44 	/**< Recommended write burst size. The actual burst size can be
45 	 * bigger or smaller than this value.
46 	 */
47 	uint32_t tx_burst_sz;
48 };
49 
50 /** fd_writer port operations */
51 extern struct rte_port_out_ops rte_port_fd_writer_ops;
52 
53 /** fd_writer_nodrop port parameters */
54 struct rte_port_fd_writer_nodrop_params {
55 	/** File descriptor */
56 	int fd;
57 
58 	/**< Recommended write burst size. The actual burst size can be
59 	 * bigger or smaller than this value.
60 	 */
61 	uint32_t tx_burst_sz;
62 
63 	/** Maximum number of retries, 0 for no limit */
64 	uint32_t n_retries;
65 };
66 
67 /** fd_writer_nodrop port operations */
68 extern struct rte_port_out_ops rte_port_fd_writer_nodrop_ops;
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif
75