| 159 | } |
| 160 | |
| 161 | int |
| 162 | graph_pcap_init(struct graph *graph) |
| 163 | { |
| 164 | struct rte_graph *graph_data = graph->graph; |
| 165 | |
| 166 | if (graph_pcap_file_open(graph->pcap_filename) < 0) |
| 167 | goto error; |
| 168 | |
| 169 | if (graph_pcap_mp_init() < 0) |
| 170 | goto error; |
| 171 | |
| 172 | /* User configured number of packets to capture. */ |
| 173 | if (graph->num_pkt_to_capture) |
| 174 | graph_data->nb_pkt_to_capture = graph->num_pkt_to_capture; |
| 175 | else |
| 176 | graph_data->nb_pkt_to_capture = GRAPH_PCAP_NUM_PACKETS; |
| 177 | |
| 178 | /* All good. Now populate data for secondary process. */ |
| 179 | rte_strscpy(graph_data->pcap_filename, graph->pcap_filename, RTE_GRAPH_PCAP_FILE_SZ); |
| 180 | graph_data->pcap_enable = 1; |
| 181 | |
| 182 | return 0; |
| 183 | |
| 184 | error: |
| 185 | graph_pcap_exit(graph_data); |
| 186 | graph_pcap_enable(0); |
| 187 | graph_err("Graph pcap initialization failed. Disabling pcap trace."); |
| 188 | return -1; |
| 189 | } |
| 190 | |
| 191 | uint16_t |
| 192 | graph_pcap_dispatch(struct rte_graph *graph, |
no test coverage detected