199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2016 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_PORT_FD_H__ 699a2dd95SBruce Richardson #define __INCLUDE_RTE_PORT_FD_H__ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * @file 1099a2dd95SBruce Richardson * RTE Port FD Device 1199a2dd95SBruce Richardson * 1299a2dd95SBruce Richardson * fd_reader: input port built on top of valid non-blocking file descriptor 1399a2dd95SBruce Richardson * fd_writer: output port built on top of valid non-blocking file descriptor 143e4c5be9SThomas Monjalon */ 1599a2dd95SBruce Richardson 1699a2dd95SBruce Richardson #include <stdint.h> 1799a2dd95SBruce Richardson 1899a2dd95SBruce Richardson #include "rte_port.h" 1999a2dd95SBruce Richardson 20*719834a6SMattias Rönnblom #ifdef __cplusplus 21*719834a6SMattias Rönnblom extern "C" { 22*719834a6SMattias Rönnblom #endif 23*719834a6SMattias Rönnblom 2499a2dd95SBruce Richardson /** fd_reader port parameters */ 2599a2dd95SBruce Richardson struct rte_port_fd_reader_params { 2699a2dd95SBruce Richardson /** File descriptor */ 2799a2dd95SBruce Richardson int fd; 2899a2dd95SBruce Richardson 2999a2dd95SBruce Richardson /** Maximum Transfer Unit (MTU) */ 3099a2dd95SBruce Richardson uint32_t mtu; 3199a2dd95SBruce Richardson 3299a2dd95SBruce Richardson /** Pre-initialized buffer pool */ 3399a2dd95SBruce Richardson struct rte_mempool *mempool; 3499a2dd95SBruce Richardson }; 3599a2dd95SBruce Richardson 3699a2dd95SBruce Richardson /** fd_reader port operations */ 3799a2dd95SBruce Richardson extern struct rte_port_in_ops rte_port_fd_reader_ops; 3899a2dd95SBruce Richardson 3999a2dd95SBruce Richardson /** fd_writer port parameters */ 4099a2dd95SBruce Richardson struct rte_port_fd_writer_params { 4199a2dd95SBruce Richardson /** File descriptor */ 4299a2dd95SBruce Richardson int fd; 4399a2dd95SBruce Richardson 4499a2dd95SBruce Richardson /**< Recommended write burst size. The actual burst size can be 4599a2dd95SBruce Richardson * bigger or smaller than this value. 4699a2dd95SBruce Richardson */ 4799a2dd95SBruce Richardson uint32_t tx_burst_sz; 4899a2dd95SBruce Richardson }; 4999a2dd95SBruce Richardson 5099a2dd95SBruce Richardson /** fd_writer port operations */ 5199a2dd95SBruce Richardson extern struct rte_port_out_ops rte_port_fd_writer_ops; 5299a2dd95SBruce Richardson 5399a2dd95SBruce Richardson /** fd_writer_nodrop port parameters */ 5499a2dd95SBruce Richardson struct rte_port_fd_writer_nodrop_params { 5599a2dd95SBruce Richardson /** File descriptor */ 5699a2dd95SBruce Richardson int fd; 5799a2dd95SBruce Richardson 5899a2dd95SBruce Richardson /**< Recommended write burst size. The actual burst size can be 5999a2dd95SBruce Richardson * bigger or smaller than this value. 6099a2dd95SBruce Richardson */ 6199a2dd95SBruce Richardson uint32_t tx_burst_sz; 6299a2dd95SBruce Richardson 6399a2dd95SBruce Richardson /** Maximum number of retries, 0 for no limit */ 6499a2dd95SBruce Richardson uint32_t n_retries; 6599a2dd95SBruce Richardson }; 6699a2dd95SBruce Richardson 6799a2dd95SBruce Richardson /** fd_writer_nodrop port operations */ 6899a2dd95SBruce Richardson extern struct rte_port_out_ops rte_port_fd_writer_nodrop_ops; 6999a2dd95SBruce Richardson 7099a2dd95SBruce Richardson #ifdef __cplusplus 7199a2dd95SBruce Richardson } 7299a2dd95SBruce Richardson #endif 7399a2dd95SBruce Richardson 7499a2dd95SBruce Richardson #endif 75