xref: /dpdk/lib/graph/graph_pcap_private.h (revision 9b72ea1fc3ccdd3cb3f8a01daefea5d4300221e0)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2023 Marvell International Ltd.
3  */
4 
5 #ifndef _RTE_GRAPH_PCAP_PRIVATE_H_
6 #define _RTE_GRAPH_PCAP_PRIVATE_H_
7 
8 #include <stdint.h>
9 #include <sys/types.h>
10 
11 #include "graph_private.h"
12 
13 /**
14  * @internal
15  *
16  * Pcap trace enable/disable function.
17  *
18  * The function is called to enable/disable graph pcap trace functionality.
19  *
20  * @param val
21  *   Value to be set to enable/disable graph pcap trace.
22  */
23 void graph_pcap_enable(bool val);
24 
25 /**
26  * @internal
27  *
28  * Check graph pcap trace is enable/disable.
29  *
30  * The function is called to check if the graph pcap trace is enabled/disabled.
31  *
32  * @return
33  *   - 1: Enable
34  *   - 0: Disable
35  */
36 int graph_pcap_is_enable(void);
37 
38 /**
39  * @internal
40  *
41  * Initialise graph pcap trace functionality.
42  *
43  * The function invoked to allocate mempool.
44  *
45  * @return
46  *   0 on success and -1 on failure.
47  */
48 int graph_pcap_mp_init(void);
49 
50 /**
51  * @internal
52  *
53  * Initialise graph pcap trace functionality.
54  *
55  * The function invoked to open pcap file.
56  *
57  * @param filename
58  *   Pcap filename.
59  *
60  * @return
61  *   0 on success and -1 on failure.
62  */
63 int graph_pcap_file_open(const char *filename);
64 
65 /**
66  * @internal
67  *
68  * Initialise graph pcap trace functionality.
69  *
70  * The function invoked when the graph pcap trace is enabled. This function
71  * open's pcap file and allocates mempool. Information needed for secondary
72  * process is populated.
73  *
74  * @param graph
75  *   Pointer to graph structure.
76  *
77  * @return
78  *   0 on success and -1 on failure.
79  */
80 int graph_pcap_init(struct graph *graph);
81 
82 /**
83  * @internal
84  *
85  * Exit graph pcap trace functionality.
86  *
87  * The function is called to exit graph pcap trace and close open fd's and
88  * free up memory. Pcap trace is also disabled.
89  *
90  * @param graph
91  *   Pointer to graph structure.
92  */
93 void graph_pcap_exit(struct rte_graph *graph);
94 
95 /**
96  * @internal
97  *
98  * Capture mbuf metadata and node metadata to a pcap file.
99  *
100  * When graph pcap trace enabled, this function is invoked prior to each node
101  * and mbuf, node metadata is parsed and captured in a pcap file.
102  *
103  * @param graph
104  *   Pointer to the graph object.
105  * @param node
106  *   Pointer to the node object.
107  * @param objs
108  *   Pointer to an array of objects to be processed.
109  * @param nb_objs
110  *   Number of objects in the array.
111  */
112 uint16_t graph_pcap_dispatch(struct rte_graph *graph,
113 				   struct rte_node *node, void **objs,
114 				   uint16_t nb_objs);
115 
116 #endif /* _RTE_GRAPH_PCAP_PRIVATE_H_ */
117