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