DPDK  19.11.14
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 
21 #include <stdint.h>
22 #include <rte_mbuf.h>
23 
28 #define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) \
29  (&((uint8_t *)(mbuf))[offset])
30 #define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) \
31  ((uint16_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
32 #define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) \
33  ((uint32_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
34 #define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) \
35  ((uint64_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
36 
37 #define RTE_MBUF_METADATA_UINT8(mbuf, offset) \
38  (*RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
39 #define RTE_MBUF_METADATA_UINT16(mbuf, offset) \
40  (*RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset))
41 #define RTE_MBUF_METADATA_UINT32(mbuf, offset) \
42  (*RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset))
43 #define RTE_MBUF_METADATA_UINT64(mbuf, offset) \
44  (*RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset))
45 
47 /*
48  * Port IN
49  *
50  */
53 #define RTE_PORT_IN_BURST_SIZE_MAX 64
54 
57  uint64_t n_pkts_in;
58  uint64_t n_pkts_drop;
59 };
60 
71 typedef void* (*rte_port_in_op_create)(void *params, int socket_id);
72 
81 typedef int (*rte_port_in_op_free)(void *port);
82 
95 typedef int (*rte_port_in_op_rx)(
96  void *port,
97  struct rte_mbuf **pkts,
98  uint32_t n_pkts);
99 
114  void *port,
115  struct rte_port_in_stats *stats,
116  int clear);
117 
124 };
125 
126 /*
127  * Port OUT
128  *
129  */
132  uint64_t n_pkts_in;
133  uint64_t n_pkts_drop;
134 };
135 
146 typedef void* (*rte_port_out_op_create)(void *params, int socket_id);
147 
156 typedef int (*rte_port_out_op_free)(void *port);
157 
168 typedef int (*rte_port_out_op_tx)(
169  void *port,
170  struct rte_mbuf *pkt);
171 
187 typedef int (*rte_port_out_op_tx_bulk)(
188  void *port,
189  struct rte_mbuf **pkt,
190  uint64_t pkts_mask);
191 
200 typedef int (*rte_port_out_op_flush)(void *port);
201 
216  void *port,
217  struct rte_port_out_stats *stats,
218  int clear);
219 
228 };
229 
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 #endif
int(* rte_port_in_op_rx)(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
Definition: rte_port.h:95
rte_port_out_op_create f_create
Definition: rte_port.h:222
rte_port_out_op_tx_bulk f_tx_bulk
Definition: rte_port.h:225
rte_port_out_op_stats_read f_stats
Definition: rte_port.h:227
rte_port_in_op_rx f_rx
Definition: rte_port.h:122
rte_port_in_op_stats_read f_stats
Definition: rte_port.h:123
void *(* rte_port_in_op_create)(void *params, int socket_id)
Definition: rte_port.h:71
uint16_t port
void *(* rte_port_out_op_create)(void *params, int socket_id)
Definition: rte_port.h:146
int(* rte_port_out_op_free)(void *port)
Definition: rte_port.h:156
int(* rte_port_out_op_flush)(void *port)
Definition: rte_port.h:200
rte_port_out_op_tx f_tx
Definition: rte_port.h:224
int(* rte_port_in_op_stats_read)(void *port, struct rte_port_in_stats *stats, int clear)
Definition: rte_port.h:113
int(* rte_port_out_op_tx)(void *port, struct rte_mbuf *pkt)
Definition: rte_port.h:168
rte_port_out_op_flush f_flush
Definition: rte_port.h:226
int(* rte_port_out_op_stats_read)(void *port, struct rte_port_out_stats *stats, int clear)
Definition: rte_port.h:215
rte_port_in_op_create f_create
Definition: rte_port.h:120
rte_port_out_op_free f_free
Definition: rte_port.h:223
int(* rte_port_out_op_tx_bulk)(void *port, struct rte_mbuf **pkt, uint64_t pkts_mask)
Definition: rte_port.h:187
rte_port_in_op_free f_free
Definition: rte_port.h:121
int(* rte_port_in_op_free)(void *port)
Definition: rte_port.h:81