DPDK  24.11.0-rc3
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 
16 #include <stdint.h>
17 #include <rte_mbuf.h>
18 
23 #define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \
24  (&((uint8_t *)(mbuf))[offset])
25 #define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \
26  ((uint16_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
27 #define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \
28  ((uint32_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
29 #define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) \
30  ((uint64_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
31 
32 #define RTE_MBUF_METADATA_UINT8(mbuf, offset) \
33  (*RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
34 #define RTE_MBUF_METADATA_UINT16(mbuf, offset) \
35  (*RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset))
36 #define RTE_MBUF_METADATA_UINT32(mbuf, offset) \
37  (*RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset))
38 #define RTE_MBUF_METADATA_UINT64(mbuf, offset) \
39  (*RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset))
40 
42 /*
43  * Port IN
44  */
47 #define RTE_PORT_IN_BURST_SIZE_MAX 64
48 
51  uint64_t n_pkts_in;
52  uint64_t n_pkts_drop;
53 };
54 
65 typedef void* (*rte_port_in_op_create)(void *params, int socket_id);
66 
75 typedef int (*rte_port_in_op_free)(void *port);
76 
89 typedef int (*rte_port_in_op_rx)(
90  void *port,
91  struct rte_mbuf **pkts,
92  uint32_t n_pkts);
93 
108  void *port,
109  struct rte_port_in_stats *stats,
110  int clear);
111 
118 };
119 
120 /*
121  * Port OUT
122  */
125  uint64_t n_pkts_in;
126  uint64_t n_pkts_drop;
127 };
128 
139 typedef void* (*rte_port_out_op_create)(void *params, int socket_id);
140 
149 typedef int (*rte_port_out_op_free)(void *port);
150 
161 typedef int (*rte_port_out_op_tx)(
162  void *port,
163  struct rte_mbuf *pkt);
164 
180 typedef int (*rte_port_out_op_tx_bulk)(
181  void *port,
182  struct rte_mbuf **pkts,
183  uint64_t pkts_mask);
184 
193 typedef int (*rte_port_out_op_flush)(void *port);
194 
209  void *port,
210  struct rte_port_out_stats *stats,
211  int clear);
212 
221 };
222 
223 #endif
int(* rte_port_in_op_rx)(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
Definition: rte_port.h:89
rte_port_out_op_create f_create
Definition: rte_port.h:215
rte_port_out_op_tx_bulk f_tx_bulk
Definition: rte_port.h:218
rte_port_out_op_stats_read f_stats
Definition: rte_port.h:220
rte_port_in_op_rx f_rx
Definition: rte_port.h:116
rte_port_in_op_stats_read f_stats
Definition: rte_port.h:117
void *(* rte_port_in_op_create)(void *params, int socket_id)
Definition: rte_port.h:65
uint16_t port
void *(* rte_port_out_op_create)(void *params, int socket_id)
Definition: rte_port.h:139
int(* rte_port_out_op_free)(void *port)
Definition: rte_port.h:149
int(* rte_port_out_op_flush)(void *port)
Definition: rte_port.h:193
rte_port_out_op_tx f_tx
Definition: rte_port.h:217
int(* rte_port_in_op_stats_read)(void *port, struct rte_port_in_stats *stats, int clear)
Definition: rte_port.h:107
int(* rte_port_out_op_tx)(void *port, struct rte_mbuf *pkt)
Definition: rte_port.h:161
rte_port_out_op_flush f_flush
Definition: rte_port.h:219
int(* rte_port_out_op_stats_read)(void *port, struct rte_port_out_stats *stats, int clear)
Definition: rte_port.h:208
rte_port_in_op_create f_create
Definition: rte_port.h:114
int(* rte_port_out_op_tx_bulk)(void *port, struct rte_mbuf **pkts, uint64_t pkts_mask)
Definition: rte_port.h:180
rte_port_out_op_free f_free
Definition: rte_port.h:216
rte_port_in_op_free f_free
Definition: rte_port.h:115
int(* rte_port_in_op_free)(void *port)
Definition: rte_port.h:75