DPDK  24.03.0
rte_port.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_PORT_H__
6 #define __INCLUDE_RTE_PORT_H__
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
20 #include <stdint.h>
21 #include <rte_mbuf.h>
22 
27 #define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \
28  (&((uint8_t *)(mbuf))[offset])
29 #define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \
30  ((uint16_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
31 #define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \
32  ((uint32_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
33 #define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) \
34  ((uint64_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
35 
36 #define RTE_MBUF_METADATA_UINT8(mbuf, offset) \
37  (*RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
38 #define RTE_MBUF_METADATA_UINT16(mbuf, offset) \
39  (*RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset))
40 #define RTE_MBUF_METADATA_UINT32(mbuf, offset) \
41  (*RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset))
42 #define RTE_MBUF_METADATA_UINT64(mbuf, offset) \
43  (*RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset))
44 
46 /*
47  * Port IN
48  */
51 #define RTE_PORT_IN_BURST_SIZE_MAX 64
52 
55  uint64_t n_pkts_in;
56  uint64_t n_pkts_drop;
57 };
58 
69 typedef void* (*rte_port_in_op_create)(void *params, int socket_id);
70 
79 typedef int (*rte_port_in_op_free)(void *port);
80 
93 typedef int (*rte_port_in_op_rx)(
94  void *port,
95  struct rte_mbuf **pkts,
96  uint32_t n_pkts);
97 
112  void *port,
113  struct rte_port_in_stats *stats,
114  int clear);
115 
122 };
123 
124 /*
125  * Port OUT
126  */
129  uint64_t n_pkts_in;
130  uint64_t n_pkts_drop;
131 };
132 
143 typedef void* (*rte_port_out_op_create)(void *params, int socket_id);
144 
153 typedef int (*rte_port_out_op_free)(void *port);
154 
165 typedef int (*rte_port_out_op_tx)(
166  void *port,
167  struct rte_mbuf *pkt);
168 
184 typedef int (*rte_port_out_op_tx_bulk)(
185  void *port,
186  struct rte_mbuf **pkts,
187  uint64_t pkts_mask);
188 
197 typedef int (*rte_port_out_op_flush)(void *port);
198 
213  void *port,
214  struct rte_port_out_stats *stats,
215  int clear);
216 
225 };
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif
int(* rte_port_in_op_rx)(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
Definition: rte_port.h:93
rte_port_out_op_create f_create
Definition: rte_port.h:219
rte_port_out_op_tx_bulk f_tx_bulk
Definition: rte_port.h:222
rte_port_out_op_stats_read f_stats
Definition: rte_port.h:224
rte_port_in_op_rx f_rx
Definition: rte_port.h:120
rte_port_in_op_stats_read f_stats
Definition: rte_port.h:121
void *(* rte_port_in_op_create)(void *params, int socket_id)
Definition: rte_port.h:69
uint16_t port
void *(* rte_port_out_op_create)(void *params, int socket_id)
Definition: rte_port.h:143
int(* rte_port_out_op_free)(void *port)
Definition: rte_port.h:153
int(* rte_port_out_op_flush)(void *port)
Definition: rte_port.h:197
rte_port_out_op_tx f_tx
Definition: rte_port.h:221
int(* rte_port_in_op_stats_read)(void *port, struct rte_port_in_stats *stats, int clear)
Definition: rte_port.h:111
int(* rte_port_out_op_tx)(void *port, struct rte_mbuf *pkt)
Definition: rte_port.h:165
rte_port_out_op_flush f_flush
Definition: rte_port.h:223
int(* rte_port_out_op_stats_read)(void *port, struct rte_port_out_stats *stats, int clear)
Definition: rte_port.h:212
rte_port_in_op_create f_create
Definition: rte_port.h:118
int(* rte_port_out_op_tx_bulk)(void *port, struct rte_mbuf **pkts, uint64_t pkts_mask)
Definition: rte_port.h:184
rte_port_out_op_free f_free
Definition: rte_port.h:220
rte_port_in_op_free f_free
Definition: rte_port.h:119
int(* rte_port_in_op_free)(void *port)
Definition: rte_port.h:79