1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
4 #ifndef __INCLUDE_RTE_SWX_PORT_H__
5 #define __INCLUDE_RTE_SWX_PORT_H__
15 * Packet I/O port interface.
22 /** Opaque packet handle. */
25 /** Buffer where the packet is stored. */
28 /** Packet buffer offset of the first packet byte. */
31 /** Packet length in bytes. */
43 * Arguments for input port creation. Format specific to each port type.
45 * Handle to input port instance on success, NULL on error.
48 (*rte_swx_port_in_create_t)(void *args);
57 (*rte_swx_port_in_free_t)(void *port);
60 * Input port packet receive
65 * Received packet. Only valid when the function returns 1. Must point to
68 * 0 when no packet was received, 1 when a packet was received. No other
69 * return values are allowed.
72 (*rte_swx_port_in_pkt_rx_t)(void *port,
73 struct rte_swx_pkt *pkt);
75 /** Input port statistics counters. */
76 struct rte_swx_port_in_stats {
77 /** Number of packets. */
80 /** Number of bytes. */
83 /** Number of empty polls. */
88 * Input port statistics counters read
93 * Input port statistics counters. Must point to valid memory.
96 (*rte_swx_port_in_stats_read_t)(void *port,
97 struct rte_swx_port_in_stats *stats);
99 /** Input port operations. */
100 struct rte_swx_port_in_ops {
101 /** Create. Must be non-NULL. */
102 rte_swx_port_in_create_t create;
104 /** Free. Must be non-NULL. */
105 rte_swx_port_in_free_t free;
107 /** Packet reception. Must be non-NULL. */
108 rte_swx_port_in_pkt_rx_t pkt_rx;
110 /** Statistics counters read. Must be non-NULL. */
111 rte_swx_port_in_stats_read_t stats_read;
122 * Arguments for output port creation. Format specific to each port type.
124 * Handle to output port instance on success, NULL on error.
127 (*rte_swx_port_out_create_t)(void *args);
133 * Output port handle.
136 (*rte_swx_port_out_free_t)(void *port);
139 * Output port packet transmit
142 * Output port handle.
144 * Packet to be transmitted.
147 (*rte_swx_port_out_pkt_tx_t)(void *port,
148 struct rte_swx_pkt *pkt);
154 * Output port handle.
157 (*rte_swx_port_out_flush_t)(void *port);
159 /** Output port statistics counters. */
160 struct rte_swx_port_out_stats {
161 /** Number of packets. */
164 /** Number of bytes. */
169 * Output port statistics counters read
172 * Output port handle.
174 * Output port statistics counters. Must point to valid memory.
177 (*rte_swx_port_out_stats_read_t)(void *port,
178 struct rte_swx_port_out_stats *stats);
180 /** Output port operations. */
181 struct rte_swx_port_out_ops {
182 /** Create. Must be non-NULL. */
183 rte_swx_port_out_create_t create;
185 /** Free. Must be non-NULL. */
186 rte_swx_port_out_free_t free;
188 /** Packet transmission. Must be non-NULL. */
189 rte_swx_port_out_pkt_tx_t pkt_tx;
191 /** Flush. May be NULL. */
192 rte_swx_port_out_flush_t flush;
194 /** Statistics counters read. Must be non-NULL. */
195 rte_swx_port_out_stats_read_t stats_read;