]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/lib/librte_pdump/rte_pdump.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / seastar / dpdk / lib / librte_pdump / rte_pdump.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 Intel Corporation
3 */
4
5 #ifndef _RTE_PDUMP_H_
6 #define _RTE_PDUMP_H_
7
8 /**
9 * @file
10 * RTE pdump
11 *
12 * packet dump library to provide packet capturing support on dpdk.
13 */
14
15 #include <stdint.h>
16 #include <rte_mempool.h>
17 #include <rte_ring.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 #define RTE_PDUMP_ALL_QUEUES UINT16_MAX
24
25 enum {
26 RTE_PDUMP_FLAG_RX = 1, /* receive direction */
27 RTE_PDUMP_FLAG_TX = 2, /* transmit direction */
28 /* both receive and transmit directions */
29 RTE_PDUMP_FLAG_RXTX = (RTE_PDUMP_FLAG_RX|RTE_PDUMP_FLAG_TX)
30 };
31
32 /**
33 * Initialize packet capturing handling
34 *
35 * Register the IPC action for communication with target (primary) process.
36 *
37 * @return
38 * 0 on success, -1 on error
39 */
40 int
41 rte_pdump_init(void);
42
43 /**
44 * Un initialize packet capturing handling
45 *
46 * Unregister the IPC action for communication with target (primary) process.
47 *
48 * @return
49 * 0 on success, -1 on error
50 */
51 int
52 rte_pdump_uninit(void);
53
54 /**
55 * Enables packet capturing on given port and queue.
56 *
57 * @param port
58 * port on which packet capturing should be enabled.
59 * @param queue
60 * queue of a given port on which packet capturing should be enabled.
61 * users should pass on value UINT16_MAX to enable packet capturing on all
62 * queues of a given port.
63 * @param flags
64 * flags specifies RTE_PDUMP_FLAG_RX/RTE_PDUMP_FLAG_TX/RTE_PDUMP_FLAG_RXTX
65 * on which packet capturing should be enabled for a given port and queue.
66 * @param ring
67 * ring on which captured packets will be enqueued for user.
68 * @param mp
69 * mempool on to which original packets will be mirrored or duplicated.
70 * @param filter
71 * place holder for packet filtering.
72 *
73 * @return
74 * 0 on success, -1 on error, rte_errno is set accordingly.
75 */
76
77 int
78 rte_pdump_enable(uint16_t port, uint16_t queue, uint32_t flags,
79 struct rte_ring *ring,
80 struct rte_mempool *mp,
81 void *filter);
82
83 /**
84 * Disables packet capturing on given port and queue.
85 *
86 * @param port
87 * port on which packet capturing should be disabled.
88 * @param queue
89 * queue of a given port on which packet capturing should be disabled.
90 * users should pass on value UINT16_MAX to disable packet capturing on all
91 * queues of a given port.
92 * @param flags
93 * flags specifies RTE_PDUMP_FLAG_RX/RTE_PDUMP_FLAG_TX/RTE_PDUMP_FLAG_RXTX
94 * on which packet capturing should be enabled for a given port and queue.
95 *
96 * @return
97 * 0 on success, -1 on error, rte_errno is set accordingly.
98 */
99
100 int
101 rte_pdump_disable(uint16_t port, uint16_t queue, uint32_t flags);
102
103 /**
104 * Enables packet capturing on given device id and queue.
105 * device_id can be name or pci address of device.
106 *
107 * @param device_id
108 * device id on which packet capturing should be enabled.
109 * @param queue
110 * queue of a given device id on which packet capturing should be enabled.
111 * users should pass on value UINT16_MAX to enable packet capturing on all
112 * queues of a given device id.
113 * @param flags
114 * flags specifies RTE_PDUMP_FLAG_RX/RTE_PDUMP_FLAG_TX/RTE_PDUMP_FLAG_RXTX
115 * on which packet capturing should be enabled for a given port and queue.
116 * @param ring
117 * ring on which captured packets will be enqueued for user.
118 * @param mp
119 * mempool on to which original packets will be mirrored or duplicated.
120 * @param filter
121 * place holder for packet filtering.
122 *
123 * @return
124 * 0 on success, -1 on error, rte_errno is set accordingly.
125 */
126
127 int
128 rte_pdump_enable_by_deviceid(char *device_id, uint16_t queue,
129 uint32_t flags,
130 struct rte_ring *ring,
131 struct rte_mempool *mp,
132 void *filter);
133
134 /**
135 * Disables packet capturing on given device_id and queue.
136 * device_id can be name or pci address of device.
137 *
138 * @param device_id
139 * pci address or name of the device on which packet capturing
140 * should be disabled.
141 * @param queue
142 * queue of a given device on which packet capturing should be disabled.
143 * users should pass on value UINT16_MAX to disable packet capturing on all
144 * queues of a given device id.
145 * @param flags
146 * flags specifies RTE_PDUMP_FLAG_RX/RTE_PDUMP_FLAG_TX/RTE_PDUMP_FLAG_RXTX
147 * on which packet capturing should be enabled for a given port and queue.
148 *
149 * @return
150 * 0 on success, -1 on error, rte_errno is set accordingly.
151 */
152 int
153 rte_pdump_disable_by_deviceid(char *device_id, uint16_t queue,
154 uint32_t flags);
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif /* _RTE_PDUMP_H_ */