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;